Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program valid.cpp, which asks the user to input an integer in the range 0 < n < 100 . If the number is

Write a program valid.cpp, which asks the user to input an integer in the range 0 < n < 100. If the number is out of range, the program should keep asking to re-enter until a valid number is input.

After a valid value is obtained, print this number n squared.

Example

$ ./valid Please enter an integer: -10 Please re-enter: 1200 Please re-enter: 100 Please re-enter: 7 Number squared is 49 

Hint: You can use a while or do ... while loop.

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Why is desire important for success? (p. 271)

Answered: 1 week ago

Question

2.3 Define human resource ethics.

Answered: 1 week ago

Question

9 How can training be evaluated?

Answered: 1 week ago