Hi All,
I just have found out (for myself) that the program:
//**************************************
#include <iostream>
int main()
{
int a=0;
while(true)
{
std::cout << "Input a NUMBER!!!\n" << std::endl;
std::cin>>a; /// Here I input "a" eg char
if(!std::cin)
{
std::cout<<"Oouch, you have not listend me... I'm dying....\n";
std::cin.clear(); /// I want just to make another turn and not
cycle for eternity
}
std::cout<<a<<"\n";
}
return 0;
}
//**************************************
cycles forever if i input some char instead of numbers. Fast look throw
books have not showed me any solution for this but inputing into some
string and then parsing. All i want is just resurrect cin to make
another turn, is it possible?
--
float_dublin