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 / waqar nawaz

#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 ?    104 Yes 51 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where does the name "C" come from, anyway?

1098


What is integer constants?

1032


What is spaghetti programming?

1094


What is variable declaration and definition in c?

872


Difference between goto, long jmp() and setjmp()?

1139


How do you determine a file’s attributes?

1035


What is the maximum no. of arguments that can be given in a command line in C.?

1104


What are the salient features of c languages?

1066


Wt are the Buses in C Language

3175


What are the key features in c programming language?

1026


Why is c called "mother" language?

1245


Why c is called object oriented language?

1024


Do you know null pointer?

986


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

2041


What is volatile, register definition in C

1071