Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Uczen{
- private:
- string imie;
- string nazwisko;
- float srednia;
- public:
- void Ustaw(string i, string n, float s){
- imie=i;
- nazwisko=n;
- srednia=s;
- }
- void Wyswietl(){
- cout<<"Imie: "<<imie<<"Nazwisko: "<<nazwisko<<"srednia: "<<srednia<<endl;
- }
- void Lepszy(Uczen ucz){
- if(srednia>ucz.srednia)
- cout<<"Srednia ucznia na ktorym wykonujemy metode jest lepsza"<<endl;
- else
- cout<<"Srednia ucznia na ktorym wykonujemy metode jest gorsza"<<endl;
- }
- };
- int main()
- {
- Uczen u;
- u.Ustaw("Jan ","Kowalski ",3.8);
- u.Wyswietl();
- Uczen w;
- w.Ustaw("Mateusz ","Strus ", 3.0);
- w.Wyswietl();
- u.Lepszy(w);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement