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
How do you write a program which produces its own source code as output?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
Why is c called c not d or e?
What is unary operator?
Explain Function Pointer?
What Is The Difference Between Null And Void Pointer?
Why c language is called c?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What are the different types of linkage exist in c?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
What is the use of ?: Operator?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
how to write a c program to print list of fruits in alpabetical order?
What does 4d mean in c?
What does 3 mean in texting?