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 / vijay.benzamin

#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 ?    54 Yes 31 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the general form of a C program?

978


Explain the difference between getch() and getche() in c?

937


What is c preprocessor mean?

1243


Is array name a pointer?

994


Can one function call another?

1051


What is the data segment that is followed by c?

1032


What do you mean by scope of a variable in c?

972


What is typedef struct in c?

1000


Is that possible to add pointers to each other?

1319


What is spark map function?

1058


Why does everyone say not to use gets?

1027


Is void a keyword in c?

924


How does selection sort work in c?

984


Why we use break in c?

935


Are comments included during the compilation stage and placed in the EXE file as well?

1029