I am having major trouble with this program. I have over 30 errors and can't figure out what it is. I know that they are probably related and that they are probable easy. The only problem is that I am tired and cannot think right now. So have fun!! BTW, I am sorry but I know that the indention will be messed up but I don't know how to fix it.
code:
#include <iostream.h>
#include <time.h>
#include <stdlib.h>
void pullwheel();
void disptable();
int main()
{
new int money;
int play;
int choice;
cout<<"Welcome to the Virtual Slot Machine.\n"
<<"You will start with 100 dollars and the\n"
<<"amount you input every time is five dollars.\n\n";
while(play)
{
cout<<"Please select one of the following.\n"
<<"1. Let's Play!\n"
<<"2. How much dough do I got?\n"
<<"3. Display values for spun items.\n"
<<"4. Quit\n";
cin>>choice;
switch(choice)
{
case 1: pullwheel();
case 2: cout<<money;
case 3: cout<<disptable();
case 4: play=0;
default: cout<<"Are you a moron? Choose a number 1-4.";
}
}
cout<<"You finished with $"<<money<<".\n\n";
system{"PAUSE");
delete money;
return 0;
}
void pullwheel()
{
int winnings;
int item1;
int item2;
int item3;
money=(money-5);
item1=srand(time(NULL))%5;
item2=srand(time(NULL))%5;
item3=srand(time(NULL))%5;
cout<<"You spun:\n";
switch(item1)
{
case 0:cout<<"@ ";
case 1:cout<<"# ";
case 2:cout<<"* ";
case 3:cout<<"& ";
case 4:cout<<"^ ";
}
switch(item2)
{
case 0:cout<<"@ ";
case 1:cout<<"# ";
case 2:cout<<"* ";
case 3:cout<<"& ";
case 4:cout<<"^ ";
}
switch(item3)
{
case 0:cout<<"@";
case 1:cout<<"#";
case 2:cout<<"*";
case 3:cout<<"&";
case 4:cout<<"^";
}
if (item1==item2&&item2==item3&&item1==0)
{winnings=5;}
if (item1==item2&&item2==item3&&item1==1)
{winnings=6;}
if (item1==item2&&item2==item3&&item1==2)
{winnings=8;}
if (item1==item2&&item2==item3&&item1==3)
{winnings=10;}
if (item1==item2&&item2==item3&&item1==4)
{winnings=12;}
money=(money+winnings);
cout<<"\n\nYou just won "<<winnings<<" dollars.\n"
<<"You now have "<<money<<" dollars.\n\n";
}
void disptable()
{cout<<"3 @'s returns $5, net gain=$0.\n"
<<"3 #'s returns $6, net gain=$1.\n"
<<"3 *'s returns $8, net gain=$3.\n"
<<"3 &'s returns $10, net gain=$5.\n"
<<"3 ^'s returns $12, net gain=$7.\n";
}



LinkBack URL
About LinkBacks



