Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- int main()
- {
- int length = 6;
- std::vector<char> in(length);
- in[0] = 'H';
- in[1] = 'e';
- in[2] = 'l';
- in[3] = 'l';
- in[4] = 'o';
- in[5] = '\0';
- for (int i = 0; i < length; ++i)
- {
- char a = in[i];
- std::cout << "a: " << a << std::endl;
- std::cin.putback(a);
- }
- while(std::cin)
- {
- char y;
- std::cin >> y;
- std::cout << "y: " << y << std::endl;
- if (y == '\0')
- {
- std::cout << "This is the end!" << std::endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement