Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WHAT TO PROGRAM: Write a C program that will read data front standard input one character at a time and output the results to standard

WHAT TO PROGRAM:

Write a C program that will read data front standard input one character at a time and output the results to standard output. Roughly your program should mostly copy the input stream to the output stream, but it should delete all numbers [the characters 0 through 9change the case of alphabetic characters, print two spaces every time you encounter a space, and if you have multiple empty lines in a row, print just one empty line avoid printing the rest.

Specifically, for each character you read, do one of the following 4 things:

1) delete all digits (the characters 0, 1, 2 , , 9); that is, read it in, but then don't print it if was a digit.

2) Interchange the case of the alphabetic letters; that is, if you encounter an 'A' , print out an 'a' instead, 'B' becomes 'b', etc. -- and likewise, 'a' becomes 'A', ' z' becomes Z.

3) Every time a space character is encountered (ASCII code 32) , print two spaces instead of just the one.

4) When you find consecutive empty lines, print just one empty line. For simplicity, we will distinguish between #blankf 'empty" means "no characters except for a newline" -- a line consisting of and 'empty three tabs *looks* blank, but it contains 3 characters, so it will not be considered empty. Essentially, this rule simply means "if you see a bunch of CONSECUTIVE newlines, print just one newline. 5) All other characters not mentioned above (such as tabs, +, control, characters, or whatever) are simply printed verbatim.

Your main program should return a value when it finishes. Return one (1) if the output was unchanged from the input that was read in, and return zero (0) if you made at least one change (either by removing digits, deleting empty lines, doubling spaces, or changing case).

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions