Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The program contains a function prototype for the function named sentenceCapitalizer. The function receives a C- string as the parameter. The function does not have
The program contains a function prototype for the function named sentenceCapitalizer. The function receives a C- string as the parameter. The function does not have any value to return. The main function reads a string from the user and then displays the string as is. It then calls sentence Capitalizer to perform the function and prints the result afterwards. Your job is to write the function definition for sentenceCapitalizer In the function body, walk through the string one position at a time. For each character in the string, determine whether it is the first letter of a sentence and capitalize it accordingly. The sentences may be separated with no spaces or any number of spaces. Your algorithm should not assume that the first letter is always one space away from the previous end of a sentence marker. An end of sentence marker could be: a period (.), a question mark (?) or an escalation point(!). Test the program with this input (including the blanks at the beginning): no, not tonight. it's a very popular place and you have to make reservations in advance. besides, it's expe nsive, and I don't have any money. The output should look exactly as follows. The text before the modification: no, not tonight. it's a very popular place and you have to make reservatio ns in advance. besides, it's expensive, and I don't have any money. The text after the modification: No, not tonight. It's a very popular place and you have to make reservation s in advance. Besides, it's expensive, and I don't have any money. #include #include #include #include using namespace std; void sentenceCapitalizer(char *userString); int main() { const int MAX_SIZE = 1024; char userString[MAX_SIZE]; //get user string cin.getline (userString, MAX_SIZE); //print userString uncapitalized cout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started