I'm trying to keep running the program to input numbers into an array unless the user inputs a 10. For some reason, when I input a 10 into the program, the loop doesn't break and it goes on continuously. Can somebody explain to me why my loop isn't working the way I want it to. My code is below.
If I have understood your problem correctly, a for loop would do the job better.
1 2 3 4 5 6
for(unsignedint i = 0; i <10; i++) // keeps running until i is 10 or greater. updates i every time it loops.
{
int k = 0;
std::cin >>k;
number[i] = k;
}