Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define ILOSC_PRACOWNIKOW 3
- using namespace std;
- struct dane_os {
- string imie;
- string nazwisko;
- string pesel;
- };
- struct Pracownik {
- double wys2010[12];
- double sre2010;
- dane_os dane;
- };
- Pracownik firma[ILOSC_PRACOWNIKOW];
- void wczytaj(int miejsce) {
- cout << "Imie: ";
- cin >> firma[miejsce].dane.imie;
- cout << endl << "Nazwisko: ", firma[miejsce].dane.nazwisko;
- cin >> firma[miejsce].dane.nazwisko;
- cout << endl << "PESEL: ", firma[miejsce].dane.pesel;
- cin >> firma[miejsce].dane.pesel;
- cout << "Wynagrodznie (x12): " << endl;
- double srednia = 0;
- for(int i = 0; i<12; i++) {
- cout << i+1 << ":";
- cin >> firma[miejsce].wys2010[i];
- srednia += firma[miejsce].wys2010[i];
- }
- firma[miejsce].sre2010 = srednia/12;
- }
- void drukuj(int miejsce) {
- cout << firma[miejsce].dane.imie << endl;
- cout << firma[miejsce].dane.nazwisko<< endl;
- cout << firma[miejsce].dane.pesel<< endl;
- cout << firma[miejsce].sre2010<< endl;
- for(int i = 0; i<12; i++) {
- cout << firma[miejsce].wys2010[i] << " ";
- }
- }
- void srednia() {
- int miesiac[11];
- for(int i=0; i <ILOSC_PRACOWNIKOW; i++)
- {
- miesiac[i] = 0;
- }
- for(int i =0; i<ILOSC_PRACOWNIKOW; i++) {
- for(int j=0; j<12; j++) {
- miesiac[j] += firma[i].wys2010[j];
- }
- }
- cout << "SREDNIA MIESIĘCZNA: "<< endl;
- for(int i=0; i<12; i++) {
- miesiac[i] = miesiac[i]/ILOSC_PRACOWNIKOW;
- cout << i+1 << miesiac[i] << endl;
- }
- }
- int main() {
- for(int i = 0; i<ILOSC_PRACOWNIKOW; i++) {
- wczytaj(i);
- drukuj(i);
- srednia();
- }
- system("Pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement