Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,565 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,887 people online right now. Registration is fast and FREE... Join Now!




Erorr C2447 '{' Missing function header

 
Reply to this topicStart new topic

Erorr C2447 '{' Missing function header, I am trying to build an RPG Battle system

Chibi
11 Apr, 2008 - 06:30 AM
Post #1

New D.I.C Head
*

Joined: 11 Apr, 2008
Posts: 1

I am trying to build a battle program similar to most RPG's I am still not completely done with it yet but I was building it to check for erorrs and I keep getting the error stated above. If someone could help me that would be greatly appreciated. Also If someone could tell me how to use the random function I would appreciate it but I don't expect it since I can just find it on the net. Thank you all for your help.

CODE


#include<iostream>
using namespace std;
#include <string>
#include <iomanip>
#include <windows.h>
#include <dos.h>
int main (int argc, char * argv[]);
{

int Hero_HP;
int Hero_MP;
int Hero_AP;
int Hero_Strength;
int Hero_Dexterity;
int Hero_Intellegence;
int Hero_Attack;
int Hero_Defense;
int Hero_Accuracy;
int Potion_Inventory;
int Battle;

      while (Battle = 1);
      {
            if (Battle = 1 )
            
            {cout << "Your Options are " << '\n';
            cout << "Attack - 1" << '\n';
            cout << "Item - 2" << '\n';
            }

            if (Hero_Class == 1)
            {
                cout << "3 - Whirl Wind Attack";
                cout << "         This Attack will strike all the Enemies MP Cost: 5" << '\n';
                cout << "4 - Wild Swing" << '\n';
                cout << "         Attack with low accurracy but if it hits will do critical damage MP Cost: 5" << '\n';
            }
            if (Hero_Class == 2)
            {
                cout << "3 - Hide" << '\n';
                cout << "          Makes player harder to hit for 5 turns MP Cost: 5" << '\n';
            }
            if (Hero_Class == 3)
            {
                cout << "Cure Light wounds - 3" << '\n';
                cout << "            Heals 20 HP MP Cost: 5" << '\n';
                cout << "Fireball - 4" << '\n';
                cout << "            Shoot fire to damage enemies MP Cost: 5 " << '\n';
                cout << "Energy Sheild - 5" << '\n';
                cout <<              "Armor temporally Increased for 5 Turns MP Cost: 5" << '\n';
                cout << "Firewall - 6" << '\n';
                cout <<              "Sightly increase defence, if hit enemy also delt damage MP Cost: 10";
            }
            Player_Select;
            cin >> Player_Choice;
            Enemy_Select:
            cout << "What Enemy do you want to hit ?";
            cin >> Enemy_Choice;
            if (Enemy_Choice == 1 && Enemy_HP_1 == 0)
            {
                cout << "That Enemy is dead please choose anouther";
                goto Enemy_Select
            }
            if (Enemy_Choice == 2 && Enemy_HP_2 == 0)
            {
                cout << "That Enemy is dead please choose anouther";
                goto Enemy_Select
            }
            if (Enemy_Choice == 3 && Enemy_HP_3 == 0)
            {
                cout << "That Enemy is dead please choose anouther";
                goto Enemy_Select
            }
            if (Hero_Class == 1)
            {
                cout << "Please choose the Enemy you want to strike";

                switch (Player_Choice)
                {
                case 1:
                
                if (Enemy_Choice == 1)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_1 + RANDOM NUMBER)
                    {
                        Enemy_HP_1 = Enemy_HP_1 - (3 *(1.5 * Current_Level);
                    }
                }
                if (Enemy_Choice == 2)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_2 + RANDOM NUMBER)
                    {
                        Enemy_HP_2 = Enemy_HP_2 - (3 *(1.5 * Current_Level);
                    }
                }
                if (Enemy_Choice == 3)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_3 + RANDOM NUMBER)
                    {
                        Enemy_HP_3 = Enemy_HP_3 - (3 *(1.5 * Current_Level);
                    }
                }
                break;
                case 2:
                if (Item_Choice == 1)
                
                break;

                case 3:
                Enemy_HP_1 = Enemy_HP_1 - (3 *(1.25 * Current_Level);

                Enemy_HP_2 = Enemy_HP_2 - (3 *(1.25 * Current_Level);

                Enemy_HP_3 = Enemy_HP_3 - (3 *(1.25 * Current_Level);
                break;

                case 4:
                if (Enemy_Choice == 1)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER - 5) > (Enemy_Dexterity_1 + RANDOM NUMBER)
                    {
                        Enemy_HP_1 = Enemy_HP_1 - (3 *(2 * Current_Level);
                    }
                }
                if (Enemy_Choice == 2)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER - 5) > (Enemy_Dexterity_2 + RANDOM NUMBER)
                    {
                        Enemy_HP_2 = Enemy_HP_2 - (3 *(2 * Current_Level);
                    }
                }
                if (Enemy_Choice == 3)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER - 5) > (Enemy_Dexterity_3 + RANDOM NUMBER)
                    {
                        Enemy_HP_3 = Enemy_HP_3 - (3 *(2 * Current_Level);
                    }
                }
                }
            }
            if (Hero_Class == 2)
            {
                switch (Player_Choice)
                {
                case 1:
                
                if (Enemy_Choice == 1)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_1 + RANDOM NUMBER)
                    {
                        Enemy_HP_1 = Enemy_HP_1 - (3 *(1.5 * Current_Level);
                    }
                }
                if (Enemy_Choice == 2)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_2 + RANDOM NUMBER)
                    {
                        Enemy_HP_2 = Enemy_HP_2 - (3 *(1.5 * Current_Level);
                    }
                }
                if (Enemy_Choice == 3)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_3 + RANDOM NUMBER)
                    {
                        Enemy_HP_3 = Enemy_HP_3 - (3 *(1.5 * Current_Level);
                    }
                }
                
                break;
                case 2:
                if (Item_Choice == 1)
                break;
                case 3:
                    hide = 5;
                break;
            }
                }
            if (Hero_Class == 3)
            {
            switch (Player_Choice)
                {
                case 1:
                
                if (Enemy_Choice == 1)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_1 + RANDOM NUMBER)
                    {
                        Enemy_HP_1 = Enemy_HP_1 - (3 *(1.5 * Current_Level);
                    }
                }
                if (Enemy_Choice == 2)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_2 + RANDOM NUMBER)
                    {
                        Enemy_HP_2 = Enemy_HP_2 - (3 *(1.5 * Current_Level);
                    }
                }
                if (Enemy_Choice == 3)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_3 + RANDOM NUMBER)
                    {
                        Enemy_HP_3 = Enemy_HP_3 - (3 *(1.5 * Current_Level);
                    }
                }
                break;
                case 2:
                if (Item_Choice == 1)
                break;
                case 3:
                Hero_HP = Hero_HP + 20;
                break;
                case 4:
                if (Enemy_Choice == 1)
                {
                    if ( (Hero_Dexterity + RANDOM NUMBER) > (Enemy_Dexterity_1 + RANDOM NUMBER)
                    {
                        Enemy_HP_1 = Enemy_HP_1 - (3 *(1.5 * Current_Level);
                    }
                }
                if (Enemy_Choice == 2)
                {
                        Enemy_HP_2 = Enemy_HP_2 - (3 *(1.5 * Current_Level);
                }
                if (Enemy_Choice == 3)
                {
                        Enemy_HP_3 = Enemy_HP_3 - (3 *(1.5 * Current_Level);
                }
                break;
                case 5:
                    Energy_Sheild = 5;
                break;
                case 6:
                    Energy_Sheild = 5;
                break;
            }
            }
            Enemy1(ATTACKS)
            Enemy2(ATTACKS)
            Enemy3(ATTACKS)
        End If
    if (Enemy_1_HP = 0 & Enemy_2_HP = 0 & Enemy_3_HP = 0)
    {
        Battle = 0
    }
    }
    }


User is offlineProfile CardPM
+Quote Post

jeronimo0d0a
RE: Erorr C2447 '{' Missing Function Header
11 Apr, 2008 - 07:10 AM
Post #2

D.I.C Head
**

Joined: 3 Mar, 2008
Posts: 141


My Contributions
Two things to get you started. First, remove the ; at the end of the line main(......) ; Then you will find a lot of undeclared variables in your error messages but they're a lot easier to find and fix. Then be aware that none of your variables are initialized. ex.
CODE

int Battle_Mode = ?;
int soldiers_on_field = 4;

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 11:50PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month