Tell me, please, how can I find a line with the maximum number of words and output this result (the text is read from the file)
#include "stdafx.h" #include <iostream> #include <fstream> #include <conio.h> #include <string> #include <cstdlib> #include <algorithm> #pragma warning(disable : 4996) using namespace std; int main() { setlocale(LC_ALL, "Russian"); int otv; do { cout << "1.Кодировка" << endl << "2.Декодировка" << endl << "0.Выход" << endl; int count; cin >> count; if (count != 1 && count != 2 && count != 0) { cout << endl << "Будьте внимательней!" << endl << endl; } switch (count) { case 1: { string s; int strok = 0; int max = 0; ifstream book("text.txt"); if (book.is_open()) { cout << endl << "Текст загружен!" << endl << endl; } else { cout << "Текст не загружен!" << endl << endl; } while (getline(book, s)) { strok++; } cout << "Количество строк :" << strok << endl << "Максимальное количество слов в строке :" << max << endl << endl; break; } case 2: { break; } case 0: { exit(0); } } } while (otv = 1); _getch(); return 0; }