CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2011
    Posts
    3

    Exclamation 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

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Help -- C++ -- Srings

    You should include header <string>.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Help -- C++ -- Srings

    What is name?

  4. #4
    Join Date
    May 2011
    Posts
    3

    Re: Help -- C++ -- Srings

    Quote Originally Posted by GCDEF View Post
    What is name?
    LOG --> Legend Of Ga'rados

    Is what I'm thinking

  5. #5
    Join Date
    May 2011
    Posts
    3

    Re: Help -- C++ -- Srings

    Quote Originally Posted by cilu View Post
    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!

  6. #6
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Help -- C++ -- Srings

    Quote Originally Posted by GAME3 D3V View Post
    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.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

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
  •  





Click Here to Expand Forum to Full Width

Featured