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");}
2
Contributors
1
Reply
32 Minutes
Discussion Span
4 Months Ago
Last Updated
2
Views
Related Article:type checking c++
is a C++ discussion thread by bryangino20 that has 5 replies, was last updated 7 months ago and has been tagged with the keywords: type, checking, possible.