Hi everybody,
I wanna learn how can I solve this problem of undefined symbols while trying to load them from another function. Here's the code to explain:
void maxmin(struct ma mx)
{ int max=mx.ev[0];
int min=mx.od[0];
for (int i=0;i<10;i++)
if (mx.ev[i]>max)
max=mx.ev[i];
for (int j=0;j<10;j++)
if (mx.od[j]<min)
min=mx.od[j];
cout<<"The biggest even number is:"<<max<<endl;
cout<<"The smallest odd number is:"<<min<<endl;
}
void minmax(struct ma my)
{ int max2=my.ev[0];
int min2=my.od[0];
for (int i=0;i<10;i++)
if (my.ev[i]<max2)
max2=my.ev[i];
for (int j=0;j<10;j++)
if (my.od[j]>min2)
min2=my.od[j];
cout<<"The smallest even number is:"<<max2<<endl;
cout<<"The biggest odd number is:"<<min2<<endl;
if (max>max2)
cout<<"The biggest number of all is:"<<max;
else
cout<<"The biggest number of all is:"<<max2;
if (min>min2)
cout<<"The smallest number of all is:"<<min2;
else
cout<<"The smallest number of all is:"<<min;
}
My problem is in lines: 24, 28.
I'm trying to get max, min from another function to compare them with max2, min2 which are from the current function, I think the return method won't work cuz it's a void function. So can anyone give me an idea? Thanks.