Advertisement
Trawka011

Untitled

Oct 31st, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. using namespace std;
  5.  
  6. int main() {
  7.     string str;
  8.     int  sum = 0;
  9.     ifstream fin("C:\\Users\\Start_IT\\Desktop\\in.txt");
  10.     ofstream fout("output.txt");
  11.     while(getline(fin, str)){        
  12.         sum = 0;
  13.         for (int j = 0; j < str.size() && (str[j] >= 32 && str[j] <= 126); j++) {
  14.             sum++;
  15.         }
  16.         cout << sum << " ";
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement