Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. class autor
  7. {
  8.     private:
  9.     string imie, nazwisko, gatunek;
  10.     float ocena;
  11.    
  12.     public:
  13.     void disp()
  14.     {
  15.         cout << "Imie" << setw(10) << "Nazwisko" << setw(10) << "Gatunek" << setw(10) << "Ocena" << setw(5) << endl;
  16.         cout << imie << setw(10) << nazwisko << setw(10) << gatunek << setw(10) << ocena << setw(5) << endl;
  17.     }  
  18.    
  19.     autor()
  20.     {
  21.         imie = "Krzysztof";
  22.         nazwisko = "Krawczyk";
  23.         gatunek = "POP";
  24.         ocena = 5;
  25.         cout << "Konstruktor domyslny klasy autor zostal wywolany" << endl;
  26.     }
  27.    
  28.     autor(string i, string n, string g, float o)
  29.     {
  30.         imie = i;
  31.         nazwisko = n;
  32.         gatunek = g;
  33.         ocena = o;
  34.         cout << "Konstruktor parametryczny klasy autor zostal wywolany" << endl;
  35.     }
  36.    
  37.     void zmiana()
  38.     {
  39.         float ocena2;
  40.         cout << "Podaj nowa ocene wykonawcy:";
  41.         cin >> ocena2;
  42.         ocena = ocena2;
  43.     }
  44. };
  45.  
  46. int main(int argc, char** argv)
  47. {
  48.    
  49.     autor a1;
  50.     a1.disp();
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement