Ask Question
7 February, 00:44

Your main function for phase I must look exactly like this:

int main ()

{

srand (time (0));

doOneSet ();

}

You must write the function doOneSet which will, for now, write out 5 addition problems. All of the numbers in your programs should be between 0 and 100. Here is the sample output for this phase:

45 + 21 =

0 + 100 =

54 + 23 =

4 + 19 =

8 + 92 =

The numbers that are produced for these problems must be generated randomly by the computer. The numbers in the sample output are given only as an example. We will discuss in the lessons how to generate random numbers.

+4
Answers (1)
  1. 7 February, 04:08
    0
    void doOneSet () {

    int number1, number2;

    for (int i = 0; i < 5; i++) {

    number1 = rand () % 101;

    number2 = rand () % 101;

    cout << number1 << " + " << number2 << " = " << endl;

    }

    }

    Explanation:

    Create a function called doOneSet that takes no parameter

    Declare two numbers that will be used as operands

    Create a for loop that iterates five times. Inside the loop, produce two random numbers between 0 and 100 in each iteration using rand (). Print the numbers with "+" between them in each iteration to get the required output.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Your main function for phase I must look exactly like this: int main () { srand (time (0)); doOneSet (); } You must write the function ...” 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