the problem I have here is: when I input an integer it works fine, but when i input any other thing, it doesn't give me a chance to input again when the loop iterates, it just keeps printing "error type the right thing" to the screen even though "cin var" is inside the loop.
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int var;
while(true){
cout<<"please enter any integer"<<endl;
cin>>var;
if(cin.good()){
cin.ignore(10, '\n');
break;
}
cin.clear();
cout<<"error, enter the right thing"<<endl;
}
return 0;}