Advertisement
Guest User

Untitled

a guest
May 16th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. bool isCorrect(char c) {
  2.     return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('а' <= c && c <= 'я') || ('А' <= c && c <= 'Я');
  3. }
  4.  
  5. string currentWord = "";
  6. char c;
  7. vector<string> words;
  8. while (!in.eof()) {
  9.     in >> c;
  10.     if (!isCorrect(c)) {
  11.         if (currentWord.size() > 0) {
  12.             words.push_back(currentWord);
  13.         }
  14.         currentWord = "";
  15.     } else {
  16.         currentWord += c;
  17.     }
  18. }
  19. if (currentWord.size() > 0) {
  20.     words.push_back(currentWord);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement