Advertisement
Guest User

kraczyk

a guest
Jan 21st, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1.  namespace std;
  2. class Autor{
  3.     private:
  4.     string im;
  5.     string naz;
  6.     string gat;
  7.     int o;
  8.     public:
  9.     Autor(){
  10.         im="Krzysztof";
  11.         naz="Krawczyk";
  12.         gat="POP";
  13.         o=5;
  14.     }
  15.     void wyswietl(){
  16.         cout<<"Imie"<<setw(10)<<"nazwisko"<<setw(10)<<"Gatunek"<<setw(10)<<"Ocena"<<endl;
  17.         cout<<im<<setw(10)<<naz<<setw(10)<<gat<<setw(10)<<o<<endl;
  18.     }
  19.     Autor(string a, string b, string c, int d):im(a), naz(b), gat(c), o(d){};
  20.     void zmiana_o(){
  21.         int no;
  22.         cout<<"Podaj nową ocenę"<<endl;
  23.         cin>>no;
  24.         o=no;
  25.         cout<<"Imie"<<setw(10)<<"nazwisko"<<setw(10)<<"Gatunek"<<setw(10)<<"Ocena"<<endl;
  26.         cout<<im<<setw(10)<<naz<<setw(10)<<gat<<setw(10)<<o<<endl;
  27.     }
  28. };
  29. class Plyta: public Autor{
  30.     private:
  31.     string tyt;
  32.     int licz;
  33.     float czas;
  34.     int ocena;
  35.         public:wyswietl(){
  36.         cout<<"Tytul"<<setw(10)<<"licz"<<setw(10)<<"czas"<<setw(10)<<"ocena"<<endl;
  37.         cout<<tyt<<setw(10)<<licz<<setw(10)<<czas<<setw(10)<<ocena<<endl;
  38.         }
  39.         Plyta(){
  40.             tyt="Zlote przeboje";
  41.             licz=10;
  42.             czas=60;
  43.             ocena=5;
  44.         }
  45.         void zmien_o(){
  46.             int z;
  47.             cout<<"podaj ocene"<<endl;
  48.             cin>>z;
  49.             z=ocena;
  50.         cout<<"Tytul"<<setw(10)<<"licz"<<setw(10)<<"czas"<<setw(10)<<"ocena"<<endl;
  51.         cout<<tyt<<setw(10)<<licz<<setw(10)<<czas<<setw(10)<<ocena<<endl;          
  52.         }
  53.  
  54. };
  55. int main(int argc, char** argv) {
  56.     Autor a;
  57.     a.wyswietl();
  58.     a.zmiana_o();
  59.     Plyta p;
  60.     p.wyswietl();
  61.     p.zmiana_o();
  62.     return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement