I'm new to C++ and I'm having trouble understanding how to determine what to put inside a loop. I know it differs from program to program, but a lot of my assignments deal with the user inputting a number of how many numbers they want to input (it can be any number)
For example, I'm working on an assignment that asks the user how many numbers they want to enter. The user then enters any number they want. My teacher wants us to then use a for loop to ask the user to enter numbers. For example:
"How many numbers would you like to enter?" 3
"Enter a number" 3
"Enter a number" 5
"Enter a number" 7
^The loop should stop here, but it keeps asking the user to enter more numbers...This is what I have for code so far.
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int number, value;
cout << "How many numbers do you wish to enter? ";
cin >> number;
for (number = 0; number == number; number++)
{
cout << "Enter a number: ";
cin >> value;
}
getch();
return 0;
}