so basically the thing is nearly complete, and im just trying to get it to work, im pretty sure i just havent closed off some statments and such, but i cannot for the life of me see where, or how to get the error messages to leave me alone in peace

if you could have a look over, tell me where it needs changing, that would be great and i will send you unicorn, thanks in advance.

#include <iostream>
#include <ctime>         //For time generator

void Cardshuffle(bool DealtCards[]);
void PrintCard(int iCard);
void PrintHand(int iaHand[], const int ConsDealtCard);
int GetNextCard(bool DealtCards[]);
int ScoreHand(int iaHand[], const int ConsDealtCard);

void game();            // Actual Game Routine
void MenuSystem();      // Menu Routine For Game

void PrintScoresAndHands(int iaHouseHand[], const int kiHouseDealtCards, int iaPlayerHand[], const int kiPlayerDealtCards); //Print total player and computer scores

int main()  
{
using namespace std;

{
    time_t qTime;
    time(&qTime);
    srand(qTime);   //Using the time to change the number that is generated, this means it will always be different

    char choice;

    do
    {   
        MenuSystem();
        cin >> choice;

        if (choice == '1')
        {
            game();
        }

    } while (choice != '2');
    cout << endl;


    system ("pause");
    return 0;

void MenuSystem();
{
    cout << "--------------------------------------------------------" << endl;
    cout << "-------------- Want To Play BlackJack ? ----------------" << endl;
    cout << "--------------------------------------------------------" << endl;

    cout << "choices \n\n"    
    << "Press 1 To Play Black Jack" << endl
    << "Press 2 To View Back Jack Rules" << endl
    << "Press 3 To Quit Black Jack" << endl << endl
    << "Enter Choice : ";

void game();

    bool DealtCards[52];
    int iHouseDealtCards = 0;
    int iaHouseHand[12];
    int iPlayerDealtCards = 0;
    int iaPlayerHand[12];

    // Loop once for each hand
    while (true) {
        // "Cardshuffle" the cards; set them all to undealt
        Cardshuffle(DealtCards);
        // Deal the hands. Get two cards for each
        iaPlayerHand[0]     = GetNextCard(DealtCards);
        iaHouseHand[0]      = GetNextCard(DealtCards);
        iaPlayerHand[1]     = GetNextCard(DealtCards);
        iaHouseHand[1]      = GetNextCard(DealtCards);
        iHouseDealtCards        = 2;
        iPlayerDealtCards   = 2;

        // Signal a new hand.
        cout << "--------------------------------------------------------" << endl;
        cout << "-----------------------New Hand-------------------------" << endl;
        cout << "--------------------------------------------------------" << endl;

        char cPlayerChoice;
        bool bPlayerHits    = true;
        int iPlayerScore    = ScoreHand(iaPlayerHand, iPlayerDealtCards);
        // Get Player's hits. Calculate the score and redisplay after each hit.
        do {
            // Print the dealt cards, but only the House's second card.
            cout << "House's Hand" << endl;
            cout << "** ";
            PrintCard(iaHouseHand[1]);
            cout << endl;
            cout << "Player's Hand: Score = " << ScoreHand(iaPlayerHand, iPlayerDealtCards) << endl;
            PrintHand(iaPlayerHand, iPlayerDealtCards);

            // Ask the Player whether he wants a hit or to stay
            cout << "Hit Me(h) or Leave It(l): ";
            cin >> cPlayerChoice;
            if (cPlayerChoice == 'h') 
            {
                iaPlayerHand[iPlayerDealtCards] = GetNextCard(DealtCards);
                ++iPlayerDealtCards;
            } else if (cPlayerChoice == 'l') 
            {
                bPlayerHits = false;
            } else 
            {
                cout << "Sorry: Try Again!" << endl;
            }
            cout << endl;
            // Get the Player's current score to update and check for bust.
            iPlayerScore    = ScoreHand(iaPlayerHand, iPlayerDealtCards);
        } while (bPlayerHits && iPlayerScore < 22);

        // Once the player is done taking hits, check whether he busted
        if (iPlayerScore > 21) 
        {
            // The Player busted. The House wins.
            cout << "**** The House Wins!!! ****" << endl;
            PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
        } else 
        {
            // If the player hasnt gone bust, then the house takes hits below 17
            int iHouseScore     = ScoreHand(iaHouseHand, iHouseDealtCards);
            while (iHouseScore < 17) 
            {
                iaHouseHand[iHouseDealtCards] = GetNextCard(DealtCards);
                ++iHouseDealtCards;
                iHouseScore     = ScoreHand(iaHouseHand, iHouseDealtCards);
            }
            bool bHouseBusts    = (iHouseScore > 21);
            if (bHouseBusts) 
            {
                // The House busted. Player wins
                cout << "**** The Player Wins!!! ****" << endl;
                PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
            } else 
            {
                // Compare scores and determine the winner
                if (iPlayerScore == iHouseScore) 
                {
                    // Tie. This is called a "push."
                    cout << "**** Tie!!! ****" << endl;
                    PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
                } else if (iPlayerScore > iHouseScore) 
                {
                    // The Player wins
                    cout << "**** The Player Wins!!! ****" << endl;
                    PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
                } else 
                {
                    // The House wins
                    cout << "**** The House Wins!!! ****" << endl;
                    PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
                }
            }
        }
    }
    return EXIT_SUCCESS;
}

void Cardshuffle(bool DealtCards[]) 
    {
        for (int iIndex = 0; iIndex < 52; ++iIndex) 
        {
        DealtCards[iIndex] = false;
        }
    }

void PrintCard(int iCard) 
{
    using namespace std;
    // Print Rank
    const int kiRank = (iCard % 13);
    if (kiRank == 0) 
    {
        cout << 'A';
    } else if (kiRank < 9) 
    {
        cout << (kiRank + 1);
    } else if (kiRank == 9) 
    {
        cout << 'T';
    } else if (kiRank == 10) 
    {
        cout << 'J';
    } else if (kiRank == 11)
    {
        cout << 'Q';
    } else 
    {
        cout << 'K';
    }                       // Print Suit
    }
    const int kiSuit = (iCard/13);
    if (kiSuit == 0) 

    {
        cout << '\x05';
    } else if (kiSuit == 1) // clubs
    {
        cout << '\x04';
    } else if (kiSuit == 2)  //diamonds
    {
        cout << '\x03';       //hearts
    } else {
        cout << '\x06';       //spades
    }
}

    void PrintHand(int iaHand[], const int ConsDealtCard) 
        {
        using namespace std;
        for (int iCardIndex = 0; iCardIndex < ConsDealtCard; ++iCardIndex) 
        {
        const int kiNextCard = iaHand[iCardIndex];
        PrintCard(kiNextCard);
        cout << " ";
    }
    cout << endl;
}

int GetNextCard(bool DealtCards[])
{
    bool bCardDealt = true;
    int iNewCard    = -1;
    do 
    {
        iNewCard = (rand() % 52);
        if (!DealtCards[iNewCard]) 
        {
            bCardDealt = false;
        }
    } while (bCardDealt);
    return iNewCard;
}

int ScoreHand(int iaHand[], const int ConsDealtCard) 
{
    int iAceCount   = 0;
    int iScore      = 0;
    for (int iCardIndex = 0; iCardIndex < ConsDealtCard; ++iCardIndex) 
    {
        const int kiNextCard = iaHand[iCardIndex];
        const int kiRank = (kiNextCard % 13);
        if (kiRank == 0)
        {
            ++iAceCount;
            ++iScore;
        } else if (kiRank < 9) 
        {
            iScore = iScore + (kiRank + 1);
        } else 
        {
            iScore = iScore + 10;
        }
    }
    while (iAceCount > 0 && iScore < 12) 
    {
        --iAceCount;
        iScore = iScore + 10;
    }
    return iScore;

        void PrintScoresAndHands(int iaHouseHand[], const int kiHouseDealtCards, int iaPlayerHand[], const int kiPlayerDealtCards) 
            {
                using namespace std;
                    cout << "House's Hand: Score = " << ScoreHand(iaHouseHand, kiHouseDealtCards) << endl;
                    PrintHand(iaHouseHand, kiHouseDealtCards);
                    cout << "Player's Hand: Score = " << ScoreHand(iaPlayerHand, kiPlayerDealtCards) << endl;
                    PrintHand(iaPlayerHand, kiPlayerDealtCards);
                    cout << endl;
}

Recommended Answers

All 13 Replies

What are the error messages you are getting?

commented: Needs saying so often. Well done. +8

thanks for your quick response, mainly local function definitions illegal errors, but me being a novice im not sure how to resolve them properly, it might be that i have closed of routines and it cant see them or something,

1>ClCompile:
1>  bj2.cpp
1>e:\vb\blackjack2\blackjack2\bj2.cpp(22): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>e:\vb\blackjack2\blackjack2\bj2.cpp(160): error C2601: 'Cardshuffle' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(19): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(168): error C2601: 'PrintCard' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(19): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(192): error C2065: 'iCard' : undeclared identifier
1>e:\vb\blackjack2\blackjack2\bj2.cpp(209): error C2601: 'PrintHand' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(16): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(221): error C2601: 'GetNextCard' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(16): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(236): error C2601: 'ScoreHand' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(16): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(271): fatal error C1075: end of file found before the left brace '{' at 'e:\vb\blackjack2\blackjack2\bj2.cpp(236)' was matched
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.54
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

above is the output dialog for the failed build
thanks

Most of these issues come from incorrect nesting. If you look at main(), you will see that you have an extra left brace, just after the using namespace std;, and that you fail to close the function. This means that you are in effect declaring MenuSystem() as two layers of nesting in. This is masked, however, by the fact that you have semi-colons after MenuSystem() and game(), effectively making them compile as function prototypes.

Similarly, you do not close the functions MenuSystem() and ScoreHand(). Conversely, you skip the left brace at the beginning of game(), and close PrintCard() prematurely in the middle of the function.

Oh, and you don't #include <cstdlib>, which is where srand() is declared.

These are just the most obvious errors. There are some I will leave for you to figure out yourself. The good news is, once it is debugged, the game does work more or less correctly.

you guys are demi gods, is that above god level ? idk, ive only got 20 or so bracket errors now, ill keep you posted when i have finished, so far Schol-R-LEA; you get a unicorn

another weird little error here, endl undeclared identifier, but not highlighted underline red, is endl even needed every line ?

The endl manipulator is the standard way of sending a newline to a stream. You want to use it whenever you need to progress to another line on the console.

Chances are, it is because you didn't have a using namespace std; directive in a given function. It is better not to use that directive at all, but to explicitly scope the items imported from another namespace, like so:

std::cout << "Hello, World!" << std::endl;

This avoids any ambiguity in the scope. However, that's a lot of extra typing, hence the using directive. Normally, if you use the using directive at all, you would have it at the top level of the compilation unit, usually just after the #include statements, so that it applies to all the functions defined there; doing it on a per-function basis does give better control, but wastes a lot of typing, and can easily lead to the sort of problem you're having now. I would either use the explicit std:: scope for those items, or else just put using namespace std; at the beginning of the program.

As for being demi-gods, well, I'm pretty sure I'm not particularly divine myself, but I can't speak for the others here.

Schol-R-LEA haven't you ever seen Ghostbusters?

Gozer: Are you a god?
Ray Stantz: [looks at Venkman, who nods] No.
Gozer: Then... DIIIIIIIIE! [sends the Ghostbusters sprawling with lightning bolts]
Winston Zeddmore: Ray, when someone asks you if you're a god, you say "Yes!"

got rid of all the endl errors by removing all the namespace std; apart from the one at the start of the program, just the same illegal local definition errors as before, minus a few, dont know what i did or what im doing, they all look closed off and seperate to me, but im biased now.

1>------ Build started: Project: blackjack2, Configuration: Debug Win32 ------
1>Build started 02/04/2013 15:42:22.
1>InitializeBuildStatus:
1>  Touching "Debug\blackjack2.unsuccessfulbuild".
1>ClCompile:
1>  bj2.cpp
1>e:\vb\blackjack2\blackjack2\bj2.cpp(25): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>e:\vb\blackjack2\blackjack2\bj2.cpp(63): error C2601: 'game' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(48): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(167): error C2601: 'Cardshuffle' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(48): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(175): error C2601: 'PrintCard' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(48): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(199): error C2065: 'iCard' : undeclared identifier
1>e:\vb\blackjack2\blackjack2\bj2.cpp(163): error C2562: 'game' : 'void' function returning a value
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(62) : see declaration of 'game'
1>e:\vb\blackjack2\blackjack2\bj2.cpp(271): error C2601: 'PrintScoresAndHands' : local function definitions are illegal
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(242): this line contains a '{' which has not yet been matched
1>e:\vb\blackjack2\blackjack2\bj2.cpp(280): error C2562: 'PrintScoresAndHands' : 'void' function returning a value
1>          e:\vb\blackjack2\blackjack2\bj2.cpp(270) : see declaration of 'PrintScoresAndHands'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.17
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

hang on, sorry just noticed the { not yet matched, working that out, give me 30 :P

Just wondering if someone could look over this now, apparently only 2 errors left :

"Error 2  error C2562: 'game' : 'void' function returning a value line 163" and "Error 3    error C2447: '{' : missing function header (old-style formal list?) line 174"

anyhting i do seems to bring up new errors i have never seen before
many thanks, appreciate your patientce.

new code below:

#include <iostream>
#include <ctime>         //For time generator
#include <cstdlib>

using namespace std;

void Cardshuffle(bool DealtCards[]);
void PrintCard(int iCard);
void PrintHand(int iaHand[], const int ConsDealtCard);
int GetNextCard(bool DealtCards[]);
int ScoreHand(int iaHand[], const int ConsDealtCard);

void game();            // Actual Game Routine
void MenuSystem();      // Menu Routine For Game


void PrintScoresAndHands(int iaHouseHand[], const int kiHouseDealtCards, int iaPlayerHand[], const int kiPlayerDealtCards); //Print total player and computer scores

int main()  
{


    time_t qTime;
    time(&qTime);
    srand(qTime);   //Using the time to change the number that is generated, this means it will always be different

    char choice;

    do
    {   
        MenuSystem();
        cin >> choice;

        if (choice == '1')
        {
            game();
        }

    } while (choice != '2');
    cout << endl;


    system ("pause");
    return 0;
}

void MenuSystem()
{
    cout << "--------------------------------------------------------" << endl;
    cout << "-------------- Want To Play BlackJack ? ----------------" << endl;
    cout << "--------------------------------------------------------" << endl;
    {
    cout << "choices \n\n"    << endl;
    cout << "Press 1 To Play Black Jack" << endl;
    cout << "Press 2 To View Back Jack Rules" << endl;
    cout << "Press 3 To Quit Black Jack" << endl << endl;
    cout << "Enter Choice : ";
    }
    system ("pause");
    return;
}
void game()
{
    bool DealtCards[52];
    int iHouseDealtCards = 0;
    int iaHouseHand[12];
    int iPlayerDealtCards = 0;
    int iaPlayerHand[12];

    // Loop once for each hand
    while (true) {
        // "Cardshuffle" the cards; set them all to undealt
        Cardshuffle(DealtCards);
        // Deal the hands. Get two cards for each
        iaPlayerHand[0]     = GetNextCard(DealtCards);
        iaHouseHand[0]      = GetNextCard(DealtCards);
        iaPlayerHand[1]     = GetNextCard(DealtCards);
        iaHouseHand[1]      = GetNextCard(DealtCards);
        iHouseDealtCards        = 2;
        iPlayerDealtCards   = 2;

        // Signal a new hand.
        cout << "--------------------------------------------------------" << endl;
        cout << "-----------------------New Hand-------------------------" << endl;
        cout << "--------------------------------------------------------" << endl;

        char cPlayerChoice;
        bool bPlayerHits    = true;
        int iPlayerScore    = ScoreHand(iaPlayerHand, iPlayerDealtCards);
        // Get Player's hits. Calculate the score and redisplay after each hit.
        do {
            // Print the dealt cards, but only the House's second card.
            cout << "House's Hand" << endl;
            cout << "** ";
            PrintCard(iaHouseHand[1]);
            cout << endl;
            cout << "Player's Hand: Score = " << ScoreHand(iaPlayerHand, iPlayerDealtCards) << endl;
            PrintHand(iaPlayerHand, iPlayerDealtCards);

            // Ask the Player whether he wants a hit or to stay
            cout << "Hit Me(h) or Leave It(l): ";
            cin >> cPlayerChoice;
            if (cPlayerChoice == 'h') 
            {
                iaPlayerHand[iPlayerDealtCards] = GetNextCard(DealtCards);
                ++iPlayerDealtCards;
            } else if (cPlayerChoice == 'l') 
            {
                bPlayerHits = false;
            } else 
            {
                cout << "Sorry: Try Again!" << endl;
            }
            cout << endl;
            // Get the Player's current score to update and check for bust.
            iPlayerScore    = ScoreHand(iaPlayerHand, iPlayerDealtCards);
        } while (bPlayerHits && iPlayerScore < 22);

        // Once the player is done taking hits, check whether he busted
        if (iPlayerScore > 21) 
        {
            // The Player busted. The House wins.
            cout << "**** The House Wins!!! ****" << endl;
            PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
        } else 
        {
            // If the player hasnt gone bust, then the house takes hits below 17
            int iHouseScore     = ScoreHand(iaHouseHand, iHouseDealtCards);
            while (iHouseScore < 17) 
            {
                iaHouseHand[iHouseDealtCards] = GetNextCard(DealtCards);
                ++iHouseDealtCards;
                iHouseScore     = ScoreHand(iaHouseHand, iHouseDealtCards);
            }
            bool bHouseBusts    = (iHouseScore > 21);
            if (bHouseBusts) 
            {
                // The House busted. Player wins
                cout << "**** The Player Wins!!! ****" << endl;
                PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
            } else 
            {
                // Compare scores and determine the winner
                if (iPlayerScore == iHouseScore) 
                {
                    // Tie. This is called a "push."
                    cout << "**** Tie!!! ****" << endl;
                    PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
                } else if (iPlayerScore > iHouseScore) 
                {
                    // The Player wins
                    cout << "**** The Player Wins!!! ****" << endl;
                    PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
                } else 
                {
                    // The House wins
                    cout << "**** The House Wins!!! ****" << endl;
                    PrintScoresAndHands(iaHouseHand, iHouseDealtCards, iaPlayerHand, iPlayerDealtCards);
                }
            }
        }
    }
    return EXIT_SUCCESS;
}

void Cardshuffle(bool DealtCards[]) 
{
    for (int iIndex = 0; iIndex < 52; ++iIndex) 
    {
        DealtCards[iIndex] = false;
    }
}

    {
        void PrintCard(int iCard) 
        {                           // Print Rank
            const int kiRank = (iCard % 13);
        if (kiRank == 0) 
        {
            cout << 'A';
        } else if (kiRank < 9) 
            {
            cout << (kiRank + 1);
        } else if (kiRank == 9) 
            {
            cout << 'T';
        } else if (kiRank == 10) 
            {
            cout << 'J';
        } else if (kiRank == 11)
            {
            cout << 'Q';
        } else 
            {
            cout << 'K'; }                        // Print Suit
        }


        {
    const int kiSuit = (iCard/13);

    if (kiSuit == 0) 
        cout << '\x05';
     else if (kiSuit == 1) // clubs
    {
        cout << '\x04';
    } else if (kiSuit == 2)  //diamonds
    {
        cout << '\x03';       //hearts
    } else {
        cout << '\x06';       //spades
    }
    }

void PrintHand(int iaHand[], const int ConsDealtCard) 
{
    for (int iCardIndex = 0; iCardIndex < ConsDealtCard; ++iCardIndex) 
    {
        const int kiNextCard = iaHand[iCardIndex];
        PrintCard(kiNextCard);
        cout << " ";
    }
    cout << endl;
}

int GetNextCard(bool DealtCards[])
{
    bool bCardDealt = true;
    int iNewCard    = -1;
    do 
    {
        iNewCard = (rand() % 52);
        if (!DealtCards[iNewCard]) 
        {
            bCardDealt = false;
        }
    } while (bCardDealt);
    return iNewCard;
}

int ScoreHand(int iaHand[], const int ConsDealtCard) 
{
    int iAceCount   = 0;
    int iScore      = 0;
    for (int iCardIndex = 0; iCardIndex < ConsDealtCard; ++iCardIndex) 
    {
        const int kiNextCard = iaHand[iCardIndex];
        const int kiRank = (kiNextCard % 13);
        if (kiRank == 0)
        {
            ++iAceCount;
            ++iScore;
        } else if (kiRank < 9) 
        {
            iScore = iScore + (kiRank + 1);
        } else 
        {
            iScore = iScore + 10;
        }
    }
    while (iAceCount > 0 && iScore < 12) 
    {
        --iAceCount;
        iScore = iScore + 10;

    }
    system ("pause");
    return iScore;
}

    void PrintScoresAndHands(int iaHouseHand[], const int kiHouseDealtCards, int iaPlayerHand[], const int kiPlayerDealtCards) 
            {

                    cout << "House's Hand: Score = " << ScoreHand(iaHouseHand, kiHouseDealtCards) << endl;
                    PrintHand(iaHouseHand, kiHouseDealtCards);
                    cout << "Player's Hand: Score = " << ScoreHand(iaPlayerHand, kiPlayerDealtCards) << endl;
                    PrintHand(iaPlayerHand, kiPlayerDealtCards);
                    cout << endl;
                    }
        system ("pause");
    return 0;
        }

The former is straightfoward: on line 163, at the end of the game() function, you have the statement

 return EXIT_SUCCESS;

Now, since the game() function is declared as returning void - that is, no value - returning anything is an error. This should be simply

return;

or even just omitted entirely (void functions return implicitly).

The latter is also fiarly simple. On the line of the reported error, you have an extraneous left brace, before any functions. You can simply remove this brace to fix the problem.

Oh, I would recommend using whatever auto-indent program comes with your IDE, as it should highlight some of the problems you've been having.

so i got that all to work finally the other day, and i wanted the ability to quit the game to go back to the menu system, i have used the code

char cplayagain;
    cout << "Play Again ? (y or n)";
            cin >> cplayagain;
            if (cplayagain == 'y') 
            {
                game();
            } 
            else if (cplayagain == 'n') 
            {
                return MenuSystem();
            } 

            cout << endl;

at the end of the game routine but its not appearing when running the game, should it be somewhere else or am i doing it wrong :S ?

thanks for your help again, i swear i will get this one day

it appears for some reason the above will not show up until the help menu is selected from the main menu at the start at the game and if i select no the code makes it go back to the main menu as it should, but the menu shows up twice, do you know what i should do now ? if you want me to upload the newer updated code with everything working with the errors just say.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.