Ask Question
1 January, 05:57

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. 1 January, 09:46
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers