New course! Every coder should learn Generative AI!
Try a free lesson+ 2
Use a range-based for loop(printing an array is a basic I don't think you even need to practice it).
std::array<int,5> arr = {1,2,3,4,5}; // std::array is the "real" array in C++, not arr[size]
for(int i : arr) std::cout << i << ' ';
0
Post the code here
0
Make a for loop to go through the range of the index and cout each value.
for ( index = 0; index < 5; index++)
cout << arr[index] << endl;