1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lookover this code please

Discussion in 'C++' started by minipwn, Jun 28, 2007.

  1. minipwn

    minipwn New Member

    Joined:
    Jun 28, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    // This is the main DLL file.
    #include <iostream>
    #include "stdafx.h"
    //Battle Sequence Start
    #include "Seventh kingdom.h"
    #define character Elf
    #define HP 100
    #define MP 50
    #define spell 20
    #define enemy 100
    #define enemyHIT 20
    #define attack 10
    #define potion 1
    #define heal HP
    void character()
    {
    	cout << "Welcome\n" character;
    }
    int enemy()
    {
    	cout << "The Spider has " << enemy << "HP \n";
    }
    int attack()
    {
    	int z,a,s,r;
    	cout << "Choose. attack or heal: " ;
    		cin >> z;
    		if (z=attack)
    		cout << "\nyou hit enemy for " << attack '\n';
    		cout << "enemy hits you for " << enemyHIT '\n';
    		enemy-attack= a
    			a = new (nothrow) int [a];
    		cout << "the enemy now has " << enemy << "hp left\n";
    		cout << "and you have " << HP << "hp left\n";
    		else (z=heal)
    			cout << "you heal for " << heal << "hp\n";
    		    cout << "enemy hits you for " << enemyHIT << "hp";
    			heal + hp - enemyHIT = s;
    				s = new (nothrow) int [s];
    
    return 0;
    }

    this is a test sequence for a battle

    ------ Build started: Project: Seventh kingdom, Configuration: Debug Win32 ------
    Compiling...
    Seventh kingdom.cpp
    .\Seventh kingdom.cpp(17) : error C2065: 'cout' : undeclared identifier
    .\Seventh kingdom.cpp(17) : error C2146: syntax error : missing ';' before identifier 'Elf'
    .\Seventh kingdom.cpp(17) : warning C4551: function call missing argument list
    .\Seventh kingdom.cpp(19) : warning C4091: '' : ignored on left of 'int' when no variable is declared
    .\Seventh kingdom.cpp(19) : error C2143: syntax error : missing ';' before 'constant'
    .\Seventh kingdom.cpp(19) : error C2059: syntax error : 'constant'
    .\Seventh kingdom.cpp(20) : error C2143: syntax error : missing ';' before '{'
    .\Seventh kingdom.cpp(20) : error C2447: '{' : missing function header (old-style formal list?)
    .\Seventh kingdom.cpp(23) : warning C4091: '' : ignored on left of 'int' when no variable is declared
    .\Seventh kingdom.cpp(23) : error C2143: syntax error : missing ';' before 'constant'
    .\Seventh kingdom.cpp(23) : error C2059: syntax error : 'constant'
    .\Seventh kingdom.cpp(24) : error C2143: syntax error : missing ';' before '{'
    .\Seventh kingdom.cpp(24) : error C2447: '{' : missing function header (old-style formal list?)
    Build log was saved at "file://c:\Documents and Settings\kyless\My Documents\Visual Studio 2005\Projects\Seventh kingdom\Seventh kingdom\Debug\BuildLog.htm"
    Seventh kingdom - 10 error(s), 3 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    1
    Trophy Points:
    0
    To have the line #define character Elf you need to define the Elf as well. Do you have them in the .h files or what?
     

Share This Page