Question
I need help to answer these questions on this program that I created. 1 Insert cout statements when the max() function is entered. 2 cout
I need help to answer these questions on this program that I created.
1 Insert cout statements when the max() function is entered. 2 cout << " (testing) max() called, arguments: num1 = " << num1 << " and num2 = " << num2 << endl; 3 Does it make sense? 4 Elements to be recognized part of a very simple C++ program. 5 Could we recognize a number in the sting A = +1260; an integer number? What is the algorithm? If YES, can we find the value in binary?
########################################################
#include
using namespace std;
//returns the max of two passed arguments int max(int, int);
//returns the max of three passed arguments int max3(int, int, int);
int main() { int i = 5; int j = 2;
int k = max(i, j);
cout << " the max, etc, is " << k << endl;
cout << " max(5, max (2, 5)) is " << max(5, max(2, 5)) << endl;
cout << " max3(-5, 2, 10) is " << max3(-5, 2, 10) << endl;
cout << " End of program" << endl;
system("DATE /T"); system("PAUSE"); return 0; }
int max(int num1, int num2) { int result; if (num1 >= num2) result = num1; else result = num2; return result; }
int max3(int x, int y, int z) {
return max(x, max(y, z));
}
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