User is supposed to type an input, and if it's not an integer, the user needs to type another.
This repeats 3 times for 3 inputs which go inside an array.

The integer checking works, but the problem is that when i display the 3 integers, they are all the same number (the first correct input). Idk what's wrong. I've tried cin.clear() and cin.sync()...

for(int i=0;i<3;i++){
cout<<"Enter your "<<text[i+6]<<": ";
cin.sync();
cin.clear();
cin>>inInt[i];
if(!cin){
cout<<"\nPlease enter a valid integer.";
i--;
system("pause");}
system("cls");}

What does your display loop look like?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.