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
alexgriva [62]
3 years ago
12

Write an algorithm that asks a user to enter a number between 1 and 10. (This range includes the numbers 1 and 10.) When they en

ter the number, check that it is actually between 1 and 10. If it is not, ask them to enter a number again. Continue to ask until they enter a valid number. Once their number is valid, output the number. (C++ form)
Computers and Technology
1 answer:
Nataliya [291]3 years ago
4 0

Answer:

do{

   cout<<"Introduce number \n"; //print the message

   cin>>num; //set the value of the number given

}while(num<1 || num>10); //repeat while the number is out of the range

cout<<"Number: "<<num; //print the number

Explanation:

The idea behind this code is to create a loop in which I can compare the number given  (between 1 and 10) and then print the number or get back and ask the number again.

#include <iostream>

using namespace std;

int main()

{

   int num; //create num variable

do

{

   cout<<"Introduce number \n"; //print the message

   cin>>num; //set the value of the number given

}while(num<1 || num>10); //repeat while the number is out of the range

cout<<"Number: "<<num; //print the number

}

You might be interested in
Which of these is NOT an input device?
OLEGan [10]
Blinking light is not one of the awansers
6 0
2 years ago
Any malware software that covertly gathers user information without the user s knowledge, is known as ______ .
shusha [124]
It be known as spyware
3 0
3 years ago
The item in this illustration that is highlighted is _____.
Svetlanka [38]

Answer:the title bar

Explanation:

3 0
3 years ago
Read 2 more answers
Good keyboarding technique includes ________
Svetlanka [38]

Answer:

Keeping you hands on the homerow keys

Explanation:

3 0
2 years ago
Read 2 more answers
Which of the following is among the ComScore Ad Metrix Reports?
IceJOKER [234]
I think it is d but not exactly sure
6 0
2 years ago
Other questions:
  • If you want to boot from a hard drive what must it have
    6·1 answer
  • If you have a charger that’s not from Apple, then could that damaged your iPhone or not?
    5·1 answer
  • How neural networks impact our life??
    7·1 answer
  • Differentiate between the broadcasting and telecommunication
    5·1 answer
  • The analogy of a computer system is often used to illustrate the different parts of memory. The keyboard is where we encode new
    8·1 answer
  • If Laura wanted to solve a problem using recursion where the last statement executed is the call to the same method, what type o
    8·1 answer
  • Please Answer ASAP!!
    15·1 answer
  • Functions are used to _________
    10·1 answer
  • Array bounds checking should be directly coded into a system rather than assumed.
    12·1 answer
  • Rewrite the code below so that a transformation moves the div 100px to the right and 50px upward.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!