Advertisement
DawidKubiak

Zadanie 10

Apr 19th, 2020
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. void wypelnij(float tab[4][5])
  5. {
  6.     for (int i=0; i<4; i++)
  7.     {
  8.         for (int j=0; j<5; j++)
  9.             {
  10.         cout << "Numer ucznia: " << i+1 << endl << " Numer oceny: " << j+1 <<": ";
  11.         cin >> tab[i][j];
  12.             }
  13.     }
  14. }
  15. void sred(float tab[4][5])
  16. { int sred,numer,sredpop;
  17.     for (int i=0;i<4;i++)
  18.     {
  19.         for (int j=0;j<5;j++)
  20.         {
  21.             sred=sred+tab[i][j];
  22.         }
  23.         if(sred>=sredpop)
  24.     {
  25.         sredpop=sred;
  26.         numer=i;
  27.     }
  28.  
  29. }
  30. cout << "Uczen nr: " << numer+1 << " ma najwyzsza srednia: " << sredpop/5 << endl;
  31. }
  32. int main()
  33. {
  34.    float tab[4][5];
  35.    wypelnij(tab);
  36.     sred(tab);
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement