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 2PP

Write a program that will read in a line of text and output the number of words in the line and the number of occurrences of each letter. Define a word to be any string of letters that is delimited at each end by either whitespace, a period, a comma, or the beginning or end of the line. You can assume that the input consists entirely of letters, whitespace, commas, and periods. When outputting the number of letters that occur in a line, be sure to count upper- and lowercase versions of a letter as the same letter. Output the letters in alphabetical order and list only those letters that do occur in the input line. For example, the input line

I say Hi.

should produce output similar to the following:

3 words

1 a

1 h

2 i

1 s

1 y

Blurred answer
Students have asked these similar questions
Write a program that reads the contents of two sentences and compares them in the following ways: (e.g. first sentence: We are Python programmers from Computer Science Department of xyz College. Second sentence: We learned Python programming knowledge and skills from Python class at Computer Science Department of xyz college).• It should display a list of all the unique words contained in both sentences.• It should display a list of the words that appear in both sentences.• It should display a list of the words that appear in the first sentence but not the second.• It should display a list of the words that appear in the second sentence but not the first.• It should display a list of the words that appear in either the first or second sentence but not both.Hint: Use set operations to perform these analyses.
The internet enables people to network, join a cause, take a poll, etc. Your program will prompt the user for a description of a poll to be taken and then prompt 5 users for a response of 1-10 (1 being a 'poor' response; 10 being the 'best' response).Your program does not have to validate that the user entered 1-10. We'll do that type of checking later.Your program must use a string data type to store the poll description and a Python list data type to save the integer responses of the 5 user responses.Your output should list all the responses stored in the list, the highest given response, the lowest given response and the average of the 5 responses. See sample input and utput below.Review powerpoint 3, slide 21 for an example if you need one. Sample interactive run of your program: Give a simple description of the poll to be takenRate your understanding of the first 3 zyBook chaptersEnter a 1-103Enter a 1-1010Enter a 1-104Enter a 1-102Enter a 1-105Sample outputRate your understanding…
A program has a string variable fullName that stores a first name, followed by a space, followed by a last name. There are no spaces in either the first or last names. Here are some examples of fullName values: "Anthony Coppola", "Jimmy Carroll", and "Tom DeWire". Consider this code segment that extracts the last name from a fullName variable, and stores it in last Name with no surrounding blanks: int k = fullName.indexOf(" "); //find index of blank String lastName = /* expression */ Which is a correct replacement for /* expression */? II fullName.substring(k + 1); III fullName.substring(k + 1, fullName.length());

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
Computer Programming for Beginners | Functions, Parameters & Arguments | Ep24; Author: Programming With Avelx;https://www.youtube.com/watch?v=VXlh-qJpfw0;License: Standard YouTube License, CC-BY