Advertisement
grupywmiiak1718

klasyzad2

Apr 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class Uczen{
  5. private:
  6.     string imie;
  7.     string nazwisko;
  8.     float srednia;
  9. public:
  10.     void Ustaw(string i, string n, float s){
  11.         imie=i;
  12.         nazwisko=n;
  13.         srednia=s;
  14.     }
  15.     void Wyswietl(){
  16.     cout<<"Imie: "<<imie<<"Nazwisko: "<<nazwisko<<"srednia: "<<srednia<<endl;
  17.     }
  18.     void Lepszy(Uczen ucz){
  19.         if(srednia>ucz.srednia)
  20.     cout<<"Srednia ucznia na ktorym wykonujemy metode jest lepsza"<<endl;
  21.     else
  22.         cout<<"Srednia ucznia na ktorym wykonujemy metode jest gorsza"<<endl;
  23.  
  24.  
  25.     }
  26. };
  27.  
  28. int main()
  29. {
  30.     Uczen u;
  31.     u.Ustaw("Jan ","Kowalski ",3.8);
  32.     u.Wyswietl();
  33.     Uczen w;
  34.     w.Ustaw("Mateusz ","Strus ", 3.0);
  35.     w.Wyswietl();
  36.     u.Lepszy(w);
  37.         return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement