Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void intro();
  5. bool play();
  6.  
  7. //KNLwr5bK 4j8johPs9L
  8. int main(){
  9. intro();
  10. int lvl = 5;
  11. bool win = true;
  12.  
  13. for (int i = 0; i < lvl; i++) {
  14. //ten if jest prawdziwy kiedy play zwaraca
  15. // !false -> true
  16. // !true -> false
  17. if( !play() ) {
  18. cout << "Loose" << endl;
  19. win = false;
  20. break;
  21. }
  22. }
  23.  
  24. if( win ) {
  25. cout << "Win" << endl;
  26. }
  27.  
  28. return 0;
  29. }
  30.  
  31. bool play() {
  32. //liczby wylosowane przez kompa
  33. int l1 = rand() % 10, l2 = rand() % 10, l3 = rand() % 10;
  34. int suma = l1 + l2 + l3;
  35. int iloczyn = l1 * l2 * l3;
  36. cout << "Wylosowane: " << l1 << " " << l2 << " " << l3 << endl;
  37. int x,y,z;
  38. cout << "Podaj trzy liczby: " << endl;
  39. cin >> x >> y >> z;
  40. int sumaP = x + y + z;
  41. int iloczynP = x * y * z;
  42.  
  43. if(suma == sumaP && iloczyn == iloczynP) {
  44. return true;
  45. }
  46. else {
  47. return false;
  48. }
  49. }
  50.  
  51. void intro(){
  52. cout << endl;
  53. cout << "You are hacking into a Facebook" << endl;
  54. cout << "Its a risky job, so be cearfull :)" <<endl;
  55. cout << endl << endl;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement