Write a program to compare two strings without using the
strcmp() function
Answer Posted / abhishek
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<conio.h>
void main()
{
clrscr();
char a[100],b[100];
int i,m;
cout<<"enter first string";
gets(a);
cout<<"enter second string";
gets(b);
for(i=0;a[i]!='\0'&&b[i]!='\0';i++)
{
if(a[i]!=b[i])
{
c=1;
}
}
if(c==1)
{cout<<"the strings do not match!";
}
else
{
cout<<"the strings match!";
}
getch();
}
| Is This Answer Correct ? | 7 Yes | 9 No |
Post New Answer View All Answers
Explain what is a static function?
What is the advantage of an array over individual variables?
Is fortran faster than c?
What is wild pointer in c?
Give differences between - new and malloc() , delete and free() ?
What are identifiers c?
How can I read/write structures from/to data files?
What is the difference between memcpy and memmove?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What are compound statements?
What is void pointers in c?
Define circular linked list.
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.