#include #include #include using namespace std; int main() { int array[10] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}; cout << "Output array:\n"; for (int i = 0; i < 10; i++) cout << array[i] << '\n'; for (int x : array) // range-based is a nice shortcut cout << x << '\n'; // when you are going from front to back cout << "Change array:\n"; for (int x : array) x = x * 3; cout << "Output array:\n"; for (int x : array) cout << x << '\n'; cout << "Change array (second attempt):\n"; for (int& x : array) x = x * 3; cout << "Output array:\n"; for (int x: array) cout << x << '\n'; string words[5] = {"The", "quick", "brown", "fox", "jumped"}; for (const string& str : words) cout << str << '\n'; /* */ }