Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program to read strings from the user until the program reads the END string. For each string, use the C program to

Write a C program to read strings from the user until the program reads the END string. For each string, use the C program to change the lowercase letters (a to z) to upper case letters (A to Z) and change the uppercase letters to lowercase letters. The program should output the changed strings to the screen.

Hint: (i) You can use fgets() to read a string. After read the string, you can use strcmp(str, END ) to judge whether the input string is END, where is the new line character read by the fgets() function. (ii) For a lowercase character ch, use ch - 32 to get its uppercase letter. For a uppercase letter ch, use ch + 32 to get its lowercase letter. (iii) You can assume that the maximum length of the input string is 1024. (iv) You can use a for loop from 0 to strlen(string) to iterate all the characters in the string. (v) For a character ch, you can use a

A sample run of the program is shown below (the blue font indicates the input of the program).

image text in transcribed

Please upload your source code file as the attachment and provide three groups of sample runs of your program.

Please enter a string:Hello, NUAA! The changed string is Saaun ,OLLEN Please enter a string:Homework The changed string is HOMEWORK Please enter a string:END Bye

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions