1. Create a function called IsLarger that takes in two variables: e Outputs a 1
ID: 3755533 • Letter: 1
Question
1. Create a function called IsLarger that takes in two variables: e Outputs a 1 if the first number is larger Outputs a 0 if the second number is larger 2. Two six-sided dice are rolled. Adding the two dice together results in values ranging 2 to 12. Create a function called DiceProb The input of this function will range from 2 to 12 . The output will calculate the probability of a two six sided dice * Check your answer against the following table http://alumnus.caltech.edu/~leif/FRP/probability.htr hint: remember that probability (true outcomes)/(total tries) 3. Create a function called ManyDice. o This function can have one to n number of six-sided dice.Explanation / Answer
//------IsLarger------//
#include <iostream>
using namespace std;
// function declaration
int isLarger(int num1, int num2);
int main () {
// local variable declaration:
int a ;
int b ;
int ret;
cout<<"PLease enter 1st Number:";
cin>>a;
cout<<"PLease enter 2nd number:";
cin>>b;
// calling a function to get max value.
ret = isLarger(a, b);
cout << "---" << ret<< "---" << endl;
return 0;
}
// function returning the max between two numbers
int isLarger(int num1, int num2) {
// local variable declaration
int result;
if (num1 > num2)
result = 1;
else
result = 0;
return result;
}
Please comment if any clarification required or any changes required.
AS per chegg rules we can only 1 question. Please post other questions as new post. Thanks
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.