Back To C++ User Defined Functions Index
//program to create two functions that prints the three numbers in ascending order and descending order passed to functions as arguments #include
#include
void asc(int a,int b,int c) { int low,low2,low3; low=a; if(b
big) { big=b; } if(c>big) { big=c; } if(a==big) { if(b>c) { big2=b; big3=c; } else { big2=c; big3=b; } } else if(b==big) { if(a>c) { big2=a; big3=c; } else { big2=c; big3=a; } } else if(c==big) { if(a>b) { big2=a; big3=b; } else { big2=b; big3=a; } } cout<<"\nprinting the numbers in descending order \n"; cout<
>a; cout<<"\nenter second number "; cin>>b; cout<<"\nenter third number "; cin>>c; asc(a,b,c); desc(a,b,c); getch(); }