Originally posted by brutal
Ok, i have this problem where i have to return the largest and smallest of 3 numbers using a funcion with 5 parameters. Here is what I got so far. It doesn't compile right for some reason, where is my mistake? Thanks in advance for any help.
Code:
#include <iostream.h>
void maxmin(int a, int b, int c, int&max, int&min)
ma=a;
mi=b;
return;
}
void main()
{
int max, min;
maxmin(10,5,6,max,min);
cout<<max<<min;
}
In your function, ma and mi are undeclared identifiers. Also you do not have an open brace at the beginning of the function. Try re-writing like this. Also never use void main!
Code:
#include <iostream.h>
void maxmin( int a, int b, int c, int &max, int &min )
{
max = a;
min = b;
}
int main( void )
{
int max, min;
maxmin( 10, 5, 6, max, min );
cout << max << min;
return 0;
}