WELCOME TO MY BLOG BY SHABEEB.K

C,C++ PROGRAMMING: COMPARE STRINGS.

Search This Blog

Saturday, 3 August 2013

COMPARE STRINGS.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int n;

char string1[50],string2[50];

clrscr();

puts("\n ENTER ANY WORD \t");

gets(string1);

puts("\n ENTER SECOND WORD \t");

gets(string2);

n=strcmp(string1,string2);

if(n==0)

puts("\t BOTH SIZE OF STRINS ARE EQUAL\n");

else if(n<0)

puts("\n \t THE FIRST STRING IS GREATER\n ");

else if(n>0)

puts(" \n \t THE FIRST STRING IS SMALLER \n");

getch();
}


                                                                  OUTPUT

                                                                



No comments:

Post a Comment