Hey there,

I am new to DaniWeb. This site is great! I would really appreciate it if someone would answer a question regarding three errors that this code generates. I have tried for a long time to make this text-based C++ RPG work. I got it down to just three errors but I can't seem to fix them. I am pretty sure they have to do with the brackets, but I am not totally sure. I am still getting better at C++, so please go easy on me. Any help would be greatly appreciated! Here are the errors:

C:\Documents and Settings\Owner\Desktop\EPIC.c||In function `int main()':|
C:\Documents and Settings\Owner\Desktop\EPIC.c|798|error: expected `while' before numeric constant|
C:\Documents and Settings\Owner\Desktop\EPIC.c|798|error: expected `(' before numeric constant|
C:\Documents and Settings\Owner\Desktop\EPIC.c|798|error: expected `)' before ';' token|
||=== Build finished: 3 errors, 0 warnings ===|

They all seem to be on the same line (798). It really is making no sense lol. There has to be an obvious answer to this problem that I am just not seeing. Thanks again!

-CoderRyne

PS. The reason I posted the entire code is because I am not sure if a different line in the code is causing this.

//This text based game was created by Ryne Thiel. DO NOT COPY.
//COLORS:
/*
1: Dark Blue
2: Dark Green
3: Dark Light Blue
4: Dark Red
5: Dark Dark Pink
6: Dark Yellow
7: Dark White
9: Light Blue
10: Light Green
11: Light Blue
12: Light Red
13: Light Pink
14: Light Yellow
15: Light White
*/

#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <windows.h>
#include <conio.h>
#include <cstdlib>
#include <string>
#include <cctype>
#include <ctime>

//User and creature declaration
struct User
{
int level;
int health;
int weaponid;
int money;
int xptillnextlevel;
} Player;

struct UnkownCreatureOne
{
int level;
int health;
int weaponid;
int moneyworth;
int xpworth;
} CreatureOne;

struct UnkownCreatureTwo
{
int level;
int health;
int weaponid;
int moneyworth;
int xpworth;
} CreatureTwo;

struct UnkownCreatureThree
{
int level;
int health;
int weaponid;
int moneyworth;
int xpworth;
} CreatureThree;

struct UnkownCreatureFour
{
int level;
int health;
int weaponid;
int moneyworth;
int xpworth;
} CreatureFour;

struct UnkownCreatureFive
{
int level;
int health;
int weaponid;
int moneyworth;
int xpworth;
} CreatureFive;

struct UnkownCreatureSix
{
int level;
int health;
int weaponid;
int moneyworth;
int xpworth;
} CreatureSix;

struct UnkownCreatureSeven
{
int level;
int health;
int weaponid;
int moneyworth;
int xpworth;
} CreatureSeven;

//Weapon (user) Declaration
struct UserWeaponIdOne
{
int levelneeded;
int cost;
int bought;
int weaponid;
int damage;
} Fist;

struct UserWeaponIdTwo
{
int levelneeded;
int cost;
int bought;
int weaponid;
int damage;
} Knife;

struct UserWeaponIdThree
{
int levelneeded;
int cost;
int bought;
int weaponid;
int damage;
} Colt;

struct UserWeaponIdFour
{
int levelneeded;
int cost;
int bought;
int weaponid;
int damage;
} Chainsaw;

struct UserWeaponIdFive
{
int levelneeded;
int cost;
int bought;
int weaponid;
int damage;
} UZI;

struct UserWeaponIdSix
{
int levelneeded;
int cost;
int bought;
int weaponid;
int damage;
} AK47;

struct UserWeaponIdSeven
{
int levelneeded;
int cost;
int bought;
int weaponid;
int damage;
} RocketLauncher;

//Weapon (unkown) declaration
struct UnkownWeaponIdOne
{
int levelneeded;
int cost;
int weaponid;
int damage;
} WeakLaserGun;

struct UnkownWeaponIdTwo
{
int levelneeded;
int cost;
int weaponid;
int damage;
} DullClaws;

