Thursday, September 27, 2018

Comparing two strings - case senstive

#include<string.h>
#include<iostream>
using namespace std;
// Program to compare a string

main()
{
char str1[100], str2[100];
cout<<"Enter a String ";
cin.getline(str1,100);
cout<<"\n"<<str1;
cout<<"Enter a String ";
cin.getline(str2,100);
cout<<"\n "<<str2;

if(strcmpi(str1,str2)==0)
cout<<"\n Strings are equal";
else
cout<<"\n Strings are unequal";
}

No comments:

Post a Comment