Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- main(){
- clrscr();
- int x1,x2,x3,y,w,z;
- cout<<"\t\nPrograma que muestra el mayor de 3 numeros";
- cout<<"\n\nIngresa tres valores:\n";
- cin>>x1;
- cin>>x2;
- cin>>x3;
- y= ((x1>x2)&&(x1>x3)) + (1+(x2>x1)&&(x2>x3)) + (2+(x3>x1)&&(x3>x2));
- switch(y,w,z)
- {
- case 1:
- cout<<"\nEl mayor de los numeros es "<<x1;
- break;
- case 2:
- cout<<"\nEl mayor de los numeros es "<<x2;
- break;
- case 3:
- cout<<"\nEl mayor de los numeros es "<<x3;
- break;
- default:
- cout<<"\nLos valores ingresados son iguales.";
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement