Advertisement
Guest User

lab

a guest
Dec 12th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //  word-lab
  4. //
  5. //  Created by Nikita Korvyakov on 12.12.2019.
  6. //  Copyright © 2019 Nikita Korvyakov. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <fstream>
  11. using namespace std;
  12. int main(int argc, const char * argv[]) {
  13.     ifstream fin;
  14.     fin.open("test.txt");
  15.     int count = 0;
  16.     string s;
  17.     while(fin >> s){
  18.         count++;
  19.     }
  20.     fin.close();    
  21.     cout << "Количество слов: " << count << endl;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement