Advertisement
MeehoweCK

Untitled

Jun 19th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int MAXNAP = 20;
  6. const int MAXSTUD = 4;
  7.  
  8. struct Wyniki
  9. {
  10.     char imie[MAXNAP];
  11.     char nazwisko[MAXNAP];
  12.     int numerIndeksu;
  13.     int liczba_punktow;
  14. };
  15.  
  16. void wczytaj(Wyniki* tab)
  17. {
  18.     cout << "Podaj dane studentow.\n";
  19.     for(int ile = 0; ile < MAXSTUD; ++ile)
  20.     {
  21.         cout << "\timie: ";
  22.         cin >> tab[ile].imie;
  23.         cout << "\tnazwisko: ";
  24.         cin >> tab[ile].nazwisko;
  25.         cout << "\tnumer indeksu: ";
  26.         cin >> tab[ile].numerIndeksu;
  27.         cout << "\tliczba punktow: ";
  28.         cin >> tab[ile].liczba_punktow;
  29.         cout << endl;
  30.     }
  31. }
  32.  
  33. void pokazWyniki(Wyniki* tab)
  34. {
  35.     for(int i = 0; i < MAXSTUD; ++i)
  36.     {
  37.         cout << "student nr " << tab[i].numerIndeksu << ":\n";
  38.         cout << tab[i].imie << " " << tab[i].nazwisko << ": " << tab[i].liczba_punktow << "pkt\n\n";
  39.     }
  40. }
  41.  
  42. int main()
  43. {
  44.     Wyniki wyniki[MAXSTUD];
  45.     wczytaj(wyniki);
  46.     pokazWyniki(wyniki);
  47.  
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement