First, read in an input value for variable numInput. Then, read numInput integers from input and output each integer on a newline after the string "input = ".
Ex: If the input is 2 30 40, the output is:
input = 30
input = 40
#include <iostream>
using namespace std;
int main() {
int numInput;
cin >> numInput;
int* input = new int[numInput];
for (int i=0; i<numInput; i++) {
cin >> input[i];
}
for (int i=0; i<numInput; i++) {
cout << "input = " << input[i] << endl;
}
delete [] input;
return 0;
}
Comments
Leave a comment