Question
HELP PLEASE Briefly describe the output of each small C++ program below. The output must be exact be especially careful regarding the type of data
HELP PLEASE
Briefly describe the output of each small C++ program below. The output must be exact be especially careful regarding the type of data returned. (is in an integer? Is it a floating point number?)
Note: pay close attention to (d) and (f).
(a) | int x = 3; int y = 4; int x = 4; cout << x;
| (b) | int x = 4; while (x < 5) x = x + 1; cout << x << endl;
|
(c) | int x = 3; double y = 3.0; if (x <= y) x = x + 2; cout << x << endl;
| (d) | int tc = 0; int tf = 0; tf = (9/5) * tc + 32; cout << tf << endl;
|
(e) | int x = 0; while (x < 6) { if ((x % 2) == 0) cout << "even: " << x << endl; else { cout << "odd: " << x << endl; } x = x + 1; } | ||
(f)
| int x = 1; int i = 0; while (x <= 4) { x = x * i; i = i + 1; cout << x << endl; }
| ||
(g)
|
double multiply1(int num1, int num2 = 1, int num3 = 0);
int main () { int number1 = 10; int number2 = 10; cout << multiply1(number1, number2) << endl;
return 0; }
double multiply1(int num1, int num2, int num3) { return num1*num2*num3; } |
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