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
What is new line escape sequence?
what is bit rate & baud rate? plz give wave forms
Explain #pragma statements.
How can you return multiple values from a function?
Is multithreading possible in c?
How can you tell whether a program was compiled using c versus c++?
What is character set?
What is the scope of local variable in c?
What is the g value paradox?
How can I discover how many arguments a function was actually called with?
What is sizeof in c?
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
Why ca not I do something like this?
What are the 4 data types?
Write a program for finding factorial of a number.