Ok so i set up the struct, and ran into compile issues.
Here is the error im running into :
(19) : error C2447: '{' : missing function header (old-style formal list?)
(31) : error C2079: 'hero' uses undefined struct 'player'
(31) : error C2079: 'victim' uses undefined struct 'player'
(32) : error C2227: left of '->hp' must point to class/struct/union/generic type
1> type is 'int'
(32) : error C2227: left of '->hp' must point to class/struct/union/generic type
1> type is 'int'
(49) : error C2227: left of '->hp' must point to class/struct/union/generic type
1> type is 'int'
the rest of the errors are pretty much the same as these. I tried doing the code with both -> and replacing -> with a .
Also in the main int() I initiate the combat(), would i need to include anything in the parameter field?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
struct player;
{
int hp;
int damage_roll;
int block;
int lifesteal;
};
void combat()
{
srand ((unsigned) time(NULL) );
player hero, victim;
hero->hp = victim->hp = 50;
int min_dam = 1, max_dam = 10;
int min_block = 1, max_block = 6;
string name;
string villan;
cout <<"Your name: ";
cin >> name;
cout <<"Victim name: ";
cin >> villan;
cout << endl;
while (((hero->hp > 0) && (victim->hp > 0)) && ((hero->hp < 100) && (victim->hp < 100)))
{
...
|