Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- struct student // etap 1.1
- {
- string imie;
- string nazwisko;
- string plec;
- string nr_indeks;
- string nr_pesel;
- };
- void display_student( student & s1 )
- {
- //etap 1.2 i 1.3
- cout << "podaj imie studenta" << endl;
- cin >> s1.imie;
- cout << "podaj nazwisko" << endl;
- cin >> s1.nazwisko;
- cout << "podaj plec studenta "<< endl;
- cin >> s1.plec;
- cout << "podaj nr indeksu studenta" << endl;
- cin >> s1.nr_indeks;
- cout << "podaj nr pesel studenta" << endl;
- cin >> s1.nr_pesel;
- cout << endl;
- }
- void display_all_students(student tab[], int tab_size)
- {
- for(int i = 0; i < tab_size; i++)
- {
- display_student(tab[i]);
- }
- } //etap 1.5
- int main()
- {
- int liczba_studentow = 3;
- student s1; // typ i nazwa zmiennej s1
- display_student(s1);//wywolanie funkcji
- //etap.4
- // student jest typem jak np: int ...
- student tab[liczba_studentow]; // tablica 3 studentow
- //dane pierwszego studenta
- tab[0].imie = "Jan";
- tab[0].nazwisko = "Janowski";
- tab[0].plec = "mezczyzna";
- tab[0].nr_indeks = "321321";
- tab[0].nr_pesel = "4324235432";
- //dane drugiego studenta
- tab[1].imie = "Mikolaj";
- tab[1].nazwisko = "Swiety";
- tab[1].plec = "mezczyzna";
- tab[1].nr_indeks = "432421";
- tab[1].nr_pesel = "234235432";
- //dane trzeciego studenta
- tab[2].imie = "Piotr";
- tab[2].nazwisko = "Pan";
- tab[2].plec = "mezczyzna";
- tab[2].nr_indeks = "543521";
- tab[2].nr_pesel = "5345635432";
- //wywolanie funkcji
- display_all_students(tab ,liczba_studentow);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement