Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program to compare two strings without using the
strcmp() function

Answer Posted / nomi mayana

#include<iostream>
#include<cstdio>
using namespace std;

int main()
{
char a[25],b[25];
int cnt=1,i=1;
cout<<"\n ENTER THE STRING 1 : ";
cin>>a;
cout<<"\n ENTER THE STRING 2 : ";
cin>>b;

while(a[i]!='\0' && b[i]!='\0')
{
if(a[i]==b[i])
{
cnt++;
}
else
{
cout<<"\n\n THE TWO STRINGS ARE NOT EQUAL";
}
i++;
}

if(i==cnt)
{
int n;

cout<<"\n\t\t~~~~~~~~~~COMPARISON RESULT~~~~~~~~~~~";
cout<<"\n THE GIVEN TWO STRINGS ARE SAME ";
}

//getch();
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c preprocessor mean?

1242


hi send me sample aptitude papers of cts?

2106


What is meant by keywords in c?

1036


Can static variables be declared in a header file?

1003


design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

1923


If errno contains a nonzero number, is there an error?

1291


what will be the output for the following main() { printf("hi" "hello"); }

10798


What is the use of a semicolon (;) at the end of every program statement?

1411


What does void main () mean?

1179


Do pointers take up memory?

1081


How will you delete a node in DLL?

1220


Why we use break in c?

935


Is python a c language?

948


What is the process of writing the null pointer?

980


Can a pointer be volatile in c?

931