/* Slot Machine Program by Joe Tchamitchian*/ #include #include #include using n
ID: 3659101 • Letter: #
Question
/* Slot Machine Program by Joe Tchamitchian*/ #include #include #include using namespace std; int main() { int x,a, b, c, token=4; srand(time(0)); cout<<" ******************************************************** " <<" * Welcome to slot machine. * " <<" * Would you like to play? (1 to play, 2 not to play) * " <<" ******************************************************** "; cin>>x; while(token!=0) {cout<<"You have "<<token<< " tokens " <<"Pull? (1 to pull, 2 not to pull) "; cin>>x; if(x==1) { a = 1+rand() ; b = 1+rand() ; c = 1+rand() ; // b = a; // c = a; cout<<" "<<a<<" "<<b<<" "<<c<<" "; } else cout<<"OK "; { if(a==b && b==c) { token+=4; cout<<"You win "; } else if(a==b || b==c || a==c) { token+=1; cout<<"You got two out of three "; } else { token-=1; cout<<"You lose "; } } } return 0; }Explanation / Answer
//please modify, but here is copy of slot program I wrote: #include #include #include #include using namespace std; void menu(ofstream& outfile); void update(int arr[],int &token,ofstream& outfile); int main() { ofstream outfile; outfile.open("SlotProgramConsoleEchoFile.txt");//open SlotProgramConsoleEchoFile.txt for writing int choice; int Screen[3]; int token=4; //make some range for what rand number you can get const int MIN= 1; const int MAX=10; srand(time(0));//seed rand with time 0 menu(outfile);//display menu cin>>choice;//get choice while(token!=0) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.