#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
                char str1[10],str2[10];
                clrscr();
                cout<<"Enter First String : ";
                cin>>str1;
                cout<<"Enter Second String : ";
                cin>>str2;
                if(strcmp(str1,str2)==0)
                                {
                                cout<<"Both Strings are Same";
                                }
                else if(strcmp(str1,str2)==-1)
                                {
                                cout<<str1<<" Is Smaller Than "<<str2;
                                }
                else
                                {
                                cout<<str1<<" Is Longer Than "<<str2;
                                }
                getch();
}

126.PNG

Advertisements