Answered step by step
Verified Expert Solution
Question
1 Approved Answer
IN C++ , make as simple as possible and put all code in main, dont do seperate functions out side of main. Lab #4-C-strings and
IN C++ , make as simple as possible and put all code in main, dont do seperate functions out side of main.
Lab #4-C-strings and string class. Exercise 1 (Progr. Proi: 8.1) (Use C-string to solve this problem.) Write a program that reads in a sentence of up to 100 characters and outputs the sentence with spacing corrected and with letters corrected for capitalization. In other words, in the output sentence, all strings of two or more blanks should be compressed to a single blank. The sentence should start with an uppercase letter but should contain no other uppercase letters. Do not worry about proper names; if their first letters are changed to lowercases, that is acceptable. Treat a line break as if it were a blank space, in the sense that a line break and any number of blank spaces are compressed to a single blank space. Assume that the sentence ends with a period and contains no other periods. For example, the input noW is thE TiMe for aLl gOOD MEN TO ComE TO tHe aId OF should produce the following output: Now is the time for all good men to come to the aid of the country Exercise 2 (Prog Proj 8.7) (Use the string class to solve the problem) Write a program that can be used to train the user to use less sexist language by suggesting alternative versions of sentences given by the user. The program will ask for a sentence, read the sentence into a string variable, and replace all occurrences of masculine pronouns with gender-neutral pronouns. For example, it will replace he" with she or he", and him" with "her or hinn". Thus, the input sentence See an adviser, talk to him, and listen to him. should produce the following suggested changed version of the sentence: Lab #4-C-strings and string class. Exercise 1 (Progr. Proi: 8.1) (Use C-string to solve this problem.) Write a program that reads in a sentence of up to 100 characters and outputs the sentence with spacing corrected and with letters corrected for capitalization. In other words, in the output sentence, all strings of two or more blanks should be compressed to a single blank. The sentence should start with an uppercase letter but should contain no other uppercase letters. Do not worry about proper names; if their first letters are changed to lowercases, that is acceptable. Treat a line break as if it were a blank space, in the sense that a line break and any number of blank spaces are compressed to a single blank space. Assume that the sentence ends with a period and contains no other periods. For example, the input noW is thE TiMe for aLl gOOD MEN TO ComE TO tHe aId OF should produce the following output: Now is the time for all good men to come to the aid of the country Exercise 2 (Prog Proj 8.7) (Use the string class to solve the problem) Write a program that can be used to train the user to use less sexist language by suggesting alternative versions of sentences given by the user. The program will ask for a sentence, read the sentence into a string variable, and replace all occurrences of masculine pronouns with gender-neutral pronouns. For example, it will replace he" with she or he", and him" with "her or hinn". Thus, the input sentence See an adviser, talk to him, and listen to him. should produce the following suggested changed version of the sentenceStep 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