Error: Expected declaration before '}' Token

Hello, I am working on a basic text based RPG. Today I was working on the Level generation (PlayerArea) text, but when I compiled to test, I got two errors.


|121|error: expected unqualified-id before 'return'|
|122|error: expected declaration before '}' token|

If it helps, I am using the Code::Blocks IDE with the GNU GCC compiler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <iostream>
#include <string>
#include <stdio.h>
#include <cstdlib>

using namespace std;
bool GameWindowState = 1;
bool GameStarted = 0;
void GameTitleFnc();
void NewGameFnc();
// int InGameStatMenu(PlayerStats, PlayerMoney, PlayerGender);
short UserInput;
int PlayerArea = 0;
int PlayerStats[3] = {20, 5, 5};
int PlayerMoney = 0;
string NameString;
string PlayerGender;

int main()
{
    GameTitleFnc();
    while (GameWindowState)
    {
        if (PlayerArea == 1)
        {
            int AreaOneOb1 = 15;
            if (GameStarted == 0)
            {
                system("CLS");
                cout << "You awaken to the sound of bubbling water flowing through a quiet creek to your right.\n"
                "'Where am I???' you think to yourself. You stand up and take in your surroundings.\n"
                "You are standing in a small clearing, next to a stream, there is a beaten path leading to the north\n"
                "and another to the east. You notice a small bag sitting next to a nearby rotted log\n\n";
                cout << "1. Go North\n2. Go East\n3. Inspect Bag\n";
                cin >> UserInput;
                GameStarted = 1;
                if (UserInput == 0)
                {

                }
                else if (UserInput == 1)
                {
                    PlayerArea = 2;
                }
                else if (UserInput == 2)
                {
                    PlayerArea = 4;
                }
                else if (UserInput == 3)
                {
                    if (AreaOneOb1 > 0);
                    {
                        cout << "You walk over and cautiously open the bag, you find 15 gold coins inside\n\n";
                        cout << "1. Take Coins\n2. Leave Bag Alone\n";
                        cin >> UserInput;
                        if (UserInput == 1)
                        {
                            AreaOneOb1 = AreaOneOb1 - 15;
                        }
                    }
                }
                    else if (AreaOneOb1 == 0)
                    {
                        cout << "The Bag is empty\n\n1. Return\n";
                        cin >> UserInput;
                    }
                }

            }
            else
            {
                cout << "You are standing in a small clearing, next to a stream, there is a beaten path leading to the north\n"
                "and another to the east. You notice a small bag sitting next to a nearby rotted log\n\n";
            }
        }
        if (PlayerArea == 2)
        {

        }
        else if (PlayerArea == 3)
        {

        }
        else if (PlayerArea == 4)
        {

        }
        else if (PlayerArea == 5)
        {

        }
        else if (PlayerArea == 6)
        {

        }
        else if (PlayerArea == 7)
        {

        }
        else if (PlayerArea == 8)
        {

        }
        else if (PlayerArea == 9)
        {

        }
        else if (PlayerArea == 10)
        {

        }
        else if (PlayerArea == 11)
        {

        }
        else if (PlayerArea == 12)
        {

        }
    }
    return 0;
}
You have exactly one extra left-opening brace. Line 61. Also, this is the perfect program for using switches, so you don't run into the same issue again.
Wow, thanks. I can't believe I didnt catch that. Also, using swithcases is an awesome idea!!!
Thanks,
Thewitchking15
Topic archived. No new replies allowed.