Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include "windows.h"
- using namespace std;
- void main()
- {
- int k1 = 0, k2 = 0, k3 = 0;
- setlocale(LC_ALL, "Russian");
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- string str;
- cout << "Введите текст" << endl;
- getline(cin, str);
- while (str.find("...") != string::npos) {
- str.replace(str.find("..."), 3, ".");
- }
- while (str.find(".") != string::npos) {
- str.replace(str.find("."), 3, "");
- k1++;
- }
- while (str.find("!") != string::npos) {
- str.replace(str.find("!"), 3, "");
- k2++;
- }
- while (str.find("?") != string::npos) {
- str.replace(str.find("?"), 3, "");
- k3++;
- }
- cout << "Количество повествовательных предложений : " << k1 << endl
- << "Количество вопросительных предложений : " << k2 << endl
- << "Количество восклицательных предложений : " << k3 << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement