orlandoju

Ejer8_tp3

Apr 7th, 2022 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(void){
  5.    
  6.     int i,maximo=0,minimo=0;
  7.        float sueldo,maxsueldo;
  8.        int maxlegajo,legajo;
  9.     cout<< " Ingrese el legajo y sueldo del empleado:  "<<endl;
  10.     cout<<"--------------------"<<endl;
  11.  
  12.  
  13.    for (i = 0; i < 5; i++){
  14.        cin>>legajo;
  15.        cin>>sueldo;
  16.       cout<<"--------------------"<<endl;  
  17.         // toma el priner ingreso
  18.        if(i ==0){
  19.       maxlegajo=legajo;
  20.       maxsueldo=sueldo;
  21.        }
  22.        else
  23.            if (sueldo>maxsueldo){
  24.            maxsueldo=sueldo;
  25.            maxlegajo=legajo;
  26.            }
  27.                else
  28.                    sueldo=maxsueldo;
  29.                    legajo=maxlegajo;
  30.    }    
  31.      cout<<"--------------------"<<endl;
  32.      cout<<"El legajo con mayor sueldo es: "<< maxlegajo<<endl;
  33.      return 0;
  34. }
Add Comment
Please, Sign In to add comment