Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <math.h>
  4. #include <map>
  5. #include <set>
  6. #include <string>
  7. using namespace std;
  8.  
  9. long double fact(int N)
  10. {
  11.     if(N < 0) {
  12.         return 0;}
  13.     if (N == 0){
  14.         return 1;
  15.     }else {
  16.         return N * fact(N - 1);
  17.     }
  18. }
  19. long long unsigned int my_pow(int a,int n,int m){
  20.     if(n==0){
  21.         return 1;
  22.     } else{
  23.         if(n%2 == 0){
  24.             return (int(pow((my_pow(a,n/2,m)),2))) % m;
  25.         } else{
  26.             return (a*my_pow(a,n-1,m))%m;
  27.         }
  28.     }
  29. }
  30.  
  31. bool is_constant(char ch){
  32.     if (ch == 'a' || ch == 'e' || ch == 'o' || ch == 'y'||ch == 'i' || ch == 'u'){
  33.         return false;
  34.     }
  35.     return true;
  36. }
  37.  
  38.  
  39. int is_equal(string s11,string s22, int k){
  40.     for(int ii = (s11.length()-k), jj = 0; ii < s11.length(), jj < k; ii++, jj++){
  41.         if(s11[ii] != s22[jj]){
  42.             return 0;
  43.         }
  44.     }
  45.     return 1;
  46. }
  47.  
  48. int main() {
  49.  
  50. //==========  2 ===========
  51. int vowels=0, consonsnts=0;
  52. char current;
  53. current =  getchar();
  54. while (current != '\n' ){
  55.     switch (current){
  56.         case 'a':
  57.         case 'e':
  58.         case 'o':
  59.         case 'u':
  60.         case 'i':
  61.         case 'y':
  62.             vowels++;
  63.             break;
  64.         default:
  65.             consonsnts++;
  66.             break;
  67.     }
  68.     current =  getchar();
  69. //    putchar(current);
  70. }
  71.  
  72.  
  73. cout<< "vowels  "<<vowels<<"  "<<endl;
  74. cout<< "consonants  "<<consonsnts<<"  "<<endl;
  75.  
  76. if(consonsnts>vowels){
  77.     cout << "obviously more consonats";
  78. } else if(consonsnts == vowels){
  79.     cout << "the same number ";
  80. } else{
  81.     cout << "obviously more vowels";
  82. }
  83.  
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement