subject

Here is the starting code for your assignment. As you can see, so far there is a function to create two random numbers between 1 and 25 and a function to add them together. Your assignment is to create three more functions, add the prototypes correctly, call them from main correctly and output the results. The three functions should be subtractNumbers, multiplyNumbers, and divideNumbers. Remember that division won't always yield an integer so be sure to take care of that issue within the function (don't change the variable declarations). Don't change the code that I've given you.
Follow the same pattern.
Don't use tools that we haven't studied.
// This program adds, subtracts, multiplies, and divides two random numbers
#include
#include // For rand and srand
#include // For the time function
using namespace std;
// Function declarations
int chooseNumber();
int addNumbers(int, int);
const int MIN_VALUE = 1; // Minimum value
const int MAX_VALUE = 25; // Maximum value
unsigned seed = time(0);
int main()
{
// Seed the random number generator.
srand(seed);
int firstNumber = chooseNumber();
int secondNumber = chooseNumber();
int sum = addNumbers(firstNumber, secondNumber);
cout << "The first number is " << firstNumber << endl;
cout << "The second number is " << secondNumber << endl;
cout << "The sum is " << sum;
return 0;
}
int chooseNumber()
{
// Variable
int number; // To hold the value of the number
number = (rand() % (MAX_VALUE - MIN_VALUE + 1)) + MIN_VALUE;
return number;
}
int addNumbers (int number1, int number2)
{
int number = number1 +number2;
return number;
}
Notice that number is used as a variable in more than one function. This works because number is a variable.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:30
What is the penalty for violating section 1201 of title 17 chapter 21 of the us code
Answers: 1
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Visualizing a game of “tag” to remember the meaning of contagious
Answers: 3
question
Computers and Technology, 24.06.2019 00:30
Setting up a home network using wireless connections is creating a a. vpn b. lan c. wan d. mini-internet
Answers: 2
You know the right answer?
Here is the starting code for your assignment. As you can see, so far there is a function to create...
Questions
Questions on the website: 13722360