Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- struct pracownicy{
- char imie [20];
- char nazwisko [20];
- int stawka;
- int godziny;
- int dz;
- int mz;
- int rz;
- };
- void wpisywanko(pracownicy* tab, int n)
- {
- for (int i=0; i<n;i++)
- {
- cout<<"Podaj imie "<<i+1<<" pracownika"<<endl;
- cin>>tab[i].imie ;
- cout<<"Podaj nazwisko "<<i+1<<" pracownika"<<endl;
- cin>>tab[i].nazwisko ;
- cout<<"Podaj stawke godzinowa "<<i+1<<" pracownika"<<endl;
- cin>> tab[i].stawka;
- cout<<"Podaj liczbe godzin pracy "<<i+1<<" pracownika"<<endl;
- cin>>tab[i].godziny ;
- cout<<"Podaj rok zatrudnienia (4 cyfry) "<<i+1<<" pracownika"<<endl;
- cin>>tab[i].rz;
- cout<<"Podaj miesiac zatrudnienia "<<i+1<<" pracownika"<<endl;
- cin>>tab[i].mz;
- cout<<"Podaj dzien zatrudnienia "<<i+1<<" pracownika"<<endl;
- cin>>tab[i].dz ;
- }
- }
- void wypisanko(pracownicy* tab, int n)
- {
- system("cls");
- cout.width(21);
- cout<<left<<"Imie";
- cout.width(21);
- cout<<left<<"Nazwisko";
- cout.width(11);
- cout<<left<<"Stwk";
- cout.width(11);
- cout<<left<<"godz";
- cout.width(9);
- cout<<left<<"Data zatr";
- cout<<endl<<endl;
- for(int i=0;i<n;i++)
- {
- cout.width(20);
- cout.fill('_');
- cout<<left<<tab[i].imie;
- cout<<" ";
- cout.width(20);
- cout.fill('_');
- cout<<left<<tab[i].nazwisko;
- cout<<" ";
- cout.width(10);
- cout.fill('_');
- cout<<left<<tab[i].stawka;
- cout<<" ";
- cout.width(10);
- cout.fill('_');
- cout<<left<<tab[i].godziny;
- cout<<" ";
- cout.width(2);
- cout.fill('0');
- cout<<right<<tab[i].dz;
- cout<<" ";
- cout.width(2);
- cout.fill('0');
- cout<<right<<tab[i].mz;
- cout<<" ";
- cout.width(4);
- cout.fill('_');
- cout<<right<<tab[i].rz;
- cout<<" ";
- cout<<endl;
- }
- }
- int main()
- {
- int n;
- cout<<"Ile chcesz wprowadzic pracownikow?"<<endl;
- cin>>n;
- pracownicy *tab=new pracownicy [n];
- wpisywanko(tab,n);
- wypisanko(tab,n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement