Advertisement
Guest User

dupa

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