Guest User

Untitled

a guest
Jan 6th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include<iostream>
  2. #include<ctime>
  3. #include<cmath>
  4. #include <cstdlib>
  5. using namespace std;
  6. int main()
  7. {
  8. int a=0;
  9. cout<<"wybierz co chcesz zrobic"<<endl;
  10. cout<<"1 w poszukiwaniu papaja "<<endl;
  11. cout<<"2 2137*JP2GMD"<<endl;
  12. cin>>a;
  13. switch(a)
  14. {
  15. case 1:
  16. srand(time(NULL));
  17. int tab[2137];
  18. int l=0;
  19. int i=0;
  20. int p=0;
  21. for (i=0; i<2137; i++)
  22. {
  23. tab[i]={rand()%2138};
  24. cout<<"miejsce "<<i+1<<" "<<tab[i]<<endl;
  25. cout<<"JP2GMD"<<endl;
  26. if (tab[i]%2==0)
  27. {
  28. l++;
  29. }
  30. if(tab[i]==2137)
  31. {
  32. p=i+1;
  33. }
  34. }
  35. cout<<l<<" oto ilośc parzystych"<<endl;
  36. if(p>0)
  37. cout<<"PAPIESZ JEST NA "<<p << " MIEJSCU"<<endl;
  38. else
  39. cout<<"NIE MA PAPIESZA"<<endl;
  40. break;
  41.  
  42. case 2:
  43. int k=0;
  44. for (k=0;k<2137;k++)
  45. {
  46. cout<<k+1<<" JP2GMD"<<endl;
  47. }
  48. break;
  49.  
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment