Advertisement
jerimin

Lottery

Sep 26th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include<cstdlib>
  4. #include<ctime>
  5. using namespace std;
  6. int main()
  7. {
  8. //var
  9. int num1, num2, num3, numg1, numg2, numg3;
  10. //code
  11. cout << "Please enter your numbers to enter a lottery. --> ";
  12. cin >> numg1 >> numg2 >> numg3;
  13. srand(time(0));
  14. num1 = rand() % 10;
  15. num2 = rand() % 10;
  16. num3 = rand() % 10;
  17.  
  18. if(numg1 == num1 && numg2 == num2 && numg3 == num3)
  19. {
  20. cout << "You have won $10000";
  21. }
  22. else if(numg1 == num1 || numg2 == num2 || numg3 == num3)
  23. {
  24.     cout << "You have won $3000";    
  25. }
  26. else
  27. {
  28.     cout << "Sorry you have not won.";    
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement