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

When can you use a pointer with a function?

991


Explain how can you restore a redirected standard stream?

1030


What is the use of printf() and scanf() functions?

1069


What is the difference between null pointer and wild pointer?

1136


What is graph in c?

1008


What is a far pointer in c?

990


What are lookup tables in c?

951


How many parameters should a function have?

1127


What is pragma c?

1059


What is the modulus operator?

1152


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

1075


Explain what is the most efficient way to store flag values?

1173


what is ur strangth & weekness

2329


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

1076


Write a program to generate the Fibinocci Series

1162