Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. using namespace std;
  5. int main(){
  6.     string myText("моя строка из нескольких строк");
  7.     istringstream iss(myText);
  8.     string token;
  9.     unsigned short word;
  10.     while (getline(iss, token, ' '))
  11.     {
  12.         if (token.length() > 0) word++;
  13.        
  14.     }
  15.     cout << word << endl;
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement