Advertisement
olekturbo

Untitled

Nov 6th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void wypelnienie();
  5. void wypisanie();
  6. void srednia();
  7. void wieksza();
  8.  
  9. int m = 1;
  10. struct Avg
  11. {
  12. int x, w;
  13. };
  14. Avg T[6];
  15. int main()
  16. {
  17.  
  18. wypelnienie();
  19. wypisanie();
  20. srednia();
  21.  
  22. }
  23.  
  24. void wypelnienie()
  25. {
  26. cout << "Uzupelnij ocene: \n";
  27. for(int i = 0; i < 6; i++)
  28. {
  29. cin >> T[i].x;
  30. }
  31. cout << "Uzupelnij wage :\n";
  32. for(int i = 0; i < 6; i++)
  33. {
  34. cin >> T[i].w;
  35. }
  36. }
  37. void wypisanie()
  38. {
  39. cout << "Oceny: ";
  40. for(int i = 0; i < 6; i++) cout << T[i].x << ", ";
  41.  
  42. }
  43.  
  44. void srednia()
  45. {
  46.  
  47. cout << "Srednia: ";
  48. for(int i = 0; i < 6; i++) m=(T[i].x*T[i].w)/T[i].w;
  49. cout << m;
  50. }
  51.  
  52. void wieksza()
  53. {
  54. for(int i = 0; i < 6; i++)
  55. {
  56. if(T[i].x > m) cout << T[i].x << ", ";
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement