I am trying to make a simple game but have some problems
here is the code so far
// foisy_inclass5.cpp
// The purpose of this program is simple RPG
// Programed by: Shawn Foisy
// E-Mail: foisys'AT'Telus'DOT'net
// Last Modified March 08, 2008
// licenced under the GPL V2
#include <string>
#include<iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
//USELESS AT THE MOMENT
void CHANGEROOM(char Direction)
{
}
//USELESS AT THE MOMENT
void PURCHICE(int Item)
{
}
//USELESS AT THE MOMENT
void SELL(int Item)
{
}
// STORE FUNCTION ID
void STORE(int Gold);
// PLAYERS CLASS
class player
{
public:
void SET_ROOM();
void SET_HP(int HPG);
void SET_STATS(int StrP, int DexP, int ConP, int CharP, int WisP, int
IntP);
void SET_WEPON();
void SET_ARMOR();
void DISPLAY_HP();
void DISPLAY_STATS();
string DISPLAY_WEPON();
string DISPLAY_ARMOR();
void DISPLAY_ROOM();
void FIGHT();
void TALK();
void SEARCH();
void RUN();
void BUY();
void SELL();
void SET_GOLD(int GoldG);
void DISPLAY_GOLD();
private:
int HP;
int Str;
int Int;
int Wis;
int Dex;
int Char;
int Con;
int Gold;
string Wepon;
int Attack;
string Armor;
int Defence;
};
// MONSTERS CLASS
class monster
{
public:
void SET_ROOM();
void SET_HP();
void SET_STATS();
void SET_WEPON();
void SET_ARMOR();
void DISPLAY_HP();
void DISPLAY_STATS();
string DISPLAY_WEPON();
string DISPLAY_ARMOR();
void DISPLAY_ROOM();
void FIGHT();
void TALK();
void SEARCH();
void RUN();
void SET_GOLD();
void DISPLAY_GOLD();
private:
int HP;
int Str;
int Int;
int Wis;
int Dex;
int Char;
int Con;
int Gold;
string Wepon;
int Attack;
string Armor;
int Defence;
};
// WEPON CLASS
class wepon
{
public:
void SET_STATS();
void DISPLAY_STATS();
void DISPLAY_DAMAGE();
void DISPLAY_MAXDAMAGE();
void DISPLAY_NAME();
void SET_COST_BUY();
void SET_COST_SELL();
void DISPLAY_COST_SELL();
void DISPLAY_COST_BUY();
private:
int Damage;
int NoAttacks;
int MaxDamage;
int Cost_Buy;
int Cost_Sell;
string Name;
};
//ROOMS CLASS USELESS AT MOMENT
class room
{
public:
void ADD_CHAR();
void REMOVE_CHAR();
void SET_TREASURE();
void DISPLAY_TREASURE();
void SET_MONSTERS();
void DISPLAY_MONSTERS();
void DISPLAY_DISCRIPTION();
private:
string Char;
string Monster;
int Treasure;
string Discription;
};
// THE ACTUAL BEGININGS OF THE PROGRAM
int main()
{
using namespace std;
string Name;
int Points; // settible stats
int Str;
int Dex;
int Con;
int Char;
int Wis;
int Int;
int Gold;
int HP;
char Help;
char Wait;
char Store;
char Direction;
cout << "Please enter your Charatures name: ";
cin >> Name;
player Main; // CREATE MAIN CHAR
//SETTING CHAR STATS
srand(time(0)); // Initialize random number generator.
Points=(rand() % 100) + 1;
cout << "You Have " << Points << " to spend how many would you like
to spend on: " << endl;
cout << "Strength - ";
cin >> Str;
Points=Points-Str;
cout << "You Have " << Points << " to spend how many would you like
to spend on: " << endl;
cout << "Dextarity - ";
cin >> Dex;
Points=Points-Dex;
cout << "You Have " << Points << " to spend how many would you like
to spend on: " << endl;
cout << " Constaution - ";
cin >> Con;
Points=Points-Con;
cout << "You Have " << Points << " to spend how many would you like
to spend on: " << endl;
cout << "Charisma - ";
cin >> Char;
Points=Points-Char;
cout << "You Have " << Points << " to spend how many would you like
to spend on: " << endl;
cout << "Wisdom - ";
cin >> Wis;
Points=Points-Wis;
cout << "You Have " << Points << " to spend how many would you like
to spend on: " << endl;
cout << "Intelligence - ";
cin >> Int;
cout << "Your stats have been entered, Thank you!" << endl;
cout << "They are Strength=" << Str << ", Dextarity=" << Dex << ",
Constatution=" << Con <<
", Charisma=" << Char << ", Wisdom=" << Wis << ", Intelligence=" <<
Int << "." << endl;
Main.SET_STATS(Str, Dex, Con, Char, Wis, Int);
//SETTING CHAR STATS **END**
//SETTING Starting Gold
srand(time(0)); // Initialize random number generator.
Gold=(rand() % 100) + 1;
Main.SET_GOLD(Gold);
cout << endl;
cout << "You have " << Gold <<" Gold" << endl;
//SETTING Starting Gold **END**
// SETTING HP
srand(time(0)); // Initialize random number generator.
HP=(rand() % 10) + 1;
Main.SET_HP(HP);
cout << "You Have " << HP << " HP" << endl;
// SETTING HP **END**
cout << "Press any key";
cin >> Wait;
// STORY BEGIN
system("cls");
cout << "Welcome " << Name << " to our little town. We have a small
problem, you see " << endl;
cout << "there was this evil old man who moved into the town. Now
that he is here " << endl;
cout << "there have been monster lurking around will you help us? (y/
n)";
cin >> Help;
cout << "Would you like to visit the store? ";
cin >> Store;
if (Store='y')
{
STORE(Gold);
}
cout << "You may leave the door is to the (n)ort"<< endl;
cin >> Direction;
if (Direction='n')
CHANGEROOM(Direction);
return 0;
}
void player::SET_STATS(int StrP, int DexP, int ConP, int CharP, int
WisP, int IntP)
{
Str=StrP;
Dex=DexP;
Con=ConP;
Char=CharP;
Wis=WisP;
Int=IntP;
}
void player::SET_GOLD(int GoldG)
{
Gold=GoldG;
}
void player::SET_HP(int HPG)
{
HP=HPG;
}
string player::DISPLAY_WEPON()
{
return Wepon;
}
string player::DISPLAY_ARMOR()
{
return Armor;
}
void STORE(int Gold)
{
char Buy;
int Item;
char Sell;
string Wepon;
string armor;
system ("cls");
cout << "We have " << endl;
cout << "1 - Dagger----------------50 gp" << endl;
cout << "2 - Short Sword----------100 gp" << endl;
cout << "3 - Long Sword-----------150 gp" << endl;
cout << "4 - Leather Armor--------200 gp" << endl;
cout << "5 - Sheld-----------------50 gp" << endl;
cout << "Would you like to buy anyting?(y/n)" << endl;
cin >> Buy;
if (Buy='y')
{
cout << "what would you like" << endl;
cin >> Item;
PURCHICE(Item);
}
else
{
cout << "Would you like to sell anything" << endl;
cin >> Sell;
if (Sell='y')
{
Wepon=Main.DISPLAY_WEPON();
Armor=Main.DISPLAY_ARMOR();
cout << "What would you like to sell" << endl;
cout << "1 - " << Wepon << endl;
cout << "2 - " << Armor << endl;
cin >> Item;
SELL(Item);
}
}
}
--------------------Configuration: GAMEv001 - Win32
Debug--------------------
Compiling...
gamev001.cpp
c:\do***ents and settings\justice\gamev001\gamev001.cpp(345) : error
C2065: 'Main' : undeclared identifier
c:\do***ents and settings\justice\gamev001\gamev001.cpp(345) : error
C2228: left of '.DISPLAY_WEPON' must have class/struct/union type
c:\do***ents and settings\justice\gamev001\gamev001.cpp(346) : error
C2065: 'Armor' : undeclared identifier
c:\do***ents and settings\justice\gamev001\gamev001.cpp(346) : error
C2228: left of '.DISPLAY_ARMOR' must have class/struct/union type
Error executing cl.exe.
GAMEv001.exe - 4 error(s), 0 warning(s)


|