Advertisement
Geronimonon

Pracownicy

Oct 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.34 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4.  
  5. struct pracownicy{
  6.     char imie [20];
  7.     char nazwisko [20];
  8.     int stawka;
  9.     int godziny;
  10.     int dz;
  11.     int mz;
  12.     int rz;
  13. };
  14.  
  15. void wpisywanko(pracownicy* tab, int n)
  16. {
  17.     for (int i=0; i<n;i++)
  18.     {
  19.         cout<<"Podaj imie "<<i+1<<" pracownika"<<endl;
  20.         cin>>tab[i].imie ;
  21.         cout<<"Podaj nazwisko "<<i+1<<" pracownika"<<endl;
  22.         cin>>tab[i].nazwisko ;
  23.         cout<<"Podaj stawke godzinowa "<<i+1<<" pracownika"<<endl;
  24.         cin>> tab[i].stawka;
  25.         cout<<"Podaj liczbe godzin pracy "<<i+1<<" pracownika"<<endl;
  26.         cin>>tab[i].godziny ;
  27.         cout<<"Podaj rok zatrudnienia (4 cyfry) "<<i+1<<" pracownika"<<endl;
  28.         cin>>tab[i].rz;
  29.         cout<<"Podaj miesiac zatrudnienia "<<i+1<<" pracownika"<<endl;
  30.         cin>>tab[i].mz;
  31.         cout<<"Podaj dzien zatrudnienia "<<i+1<<" pracownika"<<endl;
  32.         cin>>tab[i].dz ;
  33.     }
  34. }
  35.  
  36. void wypisanko(pracownicy* tab, int n)
  37. {
  38.     system("cls");
  39.     cout.width(21);
  40.     cout<<left<<"Imie";
  41.     cout.width(21);
  42.     cout<<left<<"Nazwisko";
  43.     cout.width(11);
  44.     cout<<left<<"Stwk";
  45.     cout.width(11);
  46.     cout<<left<<"godz";
  47.     cout.width(9);
  48.     cout<<left<<"Data zatr";
  49.     cout<<endl<<endl;
  50.     for(int i=0;i<n;i++)
  51.     {
  52.             cout.width(20);
  53.             cout.fill('_');
  54.             cout<<left<<tab[i].imie;
  55.             cout<<" ";
  56.             cout.width(20);
  57.             cout.fill('_');
  58.             cout<<left<<tab[i].nazwisko;
  59.             cout<<" ";
  60.             cout.width(10);
  61.             cout.fill('_');
  62.             cout<<left<<tab[i].stawka;
  63.             cout<<" ";
  64.             cout.width(10);
  65.             cout.fill('_');
  66.             cout<<left<<tab[i].godziny;
  67.             cout<<" ";
  68.             cout.width(2);
  69.             cout.fill('0');
  70.             cout<<right<<tab[i].dz;
  71.             cout<<" ";
  72.             cout.width(2);
  73.             cout.fill('0');
  74.             cout<<right<<tab[i].mz;
  75.             cout<<" ";
  76.             cout.width(4);
  77.             cout.fill('_');
  78.             cout<<right<<tab[i].rz;
  79.             cout<<" ";
  80.             cout<<endl;
  81.     }
  82. }
  83.  
  84. int main()
  85. {
  86.     int n;
  87.     cout<<"Ile chcesz wprowadzic pracownikow?"<<endl;
  88.     cin>>n;
  89.     pracownicy *tab=new pracownicy [n];
  90.     wpisywanko(tab,n);
  91.     wypisanko(tab,n);
  92.     return 0;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement