Question: 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).

Write a C program to read strings from the user until the

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!