Computer Science
Split your previous lab assignment into two cpp files: one should have the main function, and the other should have two other functions.
Write a function that accepts two integers as input arguments and return their sum. Call this function from main( ) and call another function from main( ) that prints the result (sum). Thus, you need two separate functions besides main( ).
using namespace std;
int add(int, int);
void result(int);
int main()
{
int num1,num2,sum;
cout<<“Enter your two favorite numbers:”<<>
cin>>num1>>num2;
sum=add(num1,num2);
result(sum);
return 0;
}
int add(int x,int y) // add the two numbers you picked
{
int z;// z is where it’s stored
z=x+y;
return(z); // z is the return function
}
void result(int a) // results
{
cout<< “The sum of your two favorite numbers is ” <<>
}