Write a function that prompts the user to input a sentence. Then checks the sentence to make sure the following rules have been followed: • the entire first word of the sentence should be capitalized • the sentence ends-with a punctuation mark (any) If the sentence meets these requirements, print and return the string RULES CONFIRMED (exactly as shown). If the sentence does NOT meet the requirements, the function should fix the sentence such that it will pass the rules, print the type of error(s) and then return the fixed sentence. Examples Examples of function being called fixer ("THIS is a test?") Example of function output RULES CONFIRMED ERROR: First word is not translate ("this is capitalized a test") ERROR: Missing ending punctuation mark translate ("THIS is ERROR: Missing ending a test") punctuation mark translate ("This is First word is not a test!") capitalized Example of string returned by function RULES CONFIRMED THIS is a test. THIS is a test! THIS is a test!

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 23PE
icon
Related questions
Question
Write a function that prompts the user to input a sentence. Then checks the sentence to make sure the
following rules have been followed:
• the entire first word of the sentence should be capitalized
• the sentence ends with a punctuation mark (any)
If the sentence meets these requirements, print and return the string RULES CONFIRMED (exactly as
shown).
If the sentence does NOT meet the requirements, the function should fix the sentence such that it will
pass the rules, print the type of error(s) and then return the fixed sentence.
Examples
Examples of function
being called
fixer ("THIS is a
test?")
Example of function output
RULES CONFIRMED
ERROR: First word is not
translate ("this is capitalized
a test")
ERROR: Missing ending
punctuation mark
translate ("THIS is ERROR: Missing ending
a test")
punctuation mark
translate ("This is First word is not
a test!")
capitalized
Example of string returned by
function
RULES CONFIRMED
THIS is a test.
THIS is a test!
THIS is a test!
Transcribed Image Text:Write a function that prompts the user to input a sentence. Then checks the sentence to make sure the following rules have been followed: • the entire first word of the sentence should be capitalized • the sentence ends with a punctuation mark (any) If the sentence meets these requirements, print and return the string RULES CONFIRMED (exactly as shown). If the sentence does NOT meet the requirements, the function should fix the sentence such that it will pass the rules, print the type of error(s) and then return the fixed sentence. Examples Examples of function being called fixer ("THIS is a test?") Example of function output RULES CONFIRMED ERROR: First word is not translate ("this is capitalized a test") ERROR: Missing ending punctuation mark translate ("THIS is ERROR: Missing ending a test") punctuation mark translate ("This is First word is not a test!") capitalized Example of string returned by function RULES CONFIRMED THIS is a test. THIS is a test! THIS is a test!
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT