Hey guys,

This is my first post here :)

I have to compare to strings and then continue on with the loop..

void HighScore::removePlayer(const string& name)
    {
        int i,j = 0;

cout<<"Attempting to remove  " << name<<endl;
        while (i<d_nPlayers)
        {
              
         if (d_players[i].name==name)
        {
             cout<<"Found :  " << name<< "at slot: " << i <<endl;
// I never reach this loop
...

I did a quick search on this forum and tried using the strcmp() included in <string.h> but that didn't work either. I got error message "no function call to .... "

I'm guessing it's because one of my strings is a constant string instead of a CHAR? I don't know...

Any help is appreciated.

Lol... I found my problem after reading the code on this forum! "int i , j = 0" ooops.

Anyway..is there a reason why I can't use strcmp ? Just for future reference...

Recommended Answers

All 2 Replies

how is d_player declared? If it an array of character strings then you may need this: if( name == d_player[i])

d_players is an array of structures

structure contains

name : string
score : long

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.