Advertisement
cupsamada

tema

May 27th, 2021
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. struct elev
  4. {
  5. char nume[20];
  6. float mate,ro;
  7. } c[35];
  8. int main()
  9. {
  10. int n, i;
  11. float maxim=0;
  12. cin>>n;
  13. for(i=1; i<=n;i++)
  14. {
  15. cin>>c[i].nume>>c[i].mate>>c[i].ro;
  16. }
  17. for(i=1; i<=n; i++)
  18. {
  19. if((c[i].mate+c[i].ro)/2>maxim)
  20. {
  21. maxim=c[i].mate+c[i].ro;
  22. }
  23. }
  24. cout<<maxim<<endl;
  25. for(i=1; i<=n; i++)
  26. {
  27. if((c[i].mate+c[i].ro)/2==maxim)
  28. {
  29. cout<<c[i].nume<<endl;
  30. }
  31. }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement