Search:
Forum
General C++ Programming
IF CONDITION PROBLEM
IF CONDITION PROBLEM
Jan 11, 2010 at 4:02pm UTC
TroyMcFont
(4)
Hi!
My problem is that I've to compare to string carecters and I've checked with Debugger that the condition is ok and the strings are the same, but the problem is that the program doesn't go into de 'if condition' altough its ok.
I leave you the code. Can somebody help me plis?
if(lequipos->equipo[i].jugador[j].nombre_jugador == nombre_jugador)
{
lequipos->equipo[i].jugador[j].dd = dd;
lequipos->equipo[i].jugador[j].mm = mm;
lequipos->equipo[i].jugador[j].aaaa = aaaa;
cont++;
}
Thanks byee
Jan 11, 2010 at 4:18pm UTC
Bazzy
(6281)
Is nombre_jugador a C++ string or a C string -char array- ?
Jan 11, 2010 at 4:30pm UTC
TroyMcFont
(4)
char array
Jan 11, 2010 at 4:40pm UTC
coolProgramer5
(193)
are you using Dev-C++ or visual C++????
Jan 11, 2010 at 5:01pm UTC
TroyMcFont
(4)
visual c++
Jan 11, 2010 at 5:17pm UTC
Bazzy
(6281)
Use strcmp to compare C strings - notice that it will return 0 if the two strings are equal -
http://www.cplusplus.com/reference/clibrary/cstring/strcmp/
Jan 11, 2010 at 6:49pm UTC
TroyMcFont
(4)
Thank you Bazzy! ;)
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs