Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Program: Functions Write a C++ function that will check if a character is a

ID: 3780072 • Letter: C

Question

C++ Program: Functions

Write a C++ function that will check if a character is a capital letter. You have the following steps:

main: prompt the user for a character and then enter the character

main: enter the character

main: call function your function sending the character to the function

yourfunname: test the character and return Boolean true if the character is a capital letter and false otherwise

main: display the Boolean value returned from the function

Note for the input of the function a character is sent to the function and a Boolean value is returned from the function.

Explanation / Answer

#include <iostream>
using namespace std;
bool check_caps(char ch)
{
   return ch >= 'A' && ch <= 'Z';
}
int main()
{
   char ch;
   cout<<"Please enter a character:";
   cin>>ch;
   cout<<check_caps(ch)<<endl;
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote