   Problem "Glueing" terms
#include <iostream> //#Includes begin#include <windows.h>//#Includes end#define mons(a,b) a ## b //Connect values directly together for choosing monsterHANDLE SymC = GetStdHandle(STD_OUTPUT_HANDLE);    //Enable windows text colors//mINIT begin  <-[CLASS] mINIT beginclass mINIT{public: void ATT(int Sup)  //Change main attack value {mATT = mATT + Sup;}    //Value + set amount void DEF(int Sup)  //Change main defense value {mDEF = mDEF + Sup;}    //Value + set amount void ACC(int Sup)  //Change main accuracy value {mACC = mACC + Sup;}    //Value + set amount void SPD(int Sup)  //Change main speed value {mSPD = mSPD + Sup;}    //Value + set amount void INT(int Sup)  //Change main intelligence value {mINT = mINT + Sup;}    //Value + set amount void HP(int Sup)   //Change main health points value {mHP = mHP + Sup;} //Value + set amount void MP(int Sup)   //Change main mana/magic points value {mMP = mMP + Sup;} //Value + set amount void transform(int Sup) //Change type value (For monster transformations) {mTYPE = mTYPE + Sup;}  //Value + set amount int mATT;//1 Attack int mDEF;//2 Defense int mACC;//3 Accuracy int mSPD;//4 Speed int mINT;//5 Intelligence int mHP; //6 Health Points int mMP; //7 Mana/Magic Points int mACS;//8 Access Number char mSYM;    //9 Symbol int mCOL;//10 Color char mNAME[30];    //11 Name int mTYPE;    //12 Type (0 Friendly, 1 Hostile, 2 Neutral, 3 Calm, 4+ Other)};//mINIT end    <-[CLASS] mINIT end//Declaring Monsters begin    <-Declaring Monsters begin (x = Finished, . = Not Finished)mINIT m1 = {3, 4, 5, 5, 2, 8, 0, 1, 'g', 2,"Goblin", 2};    //1 x Goblin gmINIT m2 = {4, 4, 3, 5, 3, 10, 0, 2, 'o', 10, "Orc", 2};    //2 x Orc omINIT m3 = {3, 3, 6, 5, 3, 6, 0, 3, 'g', 9, "Goblin Thrower", 2};//3 x Goblin Thrower gmINIT m4 = {4, 3, 6, 7, 4, 6, 0, 4, 'o', 2,"Orc Archer", 2};//4 x Orc Archer omINIT m5 = {5, 5, 2, 2, 1, 14, 0, 5, 'T', 7, "Troll", 2};   //5 x Troll TmINIT m6 = {2, 2, 4, 6, 3, 5, 0, 6, 'g', 6, "Hobgoblin", 2};//6 x Hobgoblin gmINIT m7 = {5, 4, 5, 4, 5, 8, 0, 7, 'h', 9,"Dwarf", 2};//7 x Dwarf hmINIT m8 = {4, 3, 4, 5, 5, 8, 0, 8, 'h', 14, "Dwarf Child", 2};  //8 x Dwarf Child hmINIT m9 = {4, 4, 4, 6, 1, 8, 0, 9, 'd', 7, "Jackal", 2};   //9 x Jackal dmINIT m10 = {5, 4, 4, 5, 4, 12, 0, 10, 'k', 10,"Kobold", 2};//10 x Kobold kmINIT m11 = {3, 3, 6, 6, 4, 8, 0, 11, 'k', 2, "Kobold Archer", 2};    //11 x Kobold Archer kmINIT m12 = {2, 2, 3, 6, 1, 5, 0, 4, 'r', 6, "Rat", 2};//12 x Rat r/*mINIT mGoblin = {3, 4, 5, 5, 2, 8, 0, 1, 'g', 2,"Goblin"};//13 . Goblin gmINIT mOrc = {4, 4, 3, 5, 3, 10, 0, 2, 'o', 10, "Orc"};//14 . Orc omINIT mGoblinThrower = {3, 3, 6, 5, 3, 6, 0, 3, 'g', 9, "Goblin Thrower"}; //15 . Goblin Thrower gmINIT mOrcArcher = {4, 3, 6, 7, 4, 6, 0, 4, 'o', 2,"Orc Archer"};//16 . Orc Archer omINIT mTroll = {5, 5, 2, 2, 1, 14, 0, 5, 'T', 7, "Troll"};  //17 . Troll TmINIT mHobgoblin = {2, 2, 4, 6, 3, 5, 0, 6, 'g', 6, "Hobgoblin"};//18 . Hobgoblin gmINIT mDwarf = {5, 4, 5, 4, 5, 8, 0, 7, 'h', 9,"Dwarf"};    //19 . Dwarf hmINIT mDwarfChild = {4, 3, 4, 5, 5, 8, 0, 8, 'h', 14, "Dwarf Child"}; //20 . Dwarf Child hmINIT mJackal = {4, 4, 4, 6, 1, 8, 0, 9, 'd', 7, "Jackal"}; //21 . Jackal dmINIT mKobold = {5, 4, 4, 5, 4, 12, 0, 10, 'k', 10,"Kobold"};    //22 . Kobold kmINIT mKoboldArcher = {3, 3, 6, 6, 4, 8, 0, 11, 'k', 2, "Kobold Archer"};  //23 . Kobold Archer kmINIT mRat = {2, 2, 3, 6, 1, 5, 0, 4, 'r', 6, "Rat"};  //24 . Rat r*///Declaring Monsters end <-Declaring Monsters endint main(){ using namespace std; for(int num = 1; num < 13; num++) {  cout << mons(m,(num)).mNAME << endl; } cin.get();} On the line that says:cout << mons(m,(num)).mNAME << endl;The mons is a preprocessor directive that should put "m" and the value num directly together to find a monster... But when i run, it says "'m' is undeclared", and when i try mons(m,num), then it just says "mnum" is undeclared... I just tried (num) but actually this is my first time testing the preprocessor thing... How can I get this to work?   
  Your current issue is that you're trying to mix runtime and compile time stuff which is why it's not working. ## uses the word 'num', not the value that will be stored in 'num' during program operation.But why don't you use an array for all your monsters? Or better yet something like this:std::vector<mINIT> monsters;Another issue: mINIT is a terrible name for that class. Why not Monster or Entity?Another issue: you use a char array inside mINIT for strings. You should use std::string. Especially since you already are doing something very bad. "Goblin Thrower" is well over 10 chars. mName is 10 chars. This will probably cause you some serious problems when you get your program to compile. Using std::string would solve that issue although it may prevent you from using block initialization (eg mInit m1 = {...};)That's all the big stuff I found. Hope this helps.edit: I thought mName was 10 chars, but I was wrong. It's 30. My point stands that in the long run it will be better to use std::string.   ;  Problem has been solved now... I decided to look up tables and heres what I ended up with:#include <iostream> //#Includes begin#include <string>#include <cstdlib>#include <windows.h>//#Includes endHANDLE SymC = GetStdHandle(STD_OUTPUT_HANDLE);    //Enable windows text colorsusing namespace std;//Monster begin<-[STRUCT] Monster beginstruct Monster { int mATT;//1 Attack int mDEF;//2 Defense int mACC;//3 Accuracy int mSPD;//4 Speed int mINT;//5 Intelligence int mHP; //6 Health Points int mMP; //7 Mana/Magic Points int mACS;//8 Access Number char mSYM;    //9 Symbol int mCOL;//10 Color string mNAME; //11 Name int mTYPE;    //12 Type (0 Friendly, 1 Hostile, 2 Neutral, 3 Calm, 4+ Other)  //Declaring Monster Table begin   <-Declaring Monster Table begin Monster(int att_,  int def_,  int acc_,  int spd_,  int int_,  int hp_, int mp_,  int acs_, char sym_,  int col_,  string name_,  int type_): mATT(att_), mDEF(def_), mACC(acc_), mSPD(spd_), mINT(int_), mHP(hp_), mMP(mp_), mACS(acs_), mSYM(sym_), mCOL(col_), mNAME(name_), mTYPE(type_){} //Declaring Monster Table begin   <-Declaring Monster Table end};    //Monster end  <-[STRUCT] Monster end  //Declaring Monsters begin    <-Declaring Monsters begin (x = Finished, . = Not Finished)Monster mons[] ={ Monster(3, 4, 5, 5, 2, 8, 0, 1, 'g', 2,"Goblin", 2),  //0 x Goblin g Monster(4, 4, 3, 5, 3, 10, 0, 2, 'o', 10, "Orc", 2),  //1 x Orc o Monster(3, 3, 6, 5, 3, 6, 0, 3, 'g', 9, "Goblin Thrower", 2),   //2 x Goblin Thrower g Monster(4, 3, 6, 7, 4, 6, 0, 4, 'o', 2,"Orc Archer", 2),   //3 x Orc Archer o Monster(5, 5, 2, 2, 1, 14, 0, 5, 'T', 7, "Troll", 2), //4 x Troll T Monster(2, 2, 4, 6, 3, 5, 0, 6, 'g', 6, "Hobgoblin", 2),   //5 x Hobgoblin g Monster(5, 4, 5, 4, 5, 8, 0, 7, 'h', 9,"Dwarf", 3),   //6 x Dwarf h Monster(4, 3, 4, 5, 5, 8, 0, 8, 'h', 14, "Dwarf Child", 3),//7 x Dwarf Child h Monster(4, 4, 4, 6, 1, 8, 0, 9, 'd', 7, "Jackal", 2), //8 x Jackal d Monster(5, 4, 4, 5, 4, 12, 0, 10, 'k', 10,"Kobold", 2),    //9 x Kobold k Monster(3, 3, 6, 6, 4, 8, 0, 11, 'k', 2, "Kobold Archer", 2),   //10 x Kobold Archer k Monster(2, 2, 3, 6, 1, 5, 0, 4, 'r', 6, "Rat", 2)//11 x Rat r};//Declaring Monsters end <-Declaring Monsters end ;  There are these things in C++ called containers. You should use them when you need to hold several things of the same type that have a related purpose in the code, e.g. all your monsters here. In C++, we do not generally get things done by trying to glue variable names together. This is because the variable names are only there to help the compiler, and do not exist in the final program. We cannot write code that puts together a variable name out of text and then looks up the variable with that name, because the variable is not actually "named" while the program is running.   ;  I have to agree with Concentrate: your coding style leaves something to be desired. Here's how I would do it:// ===============// Header fileenum Behavior{FRIENDLY,HOSTILE,NEUTRAL,CALM};class MonsterType{public:int attack;int defense;int accuracy;int speed;int intelligence;int hitpoints;int mana;int accessNumber;char symbol;int color;std::string name;Behavior behavior;// Constructor goes here};// ===============// Implementation filestd::map<std::string, MonsterType> monsterTypes;void loadMonsterTypes(){// You could load monster type data from a file here, but for this example, I'll hard-code them, like you did:monsterTypes["Goblin"] = MonsterType(3, 4, 5, 5, 2,  8, 0, 1, 'g',  2, "Goblin", NEUTRAL);monsterTypes["Orc"]    = MonsterType(4, 4, 3, 5, 3, 10, 0, 2, 'o', 10,    "Orc", NEUTRAL);// And so on.}Note the variable names: if you have to explain what they mean in comments, you're doing yourself a disservice, because the rest of the program will be hard to understand. Also, if you want to look up monster types at run-time, a map (or dictionary, as it's called in some languages) is a natural choice. In this case, using the name as a key seems like a fair approach. Also note how this approach makes it easy to load such data from a file, and to add monster types at run-time. As for monster behavior (type), I've used an enum, as it explains the intention much better.Good luck with your project. :)   ;  The only reason I used numbers for the type is because there will be the basic neutral calm and aggressive, but also because when I make bosses they will behave different. They might be the type that follow your character for a few steps but then get bored and wander, or they might randomly get ahead of you to block your path, or might hit you once, then let you attack it a few times before trying again. Also, for some reason writing out names completely seems to annoy me... I prefer everything abbreviated, I dont know why. It somehow makes things easier for me to read... I dont use the comments to explain what stuff means, just so when im skimming through code, I can see where everything begins/ends quicker to fix stuff.   ;Quote:Original post by MAGIgullorksAlso, for some reason writing out names completely seems to annoy me... I prefer everything abbreviated, I dont know why.It's because you don't have experience yet programming things that you can't keep entirely in your head. Try it with a 50,000 line program, maintained by a dozen different programmers with very different methodologies, that you last laid eyes on a year ago, and you may change your mind.   ;  I did redo a few things, its just that whenever I ask for help somewhere, the people just say "Why not just do this again?" and Id be redoing my code all the time. This isnt really a professional game, Im just trying to testing some things out, so I dont want to keep using random methods just to make it look nicer. In fact my last game I made was way worse, I didnt use any classes, I just used functions and it ended up with over 2000 lines, and now Ive done twice as much with half the amount, so at least Im learning to shorten my programs... I have a wierd way of learning, I cant go straight from start to finish. It just completely confuses me then. I tend to skip around, and suddenly earlier stuff makes more sense to me, then I go back and learn it.   ;  The reason why they tell you that is to help you become a better programmer. Ifyour programming just for a hobbie, and you got some other career or job thendo what you want. If you want to become a programmer, then take these pro'sadvice seriously.   