MindTap - Cengage Learning - Microsoft Edge A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=710937855&snapshotld=1589550& >> CENGAGE MINDTAP Q Search this course Programming Exercise 6-2 Tasks main.cpp >_ Terminal 1 //Declare include-header files || (ch == 'a') || (ch =='e') || (ch == 'i') || (ch == 'o') || (ch == 'u')) { マー Successful output using isVowel 2 #include function 3 #include A-Z 0.00 out of 10.00 main.cpp:11:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] main.cpp:11:61: warning: comparison wit h string literal results in unspecified behavior [-Waddress] ) || (ch == 'I') || (ch == "0") || (ch == "U") || (ch == 'a') || (ch =='e') | | (ch == 'i') || (ch == 'o') || (ch 'u')) { 5 //Declare namespace statements 6 using namespace std; O out of 8 checks passed. Review the results below for more details. //Define the isVowel userdefined value-returning function 9. int isvowel(char ch) Checks 10 { if ((ch "0") || 'i') || (ch == 'o') 11 'A') || (ch "E") || (ch == 'I') || (ch == main.cpp:11:61: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] main.cpp:11:76: warning: comparison wit h string literal results in unspecified behavior [-Waddress] ) || (ch == "0") || (ch == "U") || (ch == 'a') || (ch =='e') || (ch == 'i') | | (ch == 'o') || (ch == 'u')) { Test Case • Incomplete (ch "U") || (ch == 'a') || (ch =='e') || (ch == Tests for isVowel output (E) || (ch 'u')) { 12 return true; Code Pattern • Incomplete 13 } banga Checks for isVowel use else 14 15 { Test Case ● Incomplete return false; 16 main.cpp:11:76: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] main.cpp: At global scope: main.cpp:19:1: еггог: ехреcted declaгat ion before '}' token 17 } Tests for isvowel output (a) 18 } 19 } Test Case • Incomplete <> 20 Tests for isvowel output (G) 21 int main() //Define the main function 22 { Test Case • Incomplete <> /bin/bash: line 4: ./a.out: No such fil е ог directoгу 23 //Define variables Tests for isvowel output (p) 24 char character; 25. Run Checks Submit 0% 9:24 PM P Type here to search My Questions | bart. MindTap - Cengag. ProgrammingExerc. 4/12/2020
Can someone help me to fix my user-defined, value-returning expression?
Here's the instructions to my C++
Instructions
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.
And here's what I have so far:
//Declare include-header files
#include <iostream>
#include <string.h>
//Declare namespace statements
using namespace std;
//Define the isVowel userdefined value-returning function
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() //Define the main function
{
//Define variables
char character;
//Testing the isVowel function.
//Prompt the user to input a consonant or a vowel.
cout << "Enter a character that is either a consonant or a vowel: ";
//read the inputted character
cin >> charcter;
endl;
//Output whether the character inputted a vowel or a consonant.If it's a vowel, the program outputs a "1." If the character is a consonant, the program will output a "0."
cout << character <<" is a vowel: " << isVowel(charcter);
return 0;
}
From what I get from my lab environment (as I suspected), I have a problem with my isVowel function. I could use help rewriting my user-defind function so my main program will produce the correct output. Thanks!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 5 images