home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list17_7.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
587b
|
32 lines
/* The strcmp() function. */
#include <stdio.h>
#include <string.h>
main()
{
char str1[80], str2[80];
int x;
while (1)
{
/* Input two strings. */
printf("\n\nInput the first string, a blank to exit: ");
gets(str1);
if ( strlen(str1) == 0 )
break;
printf("\nInput the second string: ");
gets(str2);
/* Compare them and display the result. */
x = strcmp(str1, str2);
printf("\nstrcmp(%s,%s) returns %d", str1, str2, x);
}
}