Performing String Operations without String Library (Comparison)
#include
#include
void main()
{
clrscr();
char s1[25],s2[25];
int count1=0;
cout<<"\n\tEnter the first string:";
cin.getline(s1,25);
for(int i=0;s1[i]!='\0';i++)
{
if(s1[i]!=' ')
{
count1 =count1+1;
}
}
cout<<"\n\tthe number of elements in the string are:"<< count1 << endl;
cout<<"\n\tEnter the second string:";
cin.getline(s2,25);
int count2=0;
for(int j=0;s2[j]!='\0';j++)
{
if(s2[j]!=' ')
count2=count2+1;
}
cout<<"\n\tThe number of elements in the string are:"<