#include #include #include #include "CyrIOS.h" // for Visual C++ 6.0 using namespace std; bool isLimit(char c) { char lim[] = {' ', '\t', '\n'}; for (int i=0; i < sizeof(lim); ++i) if (c == lim[i]) return true; return false; } int main() { ifstream fin("infile.txt"); if (!fin) { cout << "Ошибка открытия файла." << endl; return 1; } int count = 0; string word; ostringstream sentence; while(!fin.eof()) { char symb; while(isLimit(symb = fin.peek())) { sentence << symb; if (symb == '\n') break; fin.seekg(1, ios::cur); } fin >> word; sentence << word; char last = word[word.size() - 1]; if ((last == '.') || (last == '!')) { sentence.str(""); // очистка потока continue; } if (last == '?') { cout << sentence.str(); sentence.str(""); count++; } } if (!count) cout << "Вопросительных предложений нет."; cout << endl; return 0; }