tags:

views:

61

answers:

3
WordChosenDuplicate.insert(0,WordChosen.length," _ ");
    cout <<WordChosenDuplicate<< endl;

I get the following error when I try to run this code

error C3867: 'std::basic_string<_Elem,_Traits,_Ax>::length': function call missing argument list; use '&std::basic_string<_Elem,_Traits,_Ax>::length' to create a pointer to member c:\documents and settings\main\my documents\uni\2nd year\tp2\hangman\hangman\hangman.cpp 119
A: 

It's a function: std::string::length()

Please read the Manuals available on the net and the answers posted to your previous questions.

dirkgently
A: 

You need to use WordChosen.length (). Add the parenthesis, this is a method call.

Cannonade
A: 
for (int f = 0; f <= WordChosen.length()-1;f++)
    {

      WordChosenDuplicate.insert(0,(WordChosen.length(),"_ "));

    }

    cout <<WordChosenDuplicate<< endl;

Thanks guys got the answer.

Do you know why, if at all, this works? (I take that works == compiles for the moment.)
dirkgently
yip it compiles.Is for a hangman game so that was just making the blanks spaces for the word.
:sigh: I wish people take the ',' as an operator and not neglect its ramifications.
dirkgently