Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. const char magasak[] = {'e','i'};
  8. const char melyek[] = {'a','u','o',};
  9. const int maxN = 10;
  10. bool Mely(char c) {
  11.     int k=1;
  12.     while (k<=3 && melyek[k-1]!=c) {
  13.         k++;
  14.     }
  15.     return k<=3;
  16. }
  17.  
  18. bool Magase(string s) {
  19.     int j=1;
  20.     while (j<=s.length() && !Mely(s[j-1])) {
  21.         j++;
  22.     }
  23.     return j>s.length();
  24. }
  25.  
  26. void beolvasas(int &N,string s[maxN]) {
  27.     cerr << "Hany szo";
  28.     cin >> N;
  29.     for (int i=1; i<=N; i++) {
  30.         cerr << i << ". szo: ";
  31.         cin >> s[i-1];
  32.     }
  33. }
  34.  
  35. void feldolgozas(int N,string s[maxN],int &magasDb,int &melyDb,int &vegyesDb) {
  36.     magasDb=melyDb=vegyesDb=0;
  37.     for (int i=1;i<=N; i++) {
  38.         if (Magase(s[i-1])) {
  39.             magasDb++;
  40.         }
  41.         if (Melye(s[i-~])) {
  42.             melyDb++;
  43.         }
  44.     }
  45.     vegyesDb = N - magasDb - melyDb;
  46. }
  47.  
  48. void kiiras(magasDb, melyDb, vegyesDb) {
  49.  
  50. }
  51. int main()
  52. {
  53.     string s[maxN];
  54.     int magasDb, melyDb, vegyesDb;
  55.     beolvasas(N,s);
  56.     feldolgozas(N,s, magasDb, melyDb, vegyesDb);
  57.     kiiras(magasDb, melyDb, vegyesDb);
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement