Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void quiz(){
- std::string s("1");
- {
- std::istringstream exp(s);
- exp.ignore();
- std::cout << "1)" << "\t" << exp.eof() << "\t" << (exp.peek() == EOF) << std::endl;
- }
- {
- std::istringstream exp(s);
- exp.ignore();
- std::cout << "2)" << "\t" << (exp.peek() == EOF) << "\t" << exp.eof() << std::endl;
- }
- {
- std::istringstream exp(s);
- exp.ignore();
- char c = '0';
- std::cout << "3)" << "\t" << (c = exp.peek(), c);
- std::cout << "\t" << (exp >> c, c) << std::endl;
- }
- {
- std::istringstream exp(s);
- char c = '0';
- std::cout << "4)" << "\t" << (exp >> c, c);
- std::cout << "\t" << (exp >> c, c) << std::endl;
- }
- {
- std::istringstream exp(s);
- exp.ignore();
- char c = '0';
- std::cout << "5)" << "\t" << (exp >> c, c);
- std::cout << "\t" << (c = exp.peek(), c) << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement