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

What is new line escape sequence?

1319


what is bit rate & baud rate? plz give wave forms

1965


Explain #pragma statements.

1029


How can you return multiple values from a function?

1101


Is multithreading possible in c?

991


How can you tell whether a program was compiled using c versus c++?

1090


What is character set?

1157


What is the scope of local variable in c?

1106


What is the g value paradox?

1153


How can I discover how many arguments a function was actually called with?

1052


What is sizeof in c?

992


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

2006


Why ca not I do something like this?

1002


What are the 4 data types?

1001


Write a program for finding factorial of a number.

1064