Ask 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 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.

+2
Answers (1)
  1. 1 September, 10:15
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers