codegod313

Order4(2)

Nov 30th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale.h>
  3. #include <string>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9.  
  10. int main()
  11. {
  12.     setlocale(LC_ALL, "Russian");
  13.     char gl[] = {'e','u','i','o','a','y'};
  14.     char sgl[] = {'q','w','r','t','p','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m'};
  15.     cout << "Введите строку" << endl;
  16.     string s;
  17.     rewind(stdin);
  18.     getline(cin, s);
  19.     int g = 0, sg = 0;
  20.     for (int i = 0; i < s.size(); i++) {
  21.         for (int j = 0; j < 6; j++) {
  22.             if (s[i] == gl[j] || s[i] == gl[j] - 32) {
  23.                 g++;
  24.             }
  25.         }
  26.         for (int j = 0; j < 20; j++) {
  27.             if (s[i] == sgl[j] || s[i] == sgl[j] - 32) {
  28.                 sg++;
  29.             }
  30.         }
  31.  
  32.     }
  33.     if (g > sg) {
  34.         cout << "Гласных в тексте больше" << endl;
  35.     }else
  36.         if (sg > g) {
  37.             cout << "Согласных букв в тексте больше" << endl;
  38.         }
  39.         else
  40.             cout << "Количество согласных и гласных букв равно" << endl;
  41. }
Add Comment
Please, Sign In to add comment