Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "string.h"
- using namespace std;
- class TPrzedmiot{
- private:
- string Nazwa;
- double Ocena;
- public:
- string data;
- void SetData(string Nazwa2 , double Ocena2)
- { Nazwa=Nazwa2;
- Ocena=Ocena2;
- data=__DATE__;
- }
- void GetData()
- { cout << Nazwa;
- cout << Ocena;
- cout << data;
- }
- TPrzedmiot()
- {
- Nazwa="?";
- Ocena=0;
- }
- };
- class TStudent {
- private :
- TPrzedmiot Przedmiot[2];
- char Nazwisko[30];
- char Imie[30];
- int NumerIndeksu;
- public :
- void SetPrzedmiot(string Nazwa2, double Ocena, int NumerPrzedmiotu)
- {
- Przedmiot[NumerPrzedmiotu].SetData(Nazwa2,Ocena);
- }
- void SetStudent(char* Nazwisko2, char* Imie2, int NumerIndeksu2)
- {
- strcpy(Nazwisko,Nazwisko2);
- strcpy(Imie,Imie2);
- NumerIndeksu=NumerIndeksu2;
- }
- void GetStudent()
- {
- cout << Imie;
- cout << Nazwisko;
- cout << NumerIndeksu;
- for(int i=0; i<3;i++)
- {
- Przedmiot[i].GetData();
- }
- }
- TStudent()
- {
- strcpy(Imie,"Brak Danych");
- strcpy(Nazwisko,"Brak Danych");
- NumerIndeksu=0;
- }
- };
- int main()
- {
- TStudent *wsk;
- wsk = new TStudent;
- wsk->SetStudent("Nowak","Tomasz",99888);
- wsk->SetPrzedmiot("Analiza" , 4.5,0);
- wsk->SetPrzedmiot("Algebra" , 4.5,1);
- wsk->SetPrzedmiot("Obiektowe" , 4.5,2);
- wsk->GetStudent();
- delete wsk;
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement