TheFestFever.com

Our aim is to connect students from campuses all over Delhi by making them aware of all Technical, Cultural, Management fests, workshops, Seminars organized by every college in Delhi.

Join Us Now

Program 32: Write a C++ program to check whether the strings are equal or not without using stdlib funcs.

#include<iostream>
#include<string.h>
using namespace std;

int main()
{
	string str1,str2;
	int flag=0;
	cout<<"\nenter two string : ";
	cin>>str1>>str2;
	int size1=str1.length(),size2=str2.length();

	if(size1!=size2)
	{
		cout<<"\nneither length nor strings are equal!!";
		exit(0);
	}

	if(str1.compare(str2)==0)
		cout<<"\nBoth strings are equal...";
	else
		cout<<"\nlength of both strings are equal but strings not!!!";
	return 0;
}



If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.