The following code is supposed to be object-orientated and to fulfill the following -
QUOTE
Scenario
“The Goblet of Fire” is to be a role playing game involving a number of different characters, weapons, magical objects and spells. The characteristics of each object are as follows:
Characters:
Unique name
Sex
Type: wizard/witch/hero/heroine/sponsor/worker/creature
Magical ability: Value between 0 and 10
Strength: Value between 0 and 10
Health: Value between 0 and 10
Wealth: Value between 0 and 10
Weapon:
Unique name
Type Axe/sword/dagger/catapult
Magical resistance: Value between 0 and 10
Cost Value between 0 and 10
Magical object:
Unique name
Type: wand/shield/invisibility cloak/transporter
Magical strength: Value between 0 and 10
Cost Value between 0 and 10
Spell:
Unique name
Action: stunning/revealer/object or weapon summoning
Magical strength: Value between 0 and 10
Cost Value between 0 and 10
Throughout the game a player can acquire or loose any of the above, although they must have at least one character left in order to continue with the game
Task- part 1
Using an object oriented approach, design and write a program that uses appropriate classes to store, add and delete items from a players bank of characters, weapons, magical objects and spells.
The code is as follows (the boldened line has a declaration error - does anyone know how to fix this?)
CODE
#include <stdio.h>
#include <iostream.h>
{
class Character //a record holding all the data on one character
public:
char uniquename[35]; //allows for a char called uniquename that can be up to 35 characters long
char sex[6]; //allows for a char called sex that can be up to 6 characters long
char type[8]; //allows for a char called type that can be up to 8 characters long
int magicalability[2]; //holds the magicalability of the character
int strength[2]; //holds the strength of the character
int health[2]; //holds the health of the character
int wealth[2]; //holds the wealth of the character
}
{
class Weapon //a record holding all of the data on the weapon of a character
public:
char uniqueweapon[25]; //allows for a char called uniqueweapon that can be up to 25 characters long
char weapontype[15]; //allows for a char called weapontype that can be up to 15 characters long
int magicalresistance[2]; //holds the magical resistance of the character
int cost[2]; //holds the cost of the character
{
class MagicalObject //a record holding all of the data on a magical object
public:
char uniqueobject[25]; //allows for a char called uniqueobject that can be up to 25 characters long
char objecttype[15]; //allows for a char called objecttype that can be up to 15 characters long
int magicalstrength[2]; //holds the magical strength of the character
int magicalcost[2]; //holds the magical cost of the magical object
}
{
class Spell //a record holding all of the data on a spell
public:
char uniquespell[25]; //allows for a character called uniquespell that can be up to 25 characters long
char actionspell[15]; //allows for a character called actionspell that can be up to 15 characters long
int spellstrength[2]; //holds the magical strength of the spell
int spellcost[2]; //holds the cost of the spell
}
What do I need to do now?