I am trying to put three numbers in order from smallest to largest by swaping them. I can figure out how to get all of them to display after they are swapped. Any help would be great.
Code:void swap2(double a, double b) { double temp = a; a = b; b = temp; } int main() { double a, b, c; cout<<"Enter three numbers."; cout<<endl; cin>>a >>b >>c; cout<<endl; if (a < b && a < c) { cout<<a; cout<<endl; } else if (b < c) { cout<<b; cout<<endl; } else { swap2(b,c); cout<<c cout<<endl; cout<<b; cout<<endl; } return 0; }



LinkBack URL
About LinkBacks




. 