struct UnkownWeaponIdThree
{
int levelneeded;
int cost;
int weaponid;
int damage;
} LongPike;

struct UnkownWeaponIdFour
{
int levelneeded;
int cost;
int weaponid;
int damage;
} SharpClaws;

struct UnkownWeaponIdFive
{
int levelneeded;
int cost;
int weaponid;
int damage;
} LaserRifle;

struct UnkownWeaponIdSix
{
int levelneeded;
int cost;
int weaponid;
int damage;
} LaserAssaultRifle;

struct UnkownWeaponIdSeven
{
int levelneeded;
int cost;
int weaponid;
int damage;
} RYNO;

using namespace std;
int main ( ) {

//Structure variables:
//User:
Player.level = 1;
Player.health = 7;
Player.xptillnextlevel = 5;
Player.money = 0;
Player.weaponid = 1;
//CreatureOne:
CreatureOne.level = 1;
CreatureOne.health = 3;
CreatureOne.weaponid = 9;
CreatureOne.moneyworth = 10;
CreatureOne.xpworth = 5;
//CreatureTwo:
CreatureTwo.level = 2;
CreatureTwo.health = 7;
CreatureTwo.weaponid = 8;
CreatureTwo.moneyworth = 15;
CreatureTwo.xpworth = 10;
//CreatureThree:
CreatureThree.level = 3;
CreatureThree.health = 12;
CreatureThree.weaponid = 9;
CreatureThree.moneyworth = 20;
CreatureThree.xpworth = 13;
//CreatureFour:
CreatureFour.level = 4;
CreatureFour.health = 15;
CreatureFour.weaponid = 10;
CreatureFour.moneyworth = 25;
CreatureFour.xpworth = 16;
//CreatureFive:
CreatureFive.level = 5;
CreatureFive.health = 19;
CreatureFive.weaponid = 11;
CreatureFive.moneyworth = 40;
CreatureFive.xpworth = 20;
//CreatureSix:
CreatureSix.level = 6;
CreatureSix.health = 24;
CreatureSix.weaponid = 12;
CreatureSix.moneyworth = 65;
CreatureSix.xpworth = 25;
//CreatureSeven:
CreatureSeven.level = 7;
CreatureSeven.health = 30;
CreatureSeven.weaponid = 13;
CreatureSeven.moneyworth = 100;
CreatureSeven.xpworth = 30;
//User Weapons:
//Fist:
//Knife:
Knife.levelneeded = 2;
Knife.cost = 10;
Knife.bought = 0;
Knife.weaponid = 2;
Knife.damage = 3;
//Colt:
Colt.levelneeded = 3;
Colt.cost = 35;
Colt.bought = 0;
Colt.weaponid = 3;
Colt.damage = 6;
//Chainsaw:
Chainsaw.levelneeded = 4;
Chainsaw.cost = 60;
Chainsaw.bought = 0;
Chainsaw.weaponid = 4;
Chainsaw.damage = 9;
//UZI:
UZI.levelneeded = 5;
UZI.cost = 100;
UZI.bought = 0;
UZI.weaponid = 5;
UZI.damage = 12;
//AK47:
AK47.levelneeded = 6;
AK47.cost = 200;
AK47.bought = 0;
AK47.weaponid = 6;
AK47.damage = 16;
//RocketLauncher:
RocketLauncher.levelneeded = 7;
RocketLauncher.cost = 1000;
RocketLauncher.bought = 0;
RocketLauncher.weaponid = 7;
RocketLauncher.damage = 20;
//Creature Weapoons:
//WeakLaserGun:
WeakLaserGun.levelneeded = 1;
WeakLaserGun.weaponid = 8;
WeakLaserGun.damage = 1;
//DullClaws:
DullClaws.levelneeded = 2;
DullClaws.weaponid = 9;
DullClaws.damage = 3;
//LongPike:
LongPike.levelneeded = 3;
LongPike.weaponid = 10;
LongPike.damage = 5;
//SharpClaws:
SharpClaws.levelneeded = 4;
SharpClaws.weaponid = 11;
SharpClaws.damage = 8;
//LaserRifle
LaserRifle.levelneeded = 5;
LaserRifle.weaponid = 12;
LaserRifle.damage = 12;
//LaserAssaultRifle:
LaserAssaultRifle.levelneeded = 5;
LaserAssaultRifle.weaponid = 13;
LaserAssaultRifle.damage = 15;
//RYNO:
RYNO.levelneeded = 7;
RYNO.weaponid = 14;
RYNO.damage = 20;

//Game variables:
int play_or_learn;
//Ask if the user wants to play the game or learn how to play.
int play;
//When the user finishes learning how to play the game, they will be prompted to type in '1' to start the game.
int attack;
//Take your attack turn.
int bought;
//If the user bought the weapon
int attack_type;
int buy_weapon;

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
cout << "Welcome to Tavlon, the text based C++ RPG! Type in the number '1' to learn how to play. Type in the number '2' to play." << endl;

do
{
cin >> play_or_learn;
if(play_or_learn == 1)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
cout << "So you want to learn how to play eh? Well before I tell you, keep in mind that abusing this RPG (as there are obviously bugs) will not effect anyone but you. So do what you want with abusing bugs. Here is how:\n\n" << endl;
cout << "Now that you know how to play, type the number '1' to start!" << endl;
do
{
    cin >> play;
    if (play == 1)
    {
    }
        else
        {
            cout << "Type in '1'!" << endl;
        }
}
while (play < 1 && play > 1);
}
else if (play_or_learn < 1 || play_or_learn > 2)
{
    cout << "Please type in the number one or two, to continue." << endl;
}
else if(play_or_learn == 2)
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
    cout << "The game has begun. Please wait a minute while the intro runs through. Good luck!\n\n" << endl;
    Sleep(1000);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 6);
    cout << "*While you are knocked-out, your friends talk about you, Andy. You sleeping on a bed in a small apartment while a huge war is going on between the humans, and the unknown, who have infected our race. You may not know it yet, but it will be up to you to save the human race, and restore peace to Earth. That is, if no more nuclear bombs hit.*\n" << endl;
    Sleep(1000);
    cout << "Kara: Hes still sleeping.\n" << endl;
    Sleep(1000);
    cout << "Christopher: I hope he will be alright. He has a hell of a concussion...\n" << endl;
    Sleep(1000);
    cout << "Kara: Poor Andy *frowns*\n" << endl;
    Sleep(1000);
    cout << "Christopher: We need to get him a doctor, hes going cold!\n" << endl;
    Sleep(1000);
    cout << "Mark: Where are we supposed to find him a doctor?! We are in the middle of a war! Christopher, you never think do you?\n" << endl;
    Sleep(1000);
    cout << "Aco: No worries. I have a friend who works in a bar just fifteen minutes away from here. She has medical skills, and should be able to help. Shes also one of the toughest people I have ever met.\n" << endl;
    Sleep(1000);
    cout << "Mark: Aco... I don't think-\n" << endl;
    Sleep(1000);
    cout << "Kara: I think we can make it. But how are we supposed to carry Andy, or even get there without getting killed? Bombs are going off everywhere... speaking of which, they are starting to hit the homes near us. If we wan't to move, we need to move now.\n" << endl;
    Sleep(1000);
    cout << "Aco: Kara is right. We should make our move. Radio signals are down; that can't be good.\n" << endl;
    Sleep(1000);
    cout << "Christopher: I have a bad feeling about this guys. *Makes worried look*\n" << endl;
    Sleep(1000);
    cout << "Mark: Christopher, my brother, do not worry. You are only 15, and I know that you have a long time ahead of you in life. That is, unless another nuke goes off, or we get killed. But what are the chances of that? Chicago will live on, I assume. Though, I never thought that the year 2418 would turn out like this.\n" << endl;
    Sleep(1000);
    cout << "Kara: Um... what was that?...\n" << endl;
    Sleep(1000);
    cout << "Aco: EVERYBODY DOWN!!!\n" << endl;
    Sleep(1000);
    cout << "*Bomb blows the apartment into chuncks*\n" << endl;
    Sleep(1000);
    cout << "Kara: Is everyone alright?\n" << endl;
    Sleep(1000);
    cout << "Mark: Ugh, yeah, we are fine. Looks like our cover is blown. We gotta move NOW. Christopher, carry Andy. Here are some weapons for you guys. Follow my lead!\n" << endl;
    Sleep(1000);
    cout << "*The resistance group makes it to the bar within twenty minutes. It took about five minutes extra, because Christopher was having trouble carrying Andy. Either way, the group still made it to the bar safely.\n" << endl;
    Sleep(1000);
    cout << "Aco: Hey Ashley. My friend here, Andy, needs medical attention fast. Hes not doing so hot. He was knocked-out by one of them. Luckily, we were able to save him, and bring him to you. Please help.\n" << endl;
    Sleep(1000);
    cout << "Ashley: Thanks for brining him, Aco. I will get him better. His head wound is not very bad. I can get him up in a minute. All we really need to do to get him up is pour water on his face. Believe it or not, it works like a charm. He will have major head pain when he wakes up though.\n" << endl;
    Sleep(1000);
    cout << "Aco: Do whatever it takes.\n" << endl;
    Sleep(1000);
    cout << "*Ashley Pours a pail full of water on Andy's face*\n" << endl;
    Sleep(1000);
    cout << "*Andy wakes up right away from the shock of the cold water and says:* HOLY CRAP MY HEAD HURTS! UGH! What happened?\n" << endl;
    Sleep(1000);
    cout << "Christopher: Hes back with us! *Smiles happily*\n" << endl;
    Sleep(1000);
    cout << "*Windows suddenly break, and foot steps are heard througout the basement*\n" << endl;
    Sleep(1000);
    cout << "Ashley: I don't like the sound of that. To the attic! Hurry!\n" << endl;
    Sleep(1000);
    cout << "*Unkown creature steps in front of you with a lazer gun*\n" << endl;
    Sleep(1000);
    cout << "*Gets ready to fight with own hands!*\n" << endl;
    Sleep(1000);

    do
    {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
    cout << "Type in '1' to get ready to attack!" << endl;
    cin >> attack;
    if (attack == 1)
    {
    cout << "Your current health is: " << Player.health << ", and your current level is: " << Player.level << ". You need a total of: " << Player.xptillnextlevel << " to get to the next level." << endl;
    cout << "--Actions:--" << endl;
    cout << "Please type in the number of the attack you wish to initiate against the unkown creature. The attacks availiable to you are listed below:" << endl;
    cout << "Your level: " << Player.level << " . Attacks you can use:" << endl;
    if (Player.level == 1)
    {
        if (Fist.bought == 1)
        {
            cout << "--Type '1' to use your fist." << endl;
        }
    }
    //////////\\\\\\\\\\
    else if (Player.level == 2)
    {
       if(Fist.bought == 1)
       {
        cout << "--Type '1' to use your fist." << endl;
       }
        if(Knife.bought == 1)
        {
        cout << "--Type '2' to use your Knife." << endl;
        }
    }
    //////////\\\\\\\\\\
    else if (Player.level == 3)
    {
        if(Fist.bought == 1)
        {
        cout << "--Type '1' to use your fist." << endl;
        }
        if(Knife.bought == 1)
        {
        cout << "--Type '2' to use your knife." << endl;
        }
        if(Colt.bought == 1)
        {
        cout << "--Type '3' to use your colt." << endl;
        }
    }
    //////////\\\\\\\\\\
   else if (Player.level == 4)
    {
        if(Fist.bought == 1)
        {
        cout << "--Type '1' to use your fist." << endl;
        }
        if(Knife.bought == 1)
        {
        cout << "--Type '2' to use your knife." << endl;
        }
        if(Colt.bought == 1)
        {
        cout << "--Type '3' to use your colt." << endl;
        }
        if(Chainsaw.bought == 1)
        {
        cout << "--Type '4' to use your Chainsaw." << endl;
        }
    }
     //////////\\\\\\\\\\
     else if (Player.level == 5)
     {
        if(Fist.bought == 1)
        {
        cout << "--Type '1' to use your fist." << endl;
        }
        if(Knife.bought == 1)
        {
        cout << "--Type '2' to use your knife." << endl;
        }
        if(Colt.bought == 1)
        {
        cout << "--Type '3' to use your colt." << endl;
        }
        if(Chainsaw.bought == 1)
        {
        cout << "--Type '4' to use your Chainsaw." << endl;
        }
        if (UZI.bought == 1)
        {
        cout << "--Type '5' to use your UZI." << endl;
        }
    }
    //////////\\\\\\\\\\
    else if (Player.level == 6)
    {
        if(Fist.bought == 1)
        {
        cout << "--Type '1' to use your fist." << endl;
        }
        if(Knife.bought == 1)
        {
        cout << "--Type '2' to use your knife." << endl;
        }
        if(Colt.bought == 1)
        {
        cout << "--Type '3' to use your colt." << endl;
        }
        if(Chainsaw.bought == 1)
        {
        cout << "--Type '4' to use your Chainsaw." << endl;
        }
        if (UZI.bought == 1)
        {
        cout << "--Type '5' to use your UZI." << endl;
        }
        if (AK47.bought == 1)
        {
        cout << "--Type '6' to use your AK47." << endl;
        }
    }
    //////////\\\\\\\\\\
    else if (Player.level == 7)
    {
       if(Fist.bought == 1)
        {
        cout << "--Type '1' to use your fist." << endl;
        }
        if(Knife.bought == 1)
        {
        cout << "--Type '2' to use your knife." << endl;
        }
        if(Colt.bought == 1)
        {
        cout << "--Type '3' to use your colt." << endl;
        }
        if(Chainsaw.bought == 1)
        {
        cout << "--Type '4' to use your Chainsaw." << endl;
        }
        if (UZI.bought == 1)
        {
        cout << "--Type '5' to use your UZI." << endl;
        }
        if (AK47.bought == 1)
        {
        cout << "--Type '6' to use your AK47." << endl;
        }
        if (RocketLauncher.bought == 1)
        {
        cout << "--Type '7' to use your Rocket Launcher." << endl;
        }
    }
    cin >> attack_type;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
    if (attack_type == 1)
    {
     if (Fist.bought == 1)
     {
            cout << "You attacked the creature with your fist, bringing it's health down: " << Fist.damage << " health points. The creature now has: " << CreatureOne.health - Fist.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    }
    }
    else if (attack_type == 2)
    {
       if (Knife.bought == 1)
    {
        cout << "You attacked the creature with your knife, bringing it's health down: " << Knife.damage << " health points. The creature now has: " << CreatureOne.health - Knife.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    }
    }
    else if (attack_type == 3)
    {
      if (Colt.bought == 1)
      {
            cout << "You attacked the creature with your colt, bringing it's health down: " << Colt.damage << " health points. The creature now has: " << CreatureOne.health - Colt.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    }
    }
    else if (attack_type == 4)
    {
    if (Chainsaw.bought == 1)
    {
        cout << "You attacked the creature with your chainsaw, bringing it's health down: " << Chainsaw.damage << " health points. The creature now has: " << CreatureOne.health - Chainsaw.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    }
    }
    else if (attack_type == 5)
    {
        if (UZI.bought == 1)
        {
        cout << "You attacked the creature with your UZI, bringing it's health down: " << UZI.damage << " health points. The creature now has: " << CreatureOne.health - UZI.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    }
    }
    else if (attack_type == 6)
    {
        if (AK47.bought == 1)
        {
        cout << "You attacked the creature with your AK47, bringing it's health down: " << AK47.damage << " health points. The creature now has: " << CreatureOne.health - AK47.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    }
    }
    else if (attack_type == 7)
    {
     if (RocketLauncher.bought == 1)
     {
        cout << "You attacked the creature with your rocket launcher, bringing it's health down: " << RocketLauncher.damage << " health points. The creature now has: " << CreatureOne.health - RocketLauncher.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    }
    }
        cout << "The level 1 unknown creature attacks you with it's weak laser gun, bringing your health down: " << WeakLaserGun.damage << " health points. You now have: " << Player.health - WeakLaserGun.damage << " health points left. You currently have: " << Player.health << " health left. You are currentlly level" << Player.level << ".\n" << endl;
    cout << "Type in '1' to take your next turn!\n" << endl;
    cin >> attack;
    }
    else
    {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 13);
    cout << "Error! You can only pick attacks from the list above!" << endl;
    }
if (Player.health < 1)
{
    cout << "The unkown creature has killed you! GAME OVER. Try again!\n" << endl;
}
else if (CreatureOne.health < 1)
{
    cout << "You have killed the level 1 unknown creature! Your health has been restored, and you have gained: " <<  CreatureOne.xpworth << " XP. You need: " << Player.xptillnextlevel << " XP before you will go to the next level. You had: " << Player.money << ". You now have: " << Player.money + CreatureOne.moneyworth << ". You are currently level: " << Player.level << ". Congratulations!" << endl;
    cout << "Weapon Store: " << endl;
    cout << "You have: " << Player.money << "$ to spend on weapons." << endl;
    cout << "Weapon: --Fist-- Status: --Bought--" << endl;
    if (Knife.bought == 1)
    {
        cout << "Weapon: --Knife-- Status: --Bought--" << endl;
    }
    else if (Knife.bought == 0)
    {
        cout << "Type '2' to buy the knife for 10$!" << endl;
        cin >> buy_weapon;
        if (buy_weapon == 2)
        {
         if (Player.money < Knife.cost)
         {
             cout << "You don't have enough money to make this purchase!" << endl;
         }
         else if (Player.money >= Knife.cost)
         {
         cout << "You have bought the knife!" << Knife.bought + 1 << Player.money - Knife.cost << endl;
        }
    }
    }
    if (Colt.bought == 1)
    {
        cout << "Weapon: --Colt-- Status: --Bought--" << endl;
    }
     else if (Colt.bought == 0)
    {
        cout << "Type '3' to buy the colt for 35$!" << endl;
        cin >> buy_weapon;
        if (buy_weapon == 3)
        {
         if (Player.money < Colt.cost)
         {
             cout << "You don't have enough money to make this purchase!" << endl;
         }
         else if (Player.money >= Colt.cost)
         {
         cout << "You have bought the colt!" << Colt.bought + 1 << Player.money - Colt.cost << endl;
        }
    }
    }
    if (Chainsaw.bought == 1)
    {
        cout << "Weapon: --Chainsaw-- Status: --Bought--" << endl;
    }
     else if (Chainsaw.bought == 0)
    {
        cout << "Type '4' to buy the chainsaw for 60$!" << endl;
        cin >> buy_weapon;
        if (buy_weapon == 4)
        {
         if (Player.money < Chainsaw.cost)
         {
             cout << "You don't have enough money to make this purchase!" << endl;
         }
         else if (Player.money >= Chainsaw.cost)
         {
         cout << "You have bought the chainsaw!" << Chainsaw.bought + 1 << Player.money - Chainsaw.cost << endl;
        }
    }
    }
    if (UZI.bought == 1)
    {
        cout << "Weapon: --UZI-- Status: --Bought--" << endl;
    }
     else if (UZI.bought == 0)
    {
        cout << "Type '5' to buy the UZI for 100$!" << endl;
        cin >> buy_weapon;
        if (buy_weapon == 5)
        {
         if (Player.money < UZI.cost)
         {
             cout << "You don't have enough money to make this purchase!" << endl;
         }
         else if (Player.money >= UZI.cost)
         {
         cout << "You have bought the UZI" << UZI.bought + 1 << Player.money - UZI.cost << endl;
        }
    }
    }
    if (AK47.bought == 1)
    {
        cout << "Weapon: --AK47-- Status: --Bought--" << endl;
    }
     else if (AK47.bought == 0)
    {
        cout << "Type '6' to buy the AK47 for 200$!" << endl;
        cin >> buy_weapon;
        if (buy_weapon == 6)
        {
        if (Player.money < AK47.cost)
         {
             cout << "You don't have enough money to make this purchase!" << endl;
         }
         else if (Player.money >= AK47.cost)
         {
         cout << "You have bought the AK47" << AK47.bought + 1 << Player.money - AK47.cost << endl;
        }
        }
    }
    if (RocketLauncher.bought == 1)
    {
        cout << "Weapon: --Roclet Launcher-- Status: --Bought--" << endl;
    }
     else if (RocketLauncher.bought == 0)
    {
        cout << "Type '7' to buy the rocket launcher for 1000$!" << endl;
        cin >> buy_weapon;
        if (buy_weapon == 7)
        {
         if (Player.money < RocketLauncher.cost)
         {
             cout << "You don't have enough money to make this purchase!" << endl;
         }
         else if (Player.money >= RocketLauncher.cost)
         {
         cout << "You have bought the rocket launcher!" << RocketLauncher.bought + 1 << Player.money - RocketLauncher.cost << endl;
        }
        }
    }
    else
    {
    cout << "Error! You either don't have enough money, or you already have the weapon! Try again!" << endl;
    }
}
while (Player.health > 0 && CreatureOne.health> 0);
    }
while (play_or_learn < 1 || play_or_learn > 2);
}
}
   return 0;
}

Errors like this are hard to see when your bracket alignment is all over the place.

The closing bracket before return 0; is the end of a "do {}" block, so its expecting a while statement.

On a more general note, you don't need to create all those identical structs with different names e.g, instead of WeaponOne, WeaponTwo, WeaponThree, write a single struct Weapon . writing a struct creates a data type, just like int, string, double, etc.

You could also do with breaking up your code a little using functions. a 700-line long main() function isn't much fun to look at; functions are there to let yoú write code once and repeat it however many times you like.

Hi Bench!

Thanks for your help. I would agree with you that my brackets are all over the place lol. I should comment more and have better spacing :P

I decided to use dozens of structs because I wanted to have different structs branching off of eachother. That way, I think its better to read and easier to understand. I mean, it works right? :P

And yes, I know what you mean about the 700-line long main() function. I will organize that soon haha.

Now, about the errors; you are saying I should add a while? I don't fully understand what you mean. Would you mind telling me exactly which line/s I should edit/add in things to? And if I should add a while loop, what 'do' would that be attached to? I thought that this was not the problem so now I am confused. Thanks again for your help!

-CoderRyne

The solution to your "do {} " problem is down to your own logic in the code. you can't write a "do{}" block on its own, so to fix it, you either need to remove do or you need to add a while statement.

The compiler pointed you to the correct line; In the place where you have return 0 its expecting while ( /* blah */ );. In other words the bracket before 'return' is the end of the "do" loop.

The fact that its there suggests you intended to repeat something, but only you could know what and why.


The structs aren't "branching off each other" - they're completely unrelated to each other, which is the problem. WeaponOne has no relation to WeaponTwo or WeaponThree, etc.

However, if you only had one Weapon struct, you could create as many Weapon objects as you like, and they'd all be related by the fact that they're all the same data type.
(That's where functions come in too - you can write a block of code which works for any Weapon object rather than just one Weapon object)


Maybe write some small toy programs to get an idea of how to use structs/functions - you will be able to see what's going on far more clearly.

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.