Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) What does the following program do? #include using namespace std; int mystery(int, int); int main() {int x = 22; int y =15; cout <
a) What does the following program do?
#include
using namespace std;
int mystery(int, int);
int main()
{int x = 22; int y =15;
cout << "The result is " << mystery (x, y) << endl;}
int mystery(int a, int b){// b must be positive
if (b <= 10) return a;
else return (a + mystery(a + 5, b - 3));}
1b) In c++ write a statement that will print a random letter from the set: A, B, D so that the frequency of D is 50% and for A, B the frequency is 25%. Attach output image.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started