Warp wrote:
> What you can do is this:
>
> std::string s;
> while(true)
> {
> std::cin >> s;
> if(!std::cin.good()) break;
>
> int value;
> std::istringstream iss(s);
> iss >> value;
> if(!iss.fail())
> std::cout << "The input was an integer: " << value << "\n";
> else
> std::cout << "The input was something else: " << s << "\n";
> }
"Variable 'iss' has initialiser but has incomplete type."
WTF...?
Oh, wait, I see. That means "you didn't include <sstream>". Well, that
was quite clear. o_O
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|