Make a c++ program that will display all the contents of an integers array with a length of 5. Use a for Loop.
#include <iostream>
using namespace std;
int main()
{
const int N=5;
int arr[N];
cout << "Please, fill an array with a length of "<<N<<": ";
for (int i = 0; i < N; i++)
{
cin >> arr[i];
}
cout << "You are entered: ";
for (int i = 0; i < N; i++)
{
cout << arr[i] << " ";
}
}
Comments
Leave a comment