Ok, line 8 has been modified so that resultOne and resultTwo are pointers. Now i'm getting some fresh new errors.
Code:
In function 'int main()':|
error: invalid conversion from 'int' to 'int*'|
error: initializing argument 3 of 'void doMath(int, int, int*, int*)'|
error: invalid conversion from 'int' to 'int*'|
error: initializing argument 4 of 'void doMath(int, int, int*, int*)'|
All of which occur line 15
just to give an overview, it looks like this now
Code:
#include <iostream>
using namespace std;
/*4. Write a function that takes two input arguments and provides two separate results to the caller, one
that is the result of multiplying the two arguments, the other the result of adding them. Since you can
directly return only one value from a function, you'll need the second value to be returned through a
pointer or reference parameter.
*/
void doMath(int i,int j,int *result1,int *result2);
int main()
{
int *resultOne =0;
int *resultTwo =0;
int i = 5;
int j = 10;
doMath(i,j,*resultOne,*resultTwo);
cout << resultOne;
cout << resultTwo;
}
void doMath(int i, int j,int *resultOne,int *resultTwo)
{
*resultOne = i * j;
*resultTwo = i + j;
}
Thank you for your help so far also, its really appreciated.