Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- void uzupelnianie(float tab[4][5])
- {
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<5; j++)
- {
- cout << "Podaj ocene: ";
- cin >> tab[i][j];
- }
- }
- }
- void wyswietlanie(float tab[4][5])
- {
- float srednia=0,poprzednia=0,uczen=0;
- for (int i=0; i<4; i++)
- {
- srednia = 0;
- for (int j=0; j<5; j++)
- {
- srednia = srednia + tab[i][j];
- if(srednia>=poprzednia)
- {
- poprzednia=srednia;
- uczen=i;
- }
- }
- }
- cout << "Najwyzsza srednia wynosi: " << poprzednia/5 << ", ucznia nr." << uczen+1;
- }
- int main()
- {
- float tabl[4][5];
- uzupelnianie(tabl);
- cout<<endl;
- wyswietlanie(tabl);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement