RE:Necesito programa y consejos
// program ordenar - borland c++ - ver 3.1
#include <iostream.h>
#include <conio.h>
void swap(int &a,int &b) // intercambio de valores
{ int c = a; a = b ; b = c;}
void main()
{
clrscr();
int a,b,c; // elegi numeros enteros, puede ser tambien float o char
cin >> a; // ingresar los valores
cin >> b;
cin >> c;
cout << "sin ordernar : " << a << "," << b << "," << c << endl;
if(a < b) swap(a,b);
if(a < c) swap(a,c); // a recibe el menor de los tres valores
if(b < c) swap(b,c); // b recibe el segundo y c el tercero
cout <<"ordenados : " << a << "," << b << "," << c << endl;
getch();
}
para el "viceversa" hay que cambiar en todos los if el signo < por el
signo >.
Exito ! ! !