Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to check if two strings are identical.
- #include<conio.h>
- #include<iostream.h>
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- clrscr();
- char a[80],b[80];
- int z=0;
- cout<<"Enter a string: ";
- gets(a);
- cout<<"Enter another string: ";
- gets(b);
- if(strlen(a)!=strlen(b))
- cout<<"The strings are not identical.";
- for(int i=0;a[i]!='\0';i++)
- if(a[i]==b[i])
- ++z;
- if(z==strlen(a))
- cout<<"The strings are identical.";
- else
- cout<<"The strings are not identical.";
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment