Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the remaining questions, use this Problem Description. You are asked to examine an arbitrary C++ string, and generate a list of characters and their

For the remaining questions, use this Problem Description. You are asked to examine an arbitrary C++ string, and generate a list of characters and their occurrences, in ASCII order, from that string.

Example:

For an input string of "P C C?", we can see the repeated characters are ' ', 'C', 'P' and '?' with an empty space occurring 2 times, 'C' occurring 2 times, 'P' occurring 1 time, and '?' occurring 1 time. In ASCII order we have the following, with their count:

: 2 C: 2 P: 1 ?: 1

Question 34

Based on the Problem Description, the input may be the combination of any one of the 128 characters in the ASCII table (Links to an external site.)Links to an external site.. Write a STATEMENT (not the entire program) to create/instantiate an array of 128 characters called arr.

HTML EditorKeyboard Shortcuts

12pt

Paragraph

0 words

Question 35

Based on the Problem Description, we need to keep the character count for every one of the 128 possible characters. Which of the following statements illustrates the use of arr (array created from the last problem) to increment the ASCII_CHARACTER count by 1? ASCII_CHARACTER can be any one of the first 128 characters in the ASCII Table (Links to an external site.)Links to an external site. (not the Extended ASCII Table).

arr[ASCII_CHARACTER-97]++;

arr[ASCII_CHARACTER] = ASCII_CHARACTER++;

arr[ASCII_CHARACTER]++;

arr[ASCII_CHARACTER-65]++;

None of the choices.

Question 36

Based on the Problem Description and the previous questions, write a short code snippet (not the entire problem) to generate a dictionary of letter occurrences. Namely, print a list of input characters and their occurrences from an arbitrary C++ string, str. You may use cout() to print them to the console. Cut and paste your code snippet into the text box.

Input:

string str = "P C c?";

Output:

Your output is a character list in the ascending ASCII order (namely space ' ' appearing before '?', which appears before 'C' , which appears before 'P'. Finally, the lower case 'c' appears last):

: 2 ?: 1 C: 1 P: 1 c: 1

Constraints/Assumptions:

Your code should work with any characters in ASCII (i.e., the first 128 characters in the table http://www.asciitable.com (Links to an external site.)Links to an external site.).

The character must be printed in ascending ASCII order, separated by line break as seen above.

Only print characters from the input string.

Rubric:

(2 points) Correct ASCII order (ascending) separated by line break.

(5 points) Correct letter occurrences.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

Consider this article:...

Answered: 1 week ago

Question

Question Can life insurance be used in a Keogh (HR 10) plan?

Answered: 1 week ago