Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that converts uppercase ASCII letters to lowercase ASCII letters while not making any modification to any other ASCII values. The input to

Write a program that converts uppercase ASCII letters to lowercase ASCII letters while not making any modification to any other ASCII values. The input to the program will be a number of lines, each of which contain a string, which may contain spaces, punctuation, numbers and alphabetic characters. Your program should

1. scan the string, character by character, using getchar(),

2. if the character is an uppercase alphabetic character, convert it to lowercase,

3. if the character is a lowercase alphabetic character, convert it to uppercase,

4. if the character is not an alphabetic character no conversion is necessary,

5. output the string character by character, using putchar(). You will know to stop the program when getchar() returns EOF.

Suppose the following example input: I grew up in Chicago, Illinois. Brandon received his B.S. from The Ohio State University. Mr. Brown went to Hawaii for Spring Break. Lunch break is from 11:45 am to 1:00 pm.

The output would be: i GREW UP IN cHICAGO, iLLINOIS. bRANDON RECEIVED HIS b.s. FROM tHE oHIO sTATE uNIVERSITY. mR. bROWN WENT TO hAWAII FOR sPRING bREAK. lUNCH BREAK IS FROM 11:45 AM TO 1:00 PM.

Your program can use either if statements or switch statements for much of the algorithm. You CANNOT use C library functions such as isalpha() or isdigit(), which we will see later. Run gdb on your lap1p2 executable. Enter a description in to your LAB1README file that describes the iterative result (i.e. each of the interim results) of getchar loop that reads in one of your strings and describe your results.

CONSTRAINTS:

-You cannot use arrays of any kind (including strings).

-You CANNOT use C library functions other than getchar() and putchar().

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions