Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Question 1 Consider the following program: #include iostream using namespace std; int addition(int, int); int subtraction(int, int); void directions(); void printResult(int, int, int, char);

c++

Question 1

Consider the following program:

#include iostream

using namespace std;

int addition(int, int);

int subtraction(int, int);

void directions();

void printResult(int, int, int, char);

int main ()

{

int x,y,r;

directions();

cout << "Please enter the first integer: "<<;

cin >> x;

cout << "Please enter the second integer: ";

cin >> y;

r = addition(x,y);

printResult(x,y,r,+);

r = subtraction(x,y);

printResult(x,y,r,-);

system("pause");

return 0;

}

int addition(int a, int b)

{

int r;

r=a+b;

return r;

}

int subtraction(int a, int b)

{

int r;

r=a-b;

return r;

}

void directions()

{

cout << ********************************************************" << endl

<< "Hello!" << endl

<< "This Program asks the user for two integers, then prints the sum and difference" << endl

<< "****************************************************** << endl << endl;

}

void printResult(int a, int b, int result, string operation)

{

cout << a < " " << operation << " " << b << " = " << result << endl;

}

1.1) How many functions are defined in this program, including the main() function

1.2) Give the prototype of each function.

1.3) Give the arguments of each function.

1.4) Give the parameters of each function.

1.5) Compile the program and fix all errors that may occur. Complete test plan. Run the program and fill in the remainder of your test plan.

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 Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

Identify external recruitment sources.

Answered: 1 week ago

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago