Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int did, maz, galia, i, kiekis;
  9. string masina, masin, masin1;
  10.  
  11. did=0;
  12. maz=500;
  13.  
  14. ifstream failas("duomenys.txt");
  15. failas >> kiekis;
  16.  
  17. for(i=1;i<=kiekis;i++)
  18.  
  19. {
  20. failas>>masina>>galia;
  21. if(galia>did)
  22.  
  23. {
  24. did=galia;
  25. masin=masina;
  26.  
  27. }
  28.  
  29. if(galia<maz)
  30.  
  31. {
  32. maz=galia;
  33. masin1=masina;
  34.  
  35. }
  36. }
  37. cout << "Atsakymas: " << endl;
  38. cout << "Galingiausias: " << did << "kW" << " " << masin << endl;
  39. cout << "Silpniausias: " << maz << "kW" << " " << masin1 << endl;
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement