Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. bool isItAVowel(char letter);
  4. int main()
  5. {
  6. char input;
  7.     while (1)
  8.     {
  9.       cout<<"Please enter a letter: (0 to quit)";
  10.       cin >> input;
  11.       if (input == '0') break;
  12.      
  13.       if (isItAVowel (input) )
  14.         cout<<"Yes, your letter is a vowel."<<endl;
  15.       else
  16.         cout<<"No, your letter is not a vowel."<<endl;
  17.     }
  18.   return 0;
  19. }
  20. bool isItAVowel(char letter)
  21. {  char vowels[10] = {'a','e','i','o','u','A','E','I','O','U'};
  22.    bool found = false;
  23.    char i;
  24.    
  25.     for (i = 0; i < 10; i++)
  26.     {
  27.     found = (vowels[i]);
  28.         if (vowels == 'a','e','i','o','u','A','E','I','O','U')
  29.         {
  30.         found = true;
  31.         }
  32.    // Add code here:
  33.    // Compare the letter to each element in the array
  34.     }  
  35.    return found;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement