Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #include <iostream>
  2. #define ILOSC_PRACOWNIKOW 3
  3.  
  4.  
  5.  
  6. using namespace std;
  7.  
  8. struct dane_os {
  9. string imie;
  10. string nazwisko;
  11. string pesel;
  12. };
  13.  
  14. struct Pracownik {
  15. double wys2010[12];
  16. double sre2010;
  17. dane_os dane;
  18. };
  19.  
  20. Pracownik firma[ILOSC_PRACOWNIKOW];
  21.  
  22. void wczytaj(int miejsce) {
  23. cout << "Imie: ";
  24. cin >> firma[miejsce].dane.imie;
  25. cout << endl << "Nazwisko: ", firma[miejsce].dane.nazwisko;
  26. cin >> firma[miejsce].dane.nazwisko;
  27. cout << endl << "PESEL: ", firma[miejsce].dane.pesel;
  28. cin >> firma[miejsce].dane.pesel;
  29.  
  30. cout << "Wynagrodznie (x12): " << endl;
  31.  
  32. double srednia = 0;
  33.  
  34. for(int i = 0; i<12; i++) {
  35. cout << i+1 << ":";
  36. cin >> firma[miejsce].wys2010[i];
  37. srednia += firma[miejsce].wys2010[i];
  38. }
  39.  
  40. firma[miejsce].sre2010 = srednia/12;
  41. }
  42.  
  43.  
  44. void drukuj(int miejsce) {
  45. cout << firma[miejsce].dane.imie << endl;
  46. cout << firma[miejsce].dane.nazwisko<< endl;
  47. cout << firma[miejsce].dane.pesel<< endl;
  48. cout << firma[miejsce].sre2010<< endl;
  49. for(int i = 0; i<12; i++) {
  50. cout << firma[miejsce].wys2010[i] << " ";
  51. }
  52. }
  53.  
  54. void srednia() {
  55. int miesiac[11];
  56. for(int i=0; i <ILOSC_PRACOWNIKOW; i++)
  57. {
  58. miesiac[i] = 0;
  59. }
  60. for(int i =0; i<ILOSC_PRACOWNIKOW; i++) {
  61. for(int j=0; j<12; j++) {
  62. miesiac[j] += firma[i].wys2010[j];
  63. }
  64. }
  65.  
  66. cout << "SREDNIA MIESIĘCZNA: "<< endl;
  67. for(int i=0; i<12; i++) {
  68. miesiac[i] = miesiac[i]/ILOSC_PRACOWNIKOW;
  69. cout << i+1 << miesiac[i] << endl;
  70. }
  71. }
  72.  
  73. int main() {
  74. for(int i = 0; i<ILOSC_PRACOWNIKOW; i++) {
  75. wczytaj(i);
  76. drukuj(i);
  77. srednia();
  78. }
  79. system("Pause");
  80. return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement