nylonelyguy
Technical User
here is my program, it is only returning one value. can someone look at it please and tell me what im doing wrong.
note: only one function allowed, not allowed to use if statment, or global vaiable.
#include <iostream.h>
int calculate (int &, int &, int &);
void main()
{
int a,b,c;
cout<<"Enter 3 integers numbers: ";
cin>>a>>b>>c;
cout<<" the sum of the 3 numbers is: "<<calculate(a,b,c);
cout<<" the product of the 3 numbers is: "<<calculate(a,b,c);
}
int calculate (int &a, int &b, int &c)
{
int sum, pro;
sum= a+b+c;
pro=a*b*c;
return sum;
}
note: only one function allowed, not allowed to use if statment, or global vaiable.
#include <iostream.h>
int calculate (int &, int &, int &);
void main()
{
int a,b,c;
cout<<"Enter 3 integers numbers: ";
cin>>a>>b>>c;
cout<<" the sum of the 3 numbers is: "<<calculate(a,b,c);
cout<<" the product of the 3 numbers is: "<<calculate(a,b,c);
}
int calculate (int &a, int &b, int &c)
{
int sum, pro;
sum= a+b+c;
pro=a*b*c;
return sum;
}