Advertisement
Chieffo

XDD

Nov 19th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <time.h>
  4. #include <windows.h>
  5.  
  6. using namespace std;
  7.  
  8. int l(void )
  9. {
  10.  
  11. return rand()%99+1;
  12. }
  13.  
  14. int main()
  15. {
  16. //napisz program losujący liczbę od 1-100 i ma byćwywoływana 10 razy w i liczy i wylosowane liczby parzyste
  17. srand(time(NULL));
  18. int p=0;
  19. for (int i=0;i<=10;i++)
  20. {
  21. Beep(l()*100,100);
  22. cout<<l()<<endl;
  23. if(l()%2==0)
  24. {
  25.  
  26. p++;
  27. }
  28. }
  29.  
  30. cout<<"Parzyste: "<<p;
  31. Beep(p*20,150);
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement