Source code - slot.cpp

Find C and C++ source code to help you learn to program. You can submit your own code, or you can simply browse and download the code of others.

Finally, you might want to check out Code Cogs - An Open Source Scientific Library / Database in C++ for more code.

Index :: Games / slot.cpp
resource information
Title slot.cpp
Category 2
Description A slot machine game.
Contact Joe Tchamitchian
Added 08-10-2002 at 01:55 p.m.
Last Updated 08-10-2002 at 01:55 p.m.
Current Rating 3.92592592592593
Rate Resource
Number of Reviews 12
Review this Resource
  • I modified the source code and instead of 4 tokens I edited it to 400. I was playing for some time and finally i got three same numbers (9 9 9) and it doesn't show that I win.
    posted at 04:58 a.m. on 09-03-2015
  • /* Slot Machine Program by Joe Tchamitchian*/ #include <iostream.h> #include <stdlib.h> #include <time.h> int main() { int x,a, b, c, token=4; srand(time(0)); cout<<"\t********************************************************\n" <<"\t* Welcome to slot machine. *\n" <<"\t* Would you like to play? (1 to play, 2 not to play) *\n" <<"\t********************************************************\n\n"; cin>>x; while(token!=0) {cout<<"You have "<<token<< " tokens\n\n" <<"Pull? (1 to pull, 2 not to pull)\n\n"; cin>>x; if(x==1) { a = 1+rand() %10; b = 1+rand() %10; c = 1+rand() %10; cout<<"\t\t"<<a<<" "<<b<<" "<<c<<"\n\n"; } else cout<<"OK\n"; { if(a==b==c) { token+=4; cout<<"You win\n\n"; } if(a==b || b==c || a==c) { token+=1; cout<<"You got two out of three\n\n"; } else { token-=1; cout<<"You loose\n\n"; } } } return 0; }
    posted at 06:48 a.m. on 01-07-2015
  • makes for a smooth ride and pulls well. Reviewers are of the opinion that the Beetle is built for cruising and being noticed in but this version has more to offer.The Beetle has a reputation for its distinct appearance. You can further enhance the looks of your car by using Beetle body kits. A body kit is a collection of exterior modifications to the car. By this you can make changes such as add bumpers Nike Air Foamposite One
    posted at 09:34 p.m. on 10-13-2014
  • vXc9Eo <a href="">cprewkwhjhhr</a>, [url=]oermzljwsvmy[/url], [link=]allzelovqtpz[/link],
    posted at 06:05 a.m. on 05-26-2013
  • vqH7od , [url=]ercrvixtgmca[/url], [link=]jwvdpvkqfzif[/link],
    posted at 12:28 p.m. on 01-06-2012
  • oboqI6 <a href="">azvnwuvtztia</a>
    posted at 07:24 a.m. on 01-06-2012
  • 1WDftU , [url=]cbzsredmaxcu[/url], [link=]mraiqnosummf[/link],
    posted at 08:21 a.m. on 01-04-2012
  • cQInUQ <a href="">yoqchtflwxrb</a>
    posted at 04:03 a.m. on 01-04-2012
  • You've got to be kidding me-it's so tnrasparently clear now!
    posted at 08:36 a.m. on 01-03-2012
  • Yea i also found another problem. at the beginning where it asked to push 1 to play or 2 not to play.. if you pushed any other number.. it would give you a you could just keep pushing a diff number then enter and gain tokens
    posted at 05:13 p.m. on 04-24-2009
  • Program has major error in it. It never lets you win a Jackpot LOL. It was not tested properly
    posted at 05:37 p.m. on 07-03-2004
  • um...a decent begining needs a bit of work though the way the choices are used is very awkward no to mention there seems to be a logic error enter 1 a couple of times then enter 2, to see what I mean
    posted at 07:22 a.m. on 07-02-2003