1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
yawa3891 [41]
3 years ago
12

Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less

than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is:
Enter a number (<100):
Enter a number (<100):
Enter a number (<100):
Your number < 100 is: 25
c++

#include
using namespace std;

int main() {
int userInput = 0;

do
cout << "Your number < 100 is: " << userInput << endl;

return 0;
}
Engineering
1 answer:
chubhunter [2.5K]3 years ago
8 0

Answer:

#include <iostream>//including iostream library to use functions such as cout and cin

using namespace std;

int main() {

int userInput = 0;

do

{

 cout << "Enter a number < 100: " ;

 cin >> userInput;

 if (userInput < 100)//condition if number is less than 100

 {

  cout << "Your number < 100 is: " << userInput << endl;

 }

} while (userInput > 100);//do while loop condition

return 0;

}

Explanation:

A do-while loop executes regardless in the first iteration. Once it has run through the first iteration, it checks if the condition is being met. If, the condition is TRUE, the loop begins the second iteration. If FALSE, the loop exits. In this case, the condition is the userInput. after the first iteration, lets say the userInput is 120, the condition userInput > 100 is true.Therefore, the loop will run again until eventually the number is less than hundred, lets say 25. In that case the condition would be 25 > 100, which would be false, so the loops will break.

You might be interested in
Based on these statements:
Evgen [1.6K]

Answer:

the third statement is true

Explanation:

given data

Lenovos cost more than Dells

Lenovos cost less than Apples

solution

we have given 1st statement that is express as

cost (Lenovo) > cost (Dell)     ..................1

and

2nd statement that is express as

cost (Lenovo) < cost (Apple)

so we can say it as

cost (Apple) > cost (Lenovo)       ......................2

and

now above Both equation 1 and 2 can be written as

cost (Apple) > cost (Lenovo) > cost (Dell)      .........................3

so we can say cost of Apples is more than the cost of Lenovos and the cost of Dells

so as that given 3rd statement is true

7 0
3 years ago
If OSHA determines that an employer's response to a non-formal complaint is adequate, what options does the employee filing the
Anuta_ua [19.1K]
Fill it out without telling ur employer as that may cause backlash and have an osha certified employee come check out ur work or job site
4 0
3 years ago
How do you take a picture
Mrrafil [7]
to take a picture just choose “take photo” on the button next to the keypad, if you are on a computer it’s the same thing if your computer has a video screener or whatever they call it but if not I’m not sure, hope this helps!
7 0
3 years ago
Read 2 more answers
Add a capacitor, C2 = 6 pF, in parallel with R3, and a capacitor, C3 = 2 pF in parallel with R4. Use PSpice to plot the magnitud
Ganezh [65]
Tell me why i got this question got it right and now won’t remember but i’ll get back at you when i remember
6 0
3 years ago
Which of the following lists the steps of a process in the correct order?
Vladimir79 [104]

Answer: C. Problem identification, solution design, implementation, evaluation.

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • -1 1/6 divided by 2 1/3
    10·1 answer
  • An electronic device dissipating 25 W has a mass of 20 g and a specific heat of 850 J/kg·0K. The device is lightly used, and it
    9·1 answer
  • What's the third pedal for in a vehicle​
    12·1 answer
  • Two streams of air enter a control volume: stream 1 enters at a rate of 0.05 kg / s at 300 kPa and 380 K, while stream 2 enters
    13·1 answer
  • How to identify this fossil
    9·1 answer
  • 1. On a 2001 Honda Civic, while replacing fuel injectors, what do you coat the new O-rings with?
    9·1 answer
  • A homeowner consumes 260 kWh of energy in July when the family is on vacation most of the time. Determine the average cost per k
    7·1 answer
  • Air enters a turbine with a stagnation pressure of 900 kPa and a stagnation temperature of 658K, and it is expanded to a stagnat
    9·1 answer
  • 3.8 LAB - Select lesson schedule with multiple joins
    11·1 answer
  • 6. During some actual expansion and compression processes in piston–cylinder devices, the gases have been
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!