Ask Question
3 March, 01:42

Write a value-returning function, isVowel, that returns the value true if a given character is a vowel and otherwise returns false. For the input E, your output should look like the following: E is a vowel: 1 When printing the value of a bool, true will be displayed as 1 and false will be displayed as 0. Grading When you have completed your program, click the Submit button to record your score.

+4
Answers (1)
  1. 3 March, 01:51
    0
    C+ + Code

    #include / /for input and output

    using namespace std;

    int isVowel (char ch) {

    if ((ch = = 'A') || (ch = = 'E') || (ch = = 'I') || (ch = = 'O') || (ch = = 'U') || (ch = = 'a') || (ch = = 'e') ||

    (ch = = 'i') || (ch = = 'o') || (ch = = 'u')) {

    return true;

    }

    else {

    return false;

    }

    }

    int main ()

    {

    char character;

    cout<<"Enter character : ";

    cin >> character;

    cout<
    return 0;

    }

    Code Explanation

    Get character from user and pass that character into isVowel function.

    IsVowel function then check if the character is vowel by using if statement.

    if character is vowel the return true as a Boolean value.

    By using Cout, Boolean value then converted into number. so it will show 1 for true and 0 for false.

    Output

    Case 1:

    Enter character : a

    a is a vowel:1

    Case 2:

    Enter character : b

    b is a vowel:0
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a value-returning function, isVowel, that returns the value true if a given character is a vowel and otherwise returns false. For the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers