Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- const int red=5,kol=4;
- void unos(int matrica[][kol])
- {
- for(int i=0;i<red;i++)
- {
- for(int j=0;j<kol;j++)
- {
- cout<<"Unesite ocjenu vecu od 2 a manju od 5 :";
- cin>>matrica[i][j];
- if(matrica[i][j]<2 || matrica[i][j]>5)
- {
- cout<<"Unjeli ste pogresnu ocjenu! :P "<<endl;
- j--;
- }
- }
- }
- }
- float prosjek(int matrica[kol])
- {
- float pro=0;
- for(int i=0;i<kol;i++)
- {
- pro+=matrica[i];
- }
- return pro/kol;
- }
- int prebroji (int matrica[][4], int izbor)
- {
- int brojac=0;
- for(int i=0;i<red;i++)
- {
- if(matrica[i][izbor]>=4)
- {
- brojac++;
- }
- }
- return brojac;
- }
- void main()
- {
- int matrica[red][kol];
- unos(matrica);
- int izbor;
- cout<<"Za kojeg ucenika zelite prosjecnu ocjenu : ";
- cin>>izbor;
- cout<<prosjek(matrica[izbor]);
- system("PAUSE>0");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement