Just a nOOb, I have had a hard time thinking of things to program that will help me reinforce what I am learning. I am just learning about classes, operator overloading and friends functions but really haven't done any programming.
With that in mind I decided to start on somthing that has been overdone before a simple rpg charachter generator. So far I have just a header file and would like some comments on it.
Code:
#ifndef _RPG_H_
#define _RPG_H_
class Charachter
{
private:
// charachter attributes
sruct attribs
{
char name[30];
char profession[20];
char armortype[20];
int armorclass;
int abilities[6];
int hitpoints;
};
// professions/armortypes to be read from file containing four choices
char professions[20,4];
char armortypes[20,4];
void rollabilities(int ab[6]);// or void rollabilities(int * ab)
int rollhitpoints(const char * profess);
int calcarmorclass(const char * armortyp);
public:
Charachter();
~Charachter();
char * getname();
char * getprofession(const char * professions);
char * getarmortype(const char * armortypes);
char * readprofessions();
char * readarmortypes();
void displaysheet(const attribs & odin);
};
#endif
One thing I would like to implement though I do not know if it should be part of my charachter class is to have the possible professions and armortypes in a file hence my readprofessions function that will read the possible professions. I haven't used any of the new things I am learning like operator overloading of friends functions, but I feel I need to start two step backwards and implement the new features in the future (if needed).