Question
Program 8 Create a program that accepts a paragraph from the user with a maximum length of 399 characters. Create at least four character arrays,
Program 8
Create a program that accepts a paragraph from the user with a maximum length of 399 characters. Create at least four character arrays, par with length 400, first_name with length 30, last_name with length 30, and author with length 100.
Create a function called menu with the following options:
C to clear all character arrays (all four arrays) by creating and calling a function named clean. (call clean on one array at a time).
N to enter the first and last name of the writer and store them in first_name and last_name respectively. If the user enters a name containing a non-alphabetic character (upper or lower case acceptable), then it should be rejected and the user re-prompted repeatedly until the condition is met.
F to call function form, this function will change the first letter in each name to upper case (if not upper case already) and the rest of the characters to lower case.
G to create the following string in author if user input first name is sAm and last name is RussSel:
Author name: Sam Russel
P to enter a new paragraph into the array. The paragraph should be entered in one statement using gets. ( test your code with a three sentence paragraph)
R to format the paragraph in the string so that the first letter of the paragraph and in each sentence is upper case, and each sentence is on one line.
S to display the contents of author and paragraph by using the puts function.
X to exit the program.
Note 1: All menu options should work for upper and lower case input.
Sample input/output:
Please enter first name: sAm
Please enter last name: RusSel
Please enter paragraph on one line: cats are nice animals. i love cats, they are cute.
Author: Sam Russel
Cats are nice animals.
I love cats, they are cute.
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