Concept of strcmp ( ).
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main ( )
{
char nm1[80], nm2[80];
int c = 0;
clrscr ( );
printf("\n\n\n\t\t Enter a name.....( 1 )....:"); gets(nm1);
printf("\n\n\n\t\t Enter a name.....( 2 )....:"); gets(nm2);
c = strcmp ( nm1, nm2 ); /* Used for comparing two strings */
if ( c == 0 )
{
printf("\n\n\n\t\t Same String");
}
else
{
if ( c > 0 )
{
printf("\n\n\n\t\t String....( 1 )..is big");
}
else
{
printf("\n\n\n\t\t String....( 2 )..is big");
}
}
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main ( )
{
char nm1[80], nm2[80];
int c = 0;
clrscr ( );
printf("\n\n\n\t\t Enter a name.....( 1 )....:"); gets(nm1);
printf("\n\n\n\t\t Enter a name.....( 2 )....:"); gets(nm2);
c = strcmp ( nm1, nm2 ); /* Used for comparing two strings */
if ( c == 0 )
{
printf("\n\n\n\t\t Same String");
}
else
{
if ( c > 0 )
{
printf("\n\n\n\t\t String....( 1 )..is big");
}
else
{
printf("\n\n\n\t\t String....( 2 )..is big");
}
}
getch ( );
}
Click here to contact us
No comments:
Post a Comment