Below Is The Love Program Written in c++, I tried it writing with Java But, didnt understood to Do. WIll Anyone Help me Please
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
int FindPER(char [],int);
void main()
{
int len,i,PER; char n[100],sen[200];
clrscr();
cout<<"\n Your Name>"; cin>>n;
strcpy(sen,n); strcat(sen,"LOVES");
cout<<"\n Your Partners Name>"; cin>>n;
strcat(sen,n); len=strlen(sen);
for(i=0;i<len;i++) sen[i]=toupper(sen[i]);
PER=FindPER(sen,len);
cout<<"\n> The Percentage Is(Designed By Sahil)"<<PER;
getch();
}
int FindPER(char sen[],int len)
{
char c;
int i,j,a[60],al=-1,s,at[60],per;
for(i=0;i<len;i++)
{
if(sen[i]!='#')
{
c=sen[i]; al=al++;
s=1;sen[i]='#';
}
else
{
c='^';
}
for(j=i;j<len;j++)
{
if(c==sen[j])
{
s++; sen[j]='#';
}
}
a[al]=s;
}
while(al>2)
{
if(al%2==0)
{
j=al-1;
for(i=0;i<(al/2);i++)
{
at[i]=a[i]+a[j];j--;
}
al=i;
for(i=0; i<=al;i++) a[i]=at[i];
}
else
{
j=al-1;
for(i=0;i<(al/2);i++)
{
at[i]=a[i]+a[j];j--;
}
at[i++]=a[i]; al=i;
for(i=0;i<al;i++) a[i]=at[i];
}
}
if(a[1]<10) per=(a[0]*10)+a[1];
while(per>100)
{
i=per%100; j=i/10;
s=i%10; i=per/100;
per=((i+s)*10)+j;
}
return per;
}