Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rewrite the following code replacing the else-if construct with a switch statement. Make sure you test your code. *Apply the requested changes to this code

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Rewrite the following code replacing the else-if construct with a switch statement. Make sure you test your code. *Apply the requested changes to this code and'* * turn it in. #include int main(void) char ch; int countA0 int count = 0; int countI 0 printf ("Enter in a letter A, E, or I. "); scanf(" %c", &ch); //Replace the following block with your switch countE++ else if (ch 'A' ch 'a') countAtt; else if (ch 'I' ch 'i') countI+ else print f ("Error, %c is not an A, E r I. ", ch); //end of your switch return 0 //end main Modify the supplied source code. Add a function with the correct declaration and definition. The function should take the user input and perform the following: If the supplied integer is 10, print the square of the integer, if the integer is 9, divide by 3 and print the result, if the integer is 2 or 3, multiply the integer by 9 and print it out. You should implement this using a nested if statement and not a switch or else-if statement. Add vour function to thiscode and test it #include //function declaration int main (void) int anInt = 10; //call 1 anInt = 9; //call 2 anInt = 2; //call3 //call4 return 0; //end main //Function definition Modify the supplied source code. Add a function with the correct declaration and defnition. The function should take the user input and perform the following: Given an integer between 1 and 12 use a switch statement to determine the month of the year. January would be month 1. Your switch statement should print the correct month. Your function return is void. Insert your function calls to the provided code. Make sure you test your code Add the function t determine the month of the year from the integer 1 - 12 #include //function declaration int main (void) int mnthllbr = 0; do t printf ("Enter in the number of the month from 1 to 12.1n") while (mnthNbr > 12 mnthNbr

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago