Question

Write a program that write a value-returning function, isVowel, that returns the value true if a...

Write a program that write a value-returning function, isVowel, that returns the value true if a given character is a vowel and otherwise returns false.

You must insert the following comments at the beginning of your program and write our commands in the middle:

Write a C++ Program:

/*

// Name: Your Name

// ID: Your ID

*/

using namespace std;

#include <iostream>

using namespace std;

bool isVowel(char ch);

int main()

{

    char ch;

    …

    …

         YOUR CODE HERE

  …

    …

return 0;

}

bool isVowel(char ch)

{

    switch (ch)

    …

    …

         YOUR CODE HERE

  …

    …

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

using namespace std;

#include <iostream>

using namespace std;

bool isVowel(char ch);

int main()

{

char ch;
cout<<"Enter character: ";
cin>>ch;
if(isVowel(ch))
cout<<"Vowel"<<endl;
else
cout<<"Consonants"<<endl;

return 0;

}

bool isVowel(char ch)

{

switch (ch)
{
case 'a': return true;
break;
case 'e': return true;
break;
case 'i': return true;
break;
case 'o': return true;
break;
case 'u': return true;
break;
case 'A': return true;
break;
case 'E': return true;
break;
case 'I': return true;
break;
case 'O': return true;
break;
case 'U': return true;
break;
default: return false;

}

}

Add a comment
Know the answer?
Add Answer to:
Write a program that write a value-returning function, isVowel, that returns the value true if a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that prompts the user to input a string. The program then uses the...

    Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str=”There”, then after removing all the vowels, str=”Thr”. After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. #include <iostream> #include <string> using namespace std; void removeVowels(string& str); bool isVowel(char ch);...

  • Write a C++ Program Write a program that prompts the user to input a number. The...

    Write a C++ Program Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive, negative, or zero. You must insert the following comments at the beginning of your program and write our commands in the middle: Write a C++ Program: 1 Name: Your Name ID: Your ID #include <iostream> using namespace std; din main YOUR CODE HERE

  • I'm having trouble to write a value-returning function, isVowel, that returns the value true if a...

    I'm having trouble to write a value-returning function, isVowel, that returns the value true if a given character is a vowel and otherwise returns false. Can I get help with this?

  • 4. Write a function that returns a value to the main program illustrated below. In the...

    4. Write a function that returns a value to the main program illustrated below. In the function, the variable passed by the main program needs to be evaluated using a switch statement. The value returned is determined by the case that it matches. (10 points) If value is: return 10 return 20 3 return 30 Anything else, return 0 Main program: #include <iostream> using namespace std; int findValue (int); int main) { Int numb, retvalue cout << "In Enter a...

  • // Write a program that determines how many of each type of vowel are in an...

    // Write a program that determines how many of each type of vowel are in an entered string of 50 characters or less. // The program should prompt the user for a string. // The program should then sequence through the string character by character (till it gets to the NULL character) and count how many of each type of vowel are in the string. // Vowels: a, e, i, o, u. // Output the entered string, how many of...

  • Take the following C++ code and add to it the following: Write a program that reads...

    Take the following C++ code and add to it the following: Write a program that reads a string and outputs the number of times each lowercase vowel appears in it. Your program must contain a function with one of its parameters as a char variable, and if the character is a vowel, it increments that vowel's count. #include<iostream> #include<string> using namespace std; int countVowel(char, char); int main(void) { string str1; int countA = 0; int countE = 0; int countI...

  • Please help ASAP Question 3 (10 points): Using pointer notation, complete the C++ function below using...

    Please help ASAP Question 3 (10 points): Using pointer notation, complete the C++ function below using pointcr notations The function takes N characters in character array A and return true if the characters are consecutive and fahe otherwise. bool consecutiveChars(char A, int N) char first; // Pointer to the first character in A char last; // Pointer to the last character in A Your code here.. #include <iostream> #include <cctype> using namespace std; bool consecutiveChars(char* A, int N): nt main0...

  • (c++) (codeblocks) Write a program that contains a value-returning function that returns a value to be...

    (c++) (codeblocks) Write a program that contains a value-returning function that returns a value to be displayed in main() with the function call. No values are passed to the function. The function body should be written to generate a random number from 1-10 as its return value. Display with the call to function in main(): The function returned the value of <return value> when it was called in main.

  • Write a program named program51.py that defines a value-returning function named cuber that returns both the...

    Write a program named program51.py that defines a value-returning function named cuber that returns both the surface area and volume of a cube. A cube is a rectangular prism with all sides equal. Prompt the user to enter the cube's side length from the keyboard in the main function and then call the cuber function. Moving forward for all assignments and for this program, all other code would be in a main function, called at the very end of your...

  • c++ language Write a program that contains the following functions, i. A function isVowel that takes...

    c++ language Write a program that contains the following functions, i. A function isVowel that takes in a character and returns true if it is a vowel and false otherwise ii. A function that request from the user to enter in a sequence of characters, and outputs the number of vowels entered. (Use Function in a) to assist you, a sentinel value can be used to specify the end of the user input iii. A function that reads 3 test...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT