Question: C++ exercise Specifications Complete the function practiceCharMethod4 function. You will need to verify if the character passed as an argument is equal to 'a', 'b',

C++ exercise Specifications

Complete the function practiceCharMethod4 function.

You will need to verify if the character passed as an argument is equal to 'a', 'b', or 'c', and if so, print "first three letters".

It must be CASE INSENSITIVE, so if 'A', 'B' or 'C' is given, it must also print "first three letters".

If it isn't, then you must print "none".

Study the sample test cases provided for more insights. See main function below.

For example:

Test Result
practiceCharMethod4('a');
first three letters 
practiceCharMethod4('B');
first three letters 

#include using namespace std;

void practiceCharMethod1(char c); void practiceCharMethod2(char c); void practiceCharMethod3(char c); void practiceCharMethod4(char c);

int main() { practiceCharMethod1('f'); // Test with different characters practiceCharMethod2('%'); // Test with different characters practiceCharMethod3('L'); // Test with different characters practiceCharMethod4('a'); // Test with different characters return 0; }

void practiceCharMethod4(char character) { // YOUR CODE HERE if (isupper(character)) character = tolower(character); if character == ('a') == character == ('b') == character == ('c')) cout << "first three letters"<< endl;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!