Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 1PP

Solution to Programming Project 8.1

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 lowercase, that is acceptable. Treat a line break as if it were a blank, in the sense that a line break and any number of blanks are compressed to a single blank. Assume that the sentence ends with a period and contains no other periods. For example, the input

the Answer to life, the Universe, and everything IS 42.

should produce the following output:

The answer to life, the universe, and everything is 42.
Blurred answer
Students have asked these similar questions
DescriptionA researcher is analyzing DNA. A DNA can be represented as a string composed of the characters A, G, C, or T.One day, researchers found a strange DNA, which is Smooth Repeated DNA. The DNA is represented by a string that has infinite length. The string has a repeating pattern, i.e. the DNA string 0 is repeated an infinite number of times. For example, if0 = "????", then = "???????????? . . . ".According to researchers, a DNA is said to be special if it contains substrings . Determine whetheris a substring of . Squad FormatA line containing the two strings 0 and . Output FormatA line that determines whether it is a substring of . Issue “YES” ifis a substring of . Output “NO” otherwise. Example Input and Output Input Example Example Output AGCT GC YES AGCT TA YES AGCT GT No AGCT TAGCTAGCT YES AGGACCTA CTAA YES Explanation ExampleIn the first to fourth test case examples, is worth "???????????? . . . ". The part in bold is one of the…
PART 2:Write a program that accepts as input a sentence in which all the words are run together, but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string “StopAndSmellTheRoses.” would be converted to “Stop and smell the roses.” If the word is “I”, leave it as an uppercase I. Also check if the sentence ends with a “.”(period). If it does not, add a period at the end of the sentence.You should use a method to perform the editing to the sentence.Print the original sentence and the converted version. You may do this in the method or in the main program, having returned the new string.Repeat this for as many lines as there are in the input file. Use at least 8 lines of data. Have some with only one word. Have some words with only one letter(a), and at least one time the word I in the middle of the sentence. Some should end with a “.” and some…
Can you write a new code in C  language with the values ​​I sent you, just like this output? There are two files named group1.txt and group2.txt that contain course information and grades of each student for each class. I will calculate each course average for each group and show in simple bar graph. Use "*" and "#"characters for group1 and group2, respectively. I will see the number -999 at the end of each line in the input files. This value is used for line termination and you can use it to verify that you have arrived at the end of the line. The averages of each group should also be calculated and printed at the end of the file. Group 1: CSC 80 100 70 80 72 90 89 100 83 70 90 73 85 90 -999 ENG 80 90 80 94 90 74 78 63 83 80 90 -999 HIS 90 70 80 70 90 50 89 83 90 68 90 60 80 -999 MTH 74 80 75 89 90 73 90 82 74 90 84 100 90 79 -999 PHY 100 83 93 80 63 78 88 89 75 -999 Group 2: CSC 90 75 90 75 80 89 100 60 80 70 80 -999 ENG 80 80 70 68 70 78 80 90 90 76 -999 HIS 100 80 80 70 90 76 88 90…

Chapter 8 Solutions

Problem Solving with C++ (9th Edition)

Ch. 8.1 - What string will be output when this code is run?...Ch. 8.1 - Prob. 12STECh. 8.1 - Consider the following code (and assume it is...Ch. 8.1 - Consider the following code (and assume it is...Ch. 8.2 - Consider the following code (and assume that it is...Ch. 8.2 - Prob. 16STECh. 8.2 - Consider the following code: string s1, s2...Ch. 8.2 - What is the output produced by the following code?...Ch. 8.3 - Is the following program legal? If so, what is the...Ch. 8.3 - What is the difference between the size and the...Ch. 8 - Create a C-string variable that contains a name,...Ch. 8 - Prob. 2PCh. 8 - Write a program that inputs a first and last name,...Ch. 8 - Write a function named firstLast2 that takes as...Ch. 8 - Write a function named swapFrontBack that takes as...Ch. 8 - Prob. 6PCh. 8 - Write a program that inputs two string variables,...Ch. 8 - Solution to Programming Project 8.1 Write a...Ch. 8 - Write a program that will read in a line of text...Ch. 8 - Give the function definition for the function with...Ch. 8 - Write a program that reads a persons name in the...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that reads in a line of text and...Ch. 8 - Write a program that can be used to train the user...Ch. 8 - Write a sorting function that is similar to...Ch. 8 - Redo Programming Project 6 from Chapter 7, but...Ch. 8 - Redo Programming Project 5 from Chapter 7, but...Ch. 8 - Prob. 11PPCh. 8 - Write a program that inputs a time from the...Ch. 8 - Solution to Programming Project 8.14 Given the...Ch. 8 - Write a function that determines if two strings...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY