As I said above, I have a user input how many numbers there are, and then inputs the numbers they have. I know it is probably a simple fix, but can someone tell me what I'm doing wrong here.
Ex: If the input is 3 -55 55 -25, then the output is:
-55 _ 55 _ -25
#include <iostream>
using namespace std;
int main() {
int numVals;
int i;
int numVals_2;
cout >> "Enter how many numbers you have: ";
cin >> numVals;
for (i = 0; i < numVals; ++i) {
if (i >= numVals) {
cout << numVals_2 << endl;
}
else {
cout << "Enter one of your numbers: ";
cin >> numVals_2;
cout << numVals_2 << " _ ";
}
}
return 0;
}