Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

C Language Problem: Write a program that reads input as a stream of characters until encountering EOF. Have it report the number of uppercase letters,

C Language Problem: "Write a program that reads input as a stream of characters until encountering EOF. Have it report the number of uppercase letters, the number of lower case letters, and the number of other characters in the input. You may assume that the numeric values for the lowercase letters are sequential and assume the same for uppercase. Or, more portably, you can use appropriate classification functions from the ctype.h library.

I enclose both my main driver and my program "chartype". When I run only chartype, the program runs correctly. I have to use Ctrl+D (on my Mac) to stop running the program. However, when I linked my program "chartype" to my main driver, the program kept running. It did not terminate and it did not display the result on the screen. There is something wrong in my linking. Both programs were just fine. I need your help figuring out how to display the result correctly. Note: I think we have to use Ctrl + Z for windows and Ctrl+D for Mac.

image text in transcribed

image text in transcribed

#include #include #include //header file for input/output int menu (void); //prototype definition /*Place the function prototypes for your programs here! */ void count_ch(void); void chartype (void); void betterguess (void); int main(void) int selection = menu(); //variable declaration and initialization via call to menu() //The line above also serves as the 'priming' read for the following while loop while(selection99) // The switch statement is similar to a chained if-else except conditions fall through in C switch (selection) case 1: count_ch); break; case 2: chartype(); break; case 3: betterguess) break; case 4: break; default: / Optional-but a good idea expecially if you have no other error catching! */ printf("Please enter a valid selection. "); selectionmenu)// get the next menu selection, otherwise, you have an eternal loop! return 0 int menu (void) int choice; printf("n") printf(" 1. Character count In") printf(" 2. Character type " printf(" 3. Better Guess ") printf(" 4. In") printf("99. Exit "); printf("Please select number and press enter:In") printf("n") scanf("%d", &choice); return choice

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions