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

What is the easiest sorting method to use?

1144


Why does not c have an exponentiation operator?

1042


Which is best book for data structures in c?

1084


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3561


What are void pointers in c?

984


Why clrscr is used after variable declaration?

1668


What functions are used in dynamic memory allocation in c?

1064


what is the difference between 123 and 0123 in c?

1191


How do I copy files?

1039


show how link list can be used to repersent the following polynomial i) 5x+2

2276


Write a program to print fibonacci series using recursion?

1049


Difference between macros and inline functions? Can a function be forced as inline?

1249


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4273


what are non standard function in c

1899


What is the auto keyword good for?

1131