Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. const int red=5,kol=4;
  5.  
  6. void unos(int matrica[][kol])
  7. {
  8. for(int i=0;i<red;i++)
  9. {
  10. for(int j=0;j<kol;j++)
  11. {
  12. cout<<"Unesite ocjenu vecu od 2 a manju od 5 :";
  13. cin>>matrica[i][j];
  14. if(matrica[i][j]<2 || matrica[i][j]>5)
  15. {
  16. cout<<"Unjeli ste pogresnu ocjenu! :P "<<endl;
  17. j--;
  18. }
  19. }
  20. }
  21. }
  22.  
  23. float prosjek(int matrica[kol])
  24. {
  25. float pro=0;
  26. for(int i=0;i<kol;i++)
  27. {
  28. pro+=matrica[i];
  29. }
  30. return pro/kol;
  31. }
  32.  
  33. int prebroji (int matrica[][4], int izbor)
  34. {
  35. int brojac=0;
  36. for(int i=0;i<red;i++)
  37. {
  38. if(matrica[i][izbor]>=4)
  39. {
  40. brojac++;
  41. }
  42. }
  43. return brojac;
  44. }
  45. void main()
  46. {
  47. int matrica[red][kol];
  48. unos(matrica);
  49. int izbor;
  50. cout<<"Za kojeg ucenika zelite prosjecnu ocjenu : ";
  51. cin>>izbor;
  52. cout<<prosjek(matrica[izbor]);
  53.  
  54. system("PAUSE>0");
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement