Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- your
- text
- would
- be
- entered
- like
- this
- youway exttay ouldway ebay enteredway ikelay histay
- your text would be entered like this
- std::string in;
- while (std::cin >> in)
- std::cout << piglatin(in) << char(std::cin.get());
- #include <cctype>
- char look_for_nl(std::istream& is) {
- for (char d = is.get(); is; d = is.get()) {
- if (d == 'n') return d;
- if (!isspace(d)) {
- is.putback(d);
- return ' ';
- }
- }
- // We got an eof and there was no NL character. We'll pretend we saw one
- return 'n';
- }
- std::string in;
- while (std::cin >> in)
- std::cout << piglatin(in) << look_for_nl(std::cin);
Add Comment
Please, Sign In to add comment