Answer to Question #331415 in C++ for Chubby

Question #331415

Make a c++ program that will display all the contents of an integers array with a length of 5. Use a for Loop.


1
Expert's answer
2022-04-20T12:40:27-0400
#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] << " ";
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS