Ask Question
10 January, 03:15

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 enter 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)

+2
Answers (1)
  1. 10 January, 06:09
    0
    do{

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

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

    }while (num10); / /repeat while the number is out of the range

    cout<<"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

    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 (num10); / /repeat while the number is out of the range

    cout<<"Number: "<
    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “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 enter the ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers