Answer to Question #315061 in C++ for Secret Agent

Question #315061

Arraying 101

I want you to make an array of numbers for me. All you have to do is make a program that will let me input any random integer in one line. Afterwards, it will then print out all the numbers I've inputted, backwards, on separate lines.


Care to do that for me?


Input

The first line contains the size of the array.

The next line contains the integers separated by a space.

5
1·64·32·2·11

Output

Multiple lines containing integers on each.

11
2
32
64
1




1
Expert's answer
2022-03-21T06:50:12-0400
#include <iostream>
#include <string>
using namespace std;


int main(void){
	int size;
	cin>>size;
	int* numbers = new int[size];
	for (int i = 0; i < size; i++) {
		cin>>numbers[i];
	}
	
	for (int i = size-1; i >= 0; i--) {
		cout<<numbers[i]<<"\n";
	}
	cout<<"\n\n";
	delete[] numbers;
	system("pause");
	return 0;
}

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