Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main() {
- wifstream fin("stroka_3.txt");
- wstring A[20];
- int n = 0;
- while (getline(fin, A[n]))
- n++;
- cout << "Построчный вывод из файла:" << endl;
- for (int i = 0; i < n; i++) {
- wcout << "Строка " << i << " -> " << A[i] << endl;
- cout << '\t' << "Количество символов = " << A[i].size() << endl;
- int count = 1;
- for (int j = 0; j < A[i].size() - 1; j++)
- if (A[i][j] == ' ' && A[i][j + 1] != ' ')
- count++;
- cout << '\t' << "Количество слов = " << count << endl;
- }
- cout << "Всего строк -> " << n << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment