May 22nd, 2011, 11:59 AM
#1
Help -- C++ -- Srings
I am getting an error while compiling, saying that strcpy is not declared in the scope. This segment is the definitions for monsters in a text adventure.
Code:
void initializeMonsters()
{
// old elk
monsterArray[0].strength = 10;
monsterArray[0].dexterity = 10;
monsterArray[0].hp = 10;
strcpy(monsterArray[0].name, "Old Elk");
// Archer
monsterArray[1].strength = 15;
monsterArray[1].dexterity = 20;
monsterArray[1].hp = 15;
strcpy(monsterArray[0].name, "Archer");
// Dreadful Skeleton
monsterArray[2].strength = 20;
monsterArray[2].dexterity = 10;
monsterArray[2].hp = 25;
strcpy(monsterArray[0].name, "Dreadful Skeleton");
// Ug'lor
monsterArray[3].strength = 25;
monsterArray[3].dexterity = 25;
monsterArray[3].hp = 60;
strcpy(monsterArray[0].name, "Ug'lor");
// Graldo >>Fight Before Ga'rados<<
monsterArray[4].strength = 40;
monsterArray[4].dexterity = 45;
monsterArray[4].hp = 60;
strcpy(monsterArray[0].name, "Graldo");
// Ga'Rados >>boss<<
monsterArray[5].strength = 95;
monsterArray[5].dexterity = 115;
monsterArray[5].hp = 90;
strcpy(monsterArray[5].name, "Ga'rados");
}
The declarations that I made are:
Code:
# include <iostream>
#include<ctime>
#include<cstdlib>
#include<cctype>
using namespace std;
I do not understand what I am doing wrong.
Any help is appreciated.
Thanks,
GAME3 DEV
May 22nd, 2011, 02:57 PM
#2
Re: Help -- C++ -- Srings
You should include header <string>.
May 22nd, 2011, 03:06 PM
#3
Re: Help -- C++ -- Srings
May 22nd, 2011, 03:17 PM
#4
Re: Help -- C++ -- Srings
Originally Posted by
GCDEF
What is name?
LOG --> Legend Of Ga'rados
Is what I'm thinking
May 22nd, 2011, 03:19 PM
#5
Re: Help -- C++ -- Srings
Originally Posted by
cilu
You should include header <string>.
I tried that Didn't work but it reminded me I needed to put a c infront of string <cstring> worked.
Thanks!
May 22nd, 2011, 04:13 PM
#6
Re: Help -- C++ -- Srings
Originally Posted by
GAME3 D3V
I tried that Didn't work but it reminded me I needed to put a c infront of string <cstring> worked.
Thanks!
Great.
PS: please don't sign your posts with your username, that is making the site filter prevent your posts from showing up until a moderator explicitly publishes them. Thanks.
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks