write 2 strings and display if they are same

January 13, 2011 at 01:47:25
Specs: Windows XP
in c++, how two write two string and display if they are the same?

See More: write 2 strings and display if they are same

Report •


#1
January 25, 2011 at 20:05:03
define string - a cstring or a member of the string class?

cstring
char s[80];
strcpy(s, "test");
if(strcmp(s, "test") == 0) { /* do something */ }

string class
string s;
s = "test";
if(s == "test") { /* do something */ }

a second declaration of either form is just parroting the first. :P


Report •

#2
January 28, 2011 at 00:34:05
thnx, gonna try it

Report •

Related Solutions


Ask Question