Answer to Question #348599 in C++ for Sur

Question #348599

One box have some apples and another box have some oranges, develop a C++ program to find the sum of fruits and double the sum of fruits in the box using call by address concept

1
Expert's answer
2022-06-07T08:12:54-0400
#include <iostream> 

using namespace std; 

int SumFruit(const int& a, const int& b);
int DoubleInBox(int& a, int& b);

int main( ) 
{ 
	int apples = 0;
	int oranges = 0;

	cout << "Enter number of apples in first box: ";
	cin >> apples;

	cout << "Enter number of oranges in second box: ";
	cin >> oranges;
	cout << "Sum of two boxes is: " << SumFruit(apples, oranges) << " fruits." << endl;
	cout << "Double the sum of fruits in boxes is: " << DoubleInBox(apples, oranges) << endl;
	
	return 0; 
}

int SumFruit(const int& a, const int& b)
{
	return a+b;
}

int DoubleInBox(int& a, int& b)
{
	return (a + b) * 2;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS