Thursday, July 9, 2009

Plz plz plz any one tell me the program to compare two strings in c++?

i want an program showing the comparison of c++


and one more thing i want to know how to inpute the graphics in Borland turbo c++ v4.5.





i am looking for a friend who could help me in my c++ problem.i wamt to chat with him .if any one want to help me then im me ar add me as friend my id is abhishek_vermaya@yahoo.co.in

Plz plz plz any one tell me the program to compare two strings in c++?
Strings can be compared by using library function strcmp, for this header file "string.h" must be included. Function receive two string argument and returns 0 when string1 is same as string2, returns +ve no when string1 is greater than string2 and returns -ve no when string1 is less than string2.





Syntex:- int strcmp(char*,char*)


e.g.


#include%26lt;iostream.h%26gt;


#include%26lt;string.h%26gt;


void main()


{


char *st1="Ajay Kumar", *st2="Amit Kumar";





cout%26lt;%26lt;strcmp(st1,st2);


}





function will display -3 because second string is greater (according to alphabet) i.e. j - m = -3
Reply:PLEASE REFER THE WEBSITE www.cplusplus.com .
Reply:use the function strcmp()
Reply:i dont know da seriously....how can i solve ur problem??im helpless
Reply:UltraCompare: http://www.ultraedit.com/index.php?name=...


No comments:

Post a Comment