dumb error need help

This is a discussion on dumb error need help within the C++ Programming forums, part of the General Programming Boards category; I dont know why this error exists. Heres my code. Theres more about 4 files but this is the one ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    230

    dumb error need help

    I dont know why this error exists. Heres my code. Theres more about 4 files but this is the one with the error.
    Code:
    #ifndef GUARD_Stage1
    #define GUARD_Stage1
    #include <iostream>
    
    class Stage1
    {
    private:
    int wcount, ncount, scount, ecount;
    int west, north, south, east; //directions
    public:
    Stage1() : west(0),north (0),south(0),east (0), wcount(0), ncount(0), scount (0), ecount (0) // long constructor
    {}
    void int_wcount(); //count how many
    void int_ecount(); // times the 
    void int_scount(); // user 
    void int_ncount(); // went either direction
    void getarea(); // get users choice of destination
    void fight(); // if in a fight
    void win(); // if you win 
    void lose(); // if you lose
    };
    
    void Stage1::int_wcount() //error!!!!!!!!!!!!!!!!!!!!!
    { wcount++ }
    void Stage1::int_ecount()//error
    { ecount++ }
    void Stage1::int_scount()//error
    { scount++ }
    void Stage1::int_ncount()//error
    { ncount++ }
    void Stage1::getarea()
    {
        int areach = 0;
        cout << " Choose your destination(1,2,3,4)"<<endl;
        cout << " 1: West "<<endl;
        cout << " 2: East "<<endl;
        cout << " 3: South  "<<endl;
        cout << " 4: North "<<endl;
        cin.ignore( 10, '\n' );
        if( !cin.good( ) ) {
        cout << "Error?!" << endl;// here
        cout << areach << endl;// here
        }
        switch (areach)
        {    
            case 1:
            void Stage1::int_wcount();
            break;
            case 2:
            void Stage1::int_ecount();
            break;
            case 3:
            void Stage1::int_scount();
            break;
            case 4:
            void Stage1::int_ncount();
            break;
            default:
            cout <<"error sorry";
            break;
         }
    }
    void Stage1::fight()
    {   
        int youdam; //users damage
        int totdam; //total damage
        int fch; // for switch
        cout << "You have entered a battle";
        cout << "1)punch";
        cout << "2)kick";
        cout << "3)defend";
        switch (fch)
        {
            case 1:
            cout << "you have punched 10 damage";
            totdam - 10;
            youdam - 5;
            break;
            case 2:
            cout <<"you have kicked 5 damage";
            totdam - 5;
            youdam - 10;
            break;
            case 3:
            cout <<"you defend, lose 5 damage";
            youdam - 5;
            break;
            default:
            cout <<"error";
            break;
        }
        
    }
    #endif
    Here are my compiler errors
    ------------------------------------------------------------------------------------
    5 C:\Dev-Cpp\Main.cpp
    In file included from Main.cpp
    C:\Dev-Cpp\Stage1.h
    In method `void Stage1::int_wcount()':
    24 C:\Dev-Cpp\Stage1.h
    parse error before `}'
    C:\Dev-Cpp\Stage1.h
    In method `void Stage1::int_ecount()':
    26 C:\Dev-Cpp\Stage1.h
    parse error before `}'
    C:\Dev-Cpp\Stage1.h
    In method `void Stage1::int_scount()':
    28 C:\Dev-Cpp\Stage1.h
    parse error before `}'
    C:\Dev-Cpp\Stage1.h
    In method `void Stage1::int_ncount()':
    30 C:\Dev-Cpp\Stage1.h
    parse error before `}'
    C:\Dev-Cpp\Makefile.win
    [Build Error] [Main.o] Error 1
    ------------------------------------------------------------------------------------
    If you guys need the whole code ill post it. Let me know
    thx for your help.
    C++ Rules!!!!
    ------------
    Microsoft Visual Studio .NET Enterprise

  2. #2
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Aren't you forgetting a semicolon ';' in in wcount++,ecount++,
    scount++ and ncount++ ??

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    230
    but i dont put any on any of my other functions. i thought they dont go there. and i tried putting semicolons all over. it doesnt work. someone help!!!
    C++ Rules!!!!
    ------------
    Microsoft Visual Studio .NET Enterprise

  4. #4
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    you forgot the semicolons in your member function definitions IE:

    void Stage1::int_wcount()
    { wcount++; } // Add the semicolon to all of the ones like this

    also, in the fight sequence you're not initializing any of the variables you use, and for the places where it appears you're trying to subtract life, you should use -= not -

    IE:

    totdam - 10; // This doesn't really do anything with the resulting value

    totdam -=10;// subtracts 10 from totdam and stores t back to totdam

  5. #5
    Registered User
    Join Date
    Jun 2002
    Posts
    230
    Thx man. Your always there to help. and thx for the other help to. i cant believe i made another stupid mistake.
    C++ Rules!!!!
    ------------
    Microsoft Visual Studio .NET Enterprise

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dumb I/O Performance Question
    By BENCHMARKMAN in forum C Programming
    Replies: 18
    Last Post: 02-24-2008, 06:26 AM
  2. am I dumb?
    By Carp in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 01-30-2003, 06:42 PM
  3. Dumb Terminals
    By samudrala_99 in forum Linux Programming
    Replies: 2
    Last Post: 08-08-2002, 05:10 PM
  4. dumb beckham joke for stevey
    By C_Coder in forum A Brief History of Cprogramming.com
    Replies: 44
    Last Post: 06-08-2002, 09:23 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21