Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <string>
- #include <iostream>
- using namespace std;
- class Student {
- public:
- string imie;
- string nazwisko;
- string kierunek;
- int year;
- int month;
- int day;
- };
- class UJK {
- public:
- Student* tab[100];
- int licznik = 0;
- void dodajStudenta(string imie, string nazwisko,string kierunek, int day, int month, int year) {
- tab[licznik] = new Student();
- tab[licznik]->imie = imie;
- tab[licznik]->nazwisko = nazwisko;
- tab[licznik]->kierunek=kierunek;
- tab[licznik]->day=day;
- tab[licznik]->month=month;
- tab[licznik]->year=year;
- ++licznik;
- void wyswietlStudentow() {
- int i;
- for (i = 0; i <= licznik-1; ++i) {
- cout << "Student nr " << (i + 1) << " to "
- << tab[i]->imie << " "
- << tab[i]->nazwisko<< " "
- << tab[i]->kierunek<< " "
- << tab[i]->day<< " "
- << tab[i]->month<< " "
- << tab[i]->year<<endl;
- if (day>31) cout<<"podales zly dzien"<<
- if (month>12) cout<<"podales zly miesiac"<<
- if (year>2016) cout<<"podales zly rok"<<endl;
- }
- }
- };
- int main()
- {
- UJK* ujk = new UJK();
- ujk->dodajStudenta("Jan", "Kowalski","Informatyk",24,11,1995);
- ujk->wyswietlStudentow();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement