954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need some help folks ! Slot Machine

Slot Machine

I got all this so far !!!

Nex is ..

First build in support for writing output to an output file.

2 Make a copy of your existing program and modify the new program to be array based or to use functions or both. It does not have to work exactly like the original but it must be playable in a similar manner.

Implement a minimum of two arrays or functions

add several other programming techniquessuch as string handling, switch statements, and so forth.


/* Slot Machine Program by Harde*/

#include
#include
#include

using namespace std;

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 "<>x;




if(x==1)
{

a = 1+rand() %10;
b = 1+rand() %10;
c = 1+rand() %10;
// b = a;
// c = a;

cout<<"\t\t"<

harde
Newbie Poster
13 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

Use CODE tag and PROPER indentation.
Explain exactly what problem you are facing.

dkalita
Posting Pro in Training
402 posts since Sep 2009
Reputation Points: 121
Solved Threads: 61
 

Are you trying to record all your cout's to an output file?
To get started...

Caps in the following code are up to you to choose.

//Necessary declarations
      ofstream CHOOSE_NAME;
      CHOOSE_NAME.open("FILE_NAME.TXT");
      //
      
      //Now change all your cout's to...
      //    cout -----> CHOOSE_NAME
      //    i.e. CHOOSE_NAME << "You lose"
      //    CHOOSE_NAME becomes the same as cout, except cout is your screen and
      //    CHOOSE_NAME is your output file

      //Don't forget to close your file.
      CHOOSE_NAME.close();


Sorry if you already know this, I assumed you don't since it isn't in your program.

sushlet
Newbie Poster
7 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: