Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with these C++ programs: Part 2: What is output by the following? Assume the necessary header files are included. 1. void f1(void); void

Need help with these C++ programs:

Part 2:

What is output by the following? Assume the necessary header files are included.

1. void f1(void);

void f2(void);

void main(void) {

cout << 'A';

f1();

f2();

}

void f1(void) {

f2();

cout << 'B';

}

void f2(void) {

cout << 'C';

}

2. void f1(int);

void f2(int, int);

void main(void) {

int x=5, y=2;

f1(x+y);

cout << endl << x << "+" << y << "=";

f2(x, y);

cout << endl;

}

void f1(int a) {

cout << a + 3 << " = ";

f2(a, 3);

}

void f2(int b, int c) {

cout << b + c;

}

3. int f1(int, int);

bool f2(int, int);

void main(void) {

int x=5, y=2;

cout << f1(x, y) << endl;

if(f2(5, x))

cout << "<=";

else

cout << ">";

}

int f1(int a, int b) {

return a + b;

}

bool f2(int b, int c) {

if(b < c)

return true;

else if (b > c)

return false;

return true;

}

4. int f1(int, int);

void main(void) {

int x=2, y=3;

cout << f1(x, y);

}

int f1(int a, int b) {

int i, j, cnt=0;

for(i=1; i<=a; i++) {

for(j=1; j<=b; j++) {

cout << "*";

cnt++;

}

cout << endl;

}

return cnt;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899