Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

solve in C++.i\'ll add high reviews Write a function addThree that takes 4 param

ID: 3709721 • Letter: S

Question

solve in C++.i'll add high reviews

Write a function  addThree that takes 4 parameters: 3 integers passed by value and 1 integer passed by reference. The function adds the 3 integers passed by value and saves the result in the integer passed by reference. The function prototype is:

void addThree(int n1, int n2, int n3, int& sum);

Use the addThree function in a main function that does the following:

a.Opens a file called integers.txt that contains 9 integers and reads 3 integers at a time.

b.For every 3 integers it adds, it writes out a mathematical equation to an output file sum.txt

Example:

If integers.txt contains:

3 1 4 2 4 6 11 22 3

Sum.txt will contain:

3+1+4 = 8

2+4+6 = 12

11+22+3= 36

Explanation / Answer

#include #include using namespace std; void addThree(int n1, int n2, int n3, int& sum); int main() { int sum, n1, n2, n3; ifstream in("integers.txt"); if(in.is_open()) { ofstream out("sum.txt"); while(in >> n1 >> n2 >> n3) { addThree(n1, n2, n3, sum); out