|
-
February 20th, 2011, 12:43 AM
#1
Slot Machine Help please?
whenever i run this code on devc++ my compiler crashes its just the beginning but can somebody help me along through this?
code:
Code:
/**
* @author mgawronski
* @version 2/15/11
*
* Code Description:
*
*/
#include <iostream> //Allows user to interact with application
#include <stdlib.h> //used to extract largest int value
#include <time.h> //used to extract time from internal clock
#include <cstdlib>
#include <conio.h>
using namespace std; //Introduces namespace std
int Wager;
int Chips = 1000;
int Fruit;
string FruitName;
string WheelOne;
string WheelTwo;
string WheelThree;
void Intro();
//pre:
//post:
void Intro()
{
cout<<"*********************************************\n"
<<"---------------------------------------------\n"
<<"***********Welcome to DJM's Casino***********\n"
<<"---------------Enjoy The Slots---------------\n"
<<"*********************************************\n\n";
}
void Exit();
//pre:
//post:
void Exit()
{
cout<<"*********************************************\n"
<<"---------------------------------------------\n"
<<"******Thanks For Visiting DJM's Casino*******\n"
<<"-----------------Visit Again-----------------\n"
<<"*********************************************\n\n";
}
int Bet();
//pre:
//post:
int Bet()
{
cout<<"You have $"<<Chips<<endl;
cout<<"Place your bet (Whole Number): ";
cin>>Wager;
Chips = Chips - Wager;
}
int Win();
//pre:
//post:
int Win()
{
}
string GetFruit();
//pre:
//post:
string GetFruit()
{
Fruit = (rand()%3)+1;
if(1 == Fruit)
{
FruitName = "Cherry";
}
else if(2 == Fruit)
{
FruitName = "Orange";
}
else if(3 == Fruit)
{
FruitName = "Apple";
}
else
{
cout<<"How did this happen?";
}
}
void Play();
//pre:
//post:
void Play()
{
Intro();
Bet();
cout<<"Press Enter to Begin Slots\n";
getch();
GetFruit();
WheelOne = FruitName;
GetFruit();
WheelTwo = FruitName;
GetFruit();
WheelThree = FruitName;
cout.setf(ios::fixed);
cout.width(30);
cout<<WheelOne<<" "<<WheelTwo<<" "<<WheelThree<<endl;
Exit();
}
int main()
{
srand(time(NULL)); //initialize random seed
Play();
system("PAUSE");
return EXIT_SUCCESS;
}
Last edited by Marc G; February 20th, 2011 at 04:52 AM.
Reason: Added code tags
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|