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 / premkumar

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()

{
clrscr();
int c=0;
char a[10];

char b[10];
gets(a);
gets(b);
for(int i=0,j=0;b[i]!='\0'||a[j]!='\0';i++,j++)
{
if(a[i]!=b[j])
{
c++;

}

}
if(c==0)
cout<<"string match";
else
cout<<"string does not match";

getch();
}

Is This Answer Correct ?    69 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c is called free form language?

992


I heard that you have to include stdio.h before calling printf. Why?

1025


Are negative numbers true in c?

1017


How pointers are declared?

925


to find the closest pair

2300


Explain what are its uses in c programming?

1036


Why functions are used in c?

1089


What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

1036


What math functions are available for integers? For floating point?

1099


Which node is more powerful and can handle local information processing or graphics processing?

1281


What is a const pointer in c?

1093


Why is extern used in c?

1067


How is a macro different from a function?

1134


Explain what are bus errors, memory faults, and core dumps?

1239


What is the use of clrscr?

1074