Advertisement
ortem_kats

salibek_lab4

Feb 4th, 2020
2,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
  5. C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <iostream>
  10. #include <string>
  11. #include <vector>
  12.  
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17.     string str = "qweeaasdzxc";
  18.     vector<string> vec {"qwee", "dfg", "ss", "zxc", "eaa"};
  19.    
  20.     int kol = 0;
  21.     string vowels = "eyuioa";
  22.     for (auto &s : vec){
  23.         char pc = '.';
  24.         for (auto &cc : s){
  25.             if (cc == pc && vowels.find(cc) != string::npos){
  26.                 kol++;
  27.                 break;
  28.             }
  29.             pc = cc;
  30.         }
  31.     }
  32.    
  33.     cout << 100 * kol / vec.size() << "%\n";
  34.    
  35.     string sentence;
  36.     int count = 0;
  37.     for (auto &s : vec)
  38.         if (str.find(s) != string::npos){
  39.             count++;
  40.             for (int i = 0; i < count; i++)
  41.                 sentence.append("*");
  42.             sentence.append(s + " ");
  43.         }
  44.        
  45.     cout << sentence << "\n";
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement