Facebook
From Torrid Hamerkop, 4 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 141
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. struct student
  5. {
  6.     string imie;
  7.     string nazwisko;
  8.     char plec;
  9.     int nr_pesel;
  10.     int nr_indeksu;
  11. };
  12. void display_student(student &student1)
  13. {
  14.     cout<<student1.imie<<endl;
  15.     cout<<student1.nazwisko<<endl;
  16.     cout<<student1.plec<<endl;
  17.     cout<<student1.nr_pesel<<endl;
  18.     cout<<student1.nr_indeksu<<endl;
  19. }
  20. void display_all_studnet( student osoba[],int n)
  21. {
  22.     for(int i=0; i<n; i++)
  23.     {
  24.         display_student(osoba[i]);
  25.     }
  26. }
  27.  
  28. int main()
  29. {
  30.     student student1;
  31.     cin>>student1.imie>>student1.nazwisko>>student1.plec>>student1.nr_pesel>>student1.nr_indeksu;
  32. //display_student(student1);
  33.     int n=3;
  34.  
  35.     student osoba[n];
  36.     osoba[0].imie="ma";
  37.     osoba[0].nazwisko="to";
  38.     osoba[0].plec='m';
  39.     osoba[0].nr_pesel=12;
  40.     osoba[0].nr_indeksu=3413;
  41.     osoba[1].imie="na";
  42.     osoba[1].nazwisko="lllo";
  43.     osoba[1].plec='r';
  44.     osoba[1].nr_pesel=133332;
  45.     osoba[1].nr_indeksu=3123;
  46.     osoba[2].imie="po";
  47.     osoba[2].nazwisko="co";
  48.     osoba[2].plec='m';
  49.     osoba[2].nr_pesel=112122;
  50.     osoba[2].nr_indeksu=3;
  51.     display_all_studnet(osoba,n);
  52.  
  53.  
  54. }
  55.  
  56.