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

How will you find a duplicate number in a array without negating the nos ?

2140


What is string constants?

1160


What do you know about the use of bit field?

1052


What is pass by reference in c?

1191


What are the advantages of external class?

1073


What does calloc stand for?

1174


What is scope rule in c?

1077


Dont ansi function prototypes render lint obsolete?

1138


what are the 10 different models of writing an addition program in C language?

1903


Explain what are multibyte characters?

1206


In a switch statement, what will happen if a break statement is omitted?

1071


What is default value of global variable in c?

995


What does c value mean?

1207


Explain what is a static function?

1115


program to convert a integer to string in c language'

2463