#include <iostream> int main() { int myArray[5]; for (int i=0; i<5; i++) // 0-4 { std::cout << "Value for myArray[" << i << "]: "; std::cin >> myArray[i]; } for (int i = 0; i<5; i++) std::cout << i << ": " << myArray[i] << "\n"; return 0; }
Value for myArray[0]: 1 Value for myArray[1]: 2 Value for myArray[2]: 3 Value for myArray[3]: 4 Value for myArray[4]: 5 0: 1 1: 2 2: 3 3: 4 4: 5