Procedure 3. Write a program with the switch statement. Use function getchar() to ask the user to enter a character and assign it to a variable number1. Check to see if the character is 'r', 'R’, 'n’, 'N’, 'z'. or Z. • If it is 'n' or 'N': Ask the user to input an integer number and assign it to a variable called number1. 1. 2. Print out your name on the screen. • If it is 'r' or 'R': ask the user to input two float number and then: 1. Print the square root of each number (please use sqrt function in the math.h library). 2. Print the sum of the squared root numbers. • If it is 'z' or 'Z': 1. ask the user to input a character with getchar () function. 2. Print the ASCII code of the character on the screen. If the input is none of these options, print the message "Goodbye".
Procedure 3. Write a program with the switch statement. Use function getchar() to ask the user to enter a character and assign it to a variable number1. Check to see if the character is 'r', 'R’, 'n’, 'N’, 'z'. or Z. • If it is 'n' or 'N': Ask the user to input an integer number and assign it to a variable called number1. 1. 2. Print out your name on the screen. • If it is 'r' or 'R': ask the user to input two float number and then: 1. Print the square root of each number (please use sqrt function in the math.h library). 2. Print the sum of the squared root numbers. • If it is 'z' or 'Z': 1. ask the user to input a character with getchar () function. 2. Print the ASCII code of the character on the screen. If the input is none of these options, print the message "Goodbye".
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter9: Completing The Basics
Section9.5: Input Data Validation
Problem 8E
Related questions
Question
100%
c not c++

Transcribed Image Text:Procedure 3. Write a program with the switch statement.
Use function getchar() to ask the user to enter a character and assign it to a variable
number1. Check to see if the character is 'r', 'R’, 'n’, 'N’, 'z'. or Z.
• If it is 'n' or 'N':
1. Ask the user to input an integer number and assign it to a variable called number1.
2. Print out your name on the screen.
• If it is 'r' or 'R': ask the user to input two float number and then:
1. Print the square root of each number (please use sqrt function in the math.h library).
2. Print the sum of the squared root numbers.
• If it is 'z' or 'Z':
1. ask the user to input a character with getchar() function.
2. Print the ASCII code of the character on the screen.
• If the input is none of these options, print the message "Goodbye".
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT