Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 ASCII Neighbors ( 5 0 points ) Write a program that reads from standard input a sequence of whitespace - separated 'words'. The program

3 ASCII Neighbors (50 points)
Write a program that reads from standard input a sequence of whitespace-separated 'words'. The program should output each word on its own line, but only including the characters that
are equal or adjacent in the ASCII table. For example, the character 'i' has an ASCII value of 105, and it should be included in the output only if it is next to an h(104), an i (105), or a j
(106). In your solution, you must use a void function named FilterNeighbors, that takes in
a string, and filters it based on the problem specification.
Example Input:
ahidkkrtsraaav
Expected Output:
hikktsraaa
The first 'a' isn't in the output because its only neighbor (h) is not adjacent to it in the ASCII
table. The 'h' and the 'i' are adjacent in the table so they are outputted. The 'k's are equal to
each other, so they are also outputted. And so on.
Example Input:
23321 gbsyfbjlbsadfoebw ./-$$!&%aAJ
{|}:(:::)=k?
Expected Output:
23321
.??$$2%
{|}
(The blank line in the Expected Output is the correct output for the second string of letters. Since no letters that border each other are the same nor the predecessor and successor, there is no group of letters that can be outputted, hence why it is blank.)
Remember that there are lots of characters in ASCII beyond just letters. The "gbsyfbjlbsad-foebw" word contains to letters that are adjacent in the word and in the table, so its line is empty.
When writing your program, you may only use concepts you have learned in the course as far. Your program should compile and run.
The formatting must match exactly as shown in the example above, including whitespaces.
This is a C++ programming language assignment Thank you
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

=+What can I do to make this press worthy?

Answered: 1 week ago