C++ Program to check if two strings are identical.

How to write a C++ Program to check if two strings are identical or not in C++ Programming ?



C++ Program to check if two strings are identical. How to compare two strings in C++ How to Compare Two Strings in C++ Programming  Check if sizes of two strings are same Check whether two strings are anagram of each other
C++ Program to check if two strings are identical.

Solution:
//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();
}

This C++ Program to check if two strings are identical.


Learn More :