Help with my Blackjack program

Hey everyone,

For my final program in my C++ Programming I class we had to create a program that we had interest in. Since I enjoy card games I decided to create a simple blackjack game. Everything was running smoothly until just now. For some reason it says I have a syntax error in my function name and it says im missing a ; at the end of my program even though Ive checked every spot that needs one. So basically I was just wondering if someone could tell me what I am doing wrong? I have asked my teacher but he really is not helping much. Also I am using Borland if that helps. (Below is the code, also it is not finished yet.)

Thanks,
TAMH





#include <math.h>
#include <fstream.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#include <iomanip.h>
#include <iostream.h>

#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
#define ENTER 13
#define ESC 27

void Menu();
void Instructions();
void Game();
void Exit();
char input;
int random1;
int random2;
int finalscore;
int finalscoredealer;
char playerhit1;
char playerhit2;
char playerhit3;
char playerhit4;
char playerhit5;
char playerhit6;
char playerhit7;
char playerhit8;
char playerhit9;
char playerhit10;
int card1;
int card2;
int card3;
int card4;
int card5;
int card6;
int card7;
int card8;
int card9;
int card10;
int card11;
int dcard1;
int dcard2;
int dcard3;
int dcard4;
int dcard5;
int dcard6;
int dcard7;
int dcard8;
int dcard9;
int dcard10;
int dcard11;

int main()
{
_setcursortype(_NOCURSOR);
Menu();
system("PAUSE");
return 0;
}

void Menu()
{
int command;
int y=10;
system("color 4e");
do
{
cout<<"###### # " << endl;
cout<<"# # # ## #### # # # ## #### # # " << endl;
cout<<"# # # # # # # # # # # # # # # # " << endl;
cout<<"###### # # # # #### # # # # #### " << endl;
cout<<"# # # ###### # # # # # ###### # # # " << endl;
cout<<"# # # # # # # # # # # # # # # # # " << endl;
cout<<"###### ###### # # #### # # ##### # # #### # # " << endl;
cout<<" " << endl;
cout<<" " << endl;
cout<<setw(40)<<"INSTRUCTIONS"<<endl;
cout<<setw(40)<<"PLAY GAME"<<endl;
cout<<setw(40)<<"EXIT"<<endl;

gotoxy(41,y);
cout <<"<--";
command = getch();
if((command == UP) && (wherey() > 10))
y=y-1;
if((command == DOWN) && (wherey() < 12))
y=y+1;
if((command == UP) && (wherey() == 10))
y=12;
if((command == DOWN) && (wherey() == 12))
y=10;
system("cls");
}

while (command!=ENTER);

if (y==10)
{
system("cls");
Instructions();
}

if (y==11)
{
system("cls");
Game();
}

if (y==12)
{
system("cls");
Exit();
}

}

void Game()
{
cout<<"Please input a number bewtween 1 and 11."<<endl;
cin>>random1;
cout<<"Please input a number bewtween 1 and 7."<<endl;
cin>>random2;

card1=random1;
card2=card1+7;
card3=card2-4;
card4=card3+2;
card5=card4+14;
card6=card5+15;
card7=card6-10;
card8=card7-13;
card9=card8+24;
card10=card9+4;
card11=card10-30;

dcard1=random2;
dcard2=dcard1+22;
dcard3=dcard2+19;
dcard4=dcard3-34;
dcard5=dcard4+10;
dcard6=dcard5+19;
dcard7=dcard6-43;
dcard8=dcard7+3;
dcard9=dcard8+28;
dcard10=dcard9-34;
dcard11=dcard10+36;

cout<<"Please press 'H' in order to start the game."<<endl;
cin>>input;
if (input=='H')
{
system("cls");
gotoxy(15,15);
cout<<"***************"<<endl;
gotoxy(15,16);
cout<<"*Players Cards*"<<endl;
gotoxy(15,17);
cout<<"***************"<<endl;
gotoxy(15,18);
cout<<card1<<endl;
gotoxy(15,19);
cout<<card2<<endl;

finalscore=card1+card2;
if(finalscore>21)
{
gotoxy(15,10);
cout<<"You have exceded 21. You have lost."<<endl;
}
if(finalscore=21)
{
gotoxy(15,10);
cout<<"You have gotten exactly 21. You have won!"<<endl;
}
if(finalscore<21)
{
gotoxy(15,10);
cout<<"Would you like another card? If so press 'H', if not press 'N'"<<endl;
cin>>playerhit1;
if(playerhit1='H')
{
gotoxy(15,20);
cout<<card3<<endl;
}
if(playerhit1='N')
{
gotoxy(15,10);
cout<<"Your score is:"<<finalscore<<endl;
}
}



gotoxy(35,15);
cout<<"***************"<<endl;
gotoxy(35,16);
cout<<"*Dealers Cards*"<<endl;
gotoxy(35,17);
cout<<"***************"<<endl;
gotoxy(35,18);
cout<<dcard1<<endl;
gotoxy(35,19);
cout<<dcard2<<endl;

finalscoredealer=dcard1+dcard2;
if(finalscoredealer>21)
{
gotoxy(35,10);
cout<<"The dealer has exceded 21. You have won!"<<endl;
}
if(finalscoredealer=21)
{
gotoxy(35,10);
cout<<"The dealer has gotten exactly 21. You have lost."<<endl;
}
if(finalscoredealer>18||finalscoredealer<21)
{
gotoxy(35,10);
cout<<"The dealer is holding his hand. His score is:"<< finalscoredealer<<endl;
}
if(finalscoredealer<18)
{
gotoxy(35,20);
cout<<dcard3<<endl;
}

gotoxy(15,10);
cout<<"Would you like another card? If so press 'H', if not press 'N'"<<endl;
cin>>playerhit2;
////////////////////////////////////////////////////////////////
//FINISH THE REST OF HITS FOR PLAYER/DEALER
}

void Exit()
{
cout<<setw(55)<<"Thank you for playin C++ Blackjack!!!"<<endl;
cout<<setw(55)<<"Please make sure to come back soon!!!"<<endl;
}

void Instructions()
{
int command;
cout<<" Welcome to C++ Blackjack!"<<endl;
cout<<" "<<endl;
cout<<" To play the game select the Play Game option on the main menu"<< endl;
cout<<" The goal of blackjack is to get as close as you can to 21 without going over"<<endl;
cout<<" Below is the value for the cards"<<endl;
cout<<" ACE: 1 or 11"<<endl;
cout<<" TWO: 2" << endl;
cout<<" THREE: 3"<< endl;
cout<<" FOUR: 4"<<endl;
cout<<" FIVE: 5"<<endl;
cout<<" SIX: 6"<<endl;
cout<<" SEVEN: 7"<<endl;
cout<<" EIGHT: 8"<<endl;
cout<<" NINE: 9"<<endl;
cout<<" TEN: 10"<<endl;
cout<<" JACK: 10"<<endl;
cout<<" KING: 10"<<endl;
cout<<" QUEEN: 10"<<endl;
cout<<" Your first two cards will be delt"<<endl;
cout<<" You will be prompted if you want another card delt"<<endl;
cout<<" If so press the key instructed"<<endl;
cout<<" If not your hand will be held"<<endl;
cout<<" The first person to go over 21 loses"<<endl;
cout<<" Press ESC to go back to the main menu"<<endl;
command=getch();
if(command==ESC)
{
system("cls");
Menu();
}
}
}



















Firstly, to post code you should use code tags and indent (it's easier on the eyes).

Secondly, your problem has to do with your curly braces (you either have too much, or one doesn't match with another somewhere). Re-check your code with that in mind.
Wow I am an idiot. Thank you so much, it fixed the problem.
Something someone should point out, Borland is way out of date (*hint* #include <iostream.h> ). Despite the fact that this is initially about something different, (I think) it could be really helpful to you:

“Why we've deprecated Dev-C++”

http://cplusplus.com/forum/articles/36896/

There are quite a few option here for you to choose from. Not that I'm saying that you have to upgrade, I just believe that it would benefit you in the long run.
Topic archived. No new replies allowed.