
| Turbo C - Using strcmp or String Compare |
|
#include<stdio.h> #include<conio.h> #include<string.h> /* Programmed by Harvey Losin */ /* http://www.bikoy.com/harvey */ /* webmaster@bikoy.com */ main() { char s1[20],s2[20]; clrscr(); printf("Enter a word:"); gets(s1); printf("Enter a word:"); gets(s2); if(!strcmp(s1,s2)) { printf("The two words are equal"); } else printf("The two words are not equal"); getch(); }
|