Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lotto random number game {modify}
//Samuel Ugochukwu //Random number Lotto game //10 june 2017 //13 june 2017 modify /*This allows you to put multiple numbers until the test expression becomes true and until you finish you maximum Live*/ #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int num; int random; int MAX_TRIES = 5; srand(time(0)); random = rand()%10; cout<<" SAMUEL RANDOW NUMBER LOTTO \n\n"; cout<<"\n============================="; cout<< "\n\nPICK A NUMBER BETWEEN 0 and 10 : \n"; do { cout<<"\nENTER NUMBER: "; cin>>num; cout<<endl; cout<<MAX_TRIES<<" LEFT!"; MAX_TRIES--; if (num >10) { cout<<"\nINVALID NUMBER"<< "\nHints: between 0 and 10"; } else if(num != random) { cout<<"\nOps you don't get it right.... Try again"; } if (MAX_TRIES ==0) { cout<<"\n\nYOU LOSE"<<"\n"<<"THE CORRECT ANSWER IS "<<random; } } while (num !=random&&MAX_TRIES !=0); if ( num==random) { cout<<"\nYOU ARE A WINNER: " <<random<<" IS CORRECT\n\n"; } }
run
|
edit
|
history
|
help
0
rstring
Radix sort
Display all prime numbers upto N without sieve
DayTempEnum
remove_if_30-Seconds-of-C++
ONP
E. Bus Number
Days in month database using unordered_map
Collatz Conjecture
11