Question
Consider the following program: #include using namespace std; int f ( int a, int &b, char &c) { 1. int result; 2. if (c ==
Consider the following program:
#include
using namespace std;
int f ( int a, int &b, char &c) {
1. int result;
2. if (c == a) {
3. a = a+(++b);
4. result = b;
5. } else if (c == s) {
6. b = b*(a++);
7. result = a - b;
8. } else {
- c = ?;
- result = --b;
11. }
12. return result;
}
void main() {
13. int x = 2, y = 4, z;
14. char ca = a;
15. z = f(x, y, ca);
16. cout << x = << x, y = << y << z = << z << ca = << ca << endl;
17 ca = s;
18. {
19. int x=3, z = -2;
20. x = calc (z, y, ca);
21. cout << x = << x, y = << y << z = << z << ca = < 22. } 23. cout << x = << x, y = << y << z = << z << ca = << ca << endl; 24. ca = a; 25. z = calc(x, y, ca); 26. cout << x = << x, y = << y << z = << z << ca = << ca << endl; 27. ca = d; 28. x = calc (x, z, ca); 29. cout << x = << x, y = << y << z = << z << ca = << ca << endl; }
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