Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4.  
  5. struct punkty{
  6. int indeks, ocena;
  7.  
  8.  
  9. };
  10.  
  11. int main()
  12. {
  13. int n;
  14. cout<<"Podaj liczbe studentow:";
  15. cin>>n;
  16. punkty tab[n];
  17.  
  18. for(int i=0; i<n; i++)
  19. {
  20. cout<<"Podaj indeks studenta:";
  21. cin>>tab[i].indeks;
  22.  
  23. cout<<"Podaj ocene studenta:";
  24. cin>>tab[i].ocena;
  25. }
  26. cout<<"Zdali egzamin:"<<endl;
  27. for(int i=0; i<n; i++)
  28. {
  29. if(tab[i].ocena>=3)
  30. {
  31. cout<<tab[i].indeks<<endl;
  32. }
  33. }
  34. cout<<"Nie zdali egzaminu:"<<endl;
  35. for(int i=0; i<n; i++)
  36. {
  37. if(tab[i].ocena<3)
  38. {
  39. cout<<tab[i].indeks<<endl;
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement