{"action":"created","issue":{"url":"https://api.github.com/repos/Mooophy/Cpp-Primer/issues/250","labels_url":"https://api.github.com/repos/Mooophy/Cpp-Primer/issues/250/labels{/name}","comments_url":"https://api.github.com/repos/Mooophy/Cpp-Primer/issues/250/comments","events_url":"https://api.github.com/repos/Mooophy/Cpp-Primer/issues/250/events","html_url":"https://github.com/Mooophy/Cpp-Primer/issues/250","id":80106867,"number":250,"title":"Exercise 5.21","user":{"login":"frank67","id":11892185,"avatar_url":"https://avatars.githubusercontent.com/u/11892185?v=3","gravatar_id":"","url":"https://api.github.com/users/frank67","html_url":"https://github.com/frank67","followers_url":"https://api.github.com/users/frank67/followers","following_url":"https://api.github.com/users/frank67/following{/other_user}","gists_url":"https://api.github.com/users/frank67/gists{/gist_id}","starred_url":"https://api.github.com/users/frank67/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frank67/subscriptions","organizations_url":"https://api.github.com/users/frank67/orgs","repos_url":"https://api.github.com/users/frank67/repos","events_url":"https://api.github.com/users/frank67/events{/privacy}","received_events_url":"https://api.github.com/users/frank67/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Mooophy/Cpp-Primer/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-24T09:23:16Z","updated_at":"2015-05-24T15:30:56Z","closed_at":null,"body":"https://github.com/frank67/Cpp-Primer/blob/master/ch05/ex5_21.cpp\r\nYou wrote:\r\n```\r\n    while ( cin >> read )\r\n        if (read == tmp && isupper(read[0])) break;\r\n        else tmp = read;\r\n```\r\nwell this isn't properly a bug, but in this exercize the ```continue``` statement is supposed to be used but is missing in your code, therefore I suggest to apply this change:\r\n```\r\n        while ( cin >> read )   {\r\n                if (read == tmp)        {\r\n                        if(isupper(read[0])) break;\r\n                        else continue;\r\n                }\r\n        tmp = read;\r\n        }\r\n```\r\notherwise you could consider to rewrite it without the tricky ```cin.eof()``` usage:\r\n```\r\n#include <iostream>\r\n#include <string>\r\n\r\nusing std::cout; using std::cin; using std::flush; using std::endl; using std::string;\r\n\r\nint main()\r\n{\r\n        string sword, sprev;\r\n        cout << \"Please enter some strings: \" << flush;\r\n        while(cin >> sword)     {\r\n                if(sprev == sword)      {\r\n                        if(isupper(sword[0]))   {\r\n                                cout << \"The word \" << sword << \" appears two times consecutively.\" << endl;\r\n                                sprev=\"\";\r\n                                break;\r\n                        } else\r\n                                continue;\r\n                }\r\n                sprev=sword;\r\n        }\r\n        if(!sprev.empty())\r\n                cout << \"There aren't words that appear two times consecutively.\" << endl;\r\n\r\n        return 0;\r\n}\r\n```\r\nHTH\r\nBest regards"},"comment":{"url":"https://api.github.com/repos/Mooophy/Cpp-Primer/issues/comments/105027385","html_url":"https://github.com/Mooophy/Cpp-Primer/issues/250#issuecomment-105027385","issue_url":"https://api.github.com/repos/Mooophy/Cpp-Primer/issues/250","id":105027385,"user":{"login":"pezy","id":1147451,"avatar_url":"https://avatars.githubusercontent.com/u/1147451?v=3","gravatar_id":"","url":"https://api.github.com/users/pezy","html_url":"https://github.com/pezy","followers_url":"https://api.github.com/users/pezy/followers","following_url":"https://api.github.com/users/pezy/following{/other_user}","gists_url":"https://api.github.com/users/pezy/gists{/gist_id}","starred_url":"https://api.github.com/users/pezy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pezy/subscriptions","organizations_url":"https://api.github.com/users/pezy/orgs","repos_url":"https://api.github.com/users/pezy/repos","events_url":"https://api.github.com/users/pezy/events{/privacy}","received_events_url":"https://api.github.com/users/pezy/received_events","type":"User","site_admin":false},"created_at":"2015-05-24T15:30:56Z","updated_at":"2015-05-24T15:30:56Z","body":"> \"empty\" was never printed, how can I do that?\r\n\r\nEnter `EOF`(Ctrl + Z in windows) directly.\r\n\r\n> For the rest your code had trouble with this input `S s` it gives no output,\r\n\r\nWhat? Impossible...\r\n\r\n- Input: `S s` then `EOF`.\r\n- Output: There aren't words that appear two times consecutively.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1147451/7788427/e7820860-026c-11e5-8bc4-144e2f1ef066.png)\r\n\r\nCould you please check again? "}}