[原创]
“编写一函数对从主函数中传递过来的三个数,从中选出最大数和最小数,并通过形参传回主函数。”可以帮我吗?
int change(int a,int b,int c,int flag) {int max,min,k,t; if(flag==1) {k=b>c?b:c; max=a>k?a:k; return max; } else if(flag==0) {t=b<c?b:c; min=a<t?a:t; return min; } } main() { int m,n,l,min,max; printf("please input the number of the m,n,l:\n"); scanf("%d %d %d",&m,&n,&l); max=change(m,n,l,1); min=change(m,n,l,0); printf("%-2d %d",max,min); getch(); }
偶帮你写了个, 你看看吧....