Love score

niladri.saha06 0 Tallied Votes 235 Views Share

This program finds the love score between two persons

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char a[10],b[10],c[10],d[10];
int i,j,s=0,k;
int l1,l2,l3;
float l4;
printf("ENTER YOUR NAME\n\n");
gets(a);
printf("ENTER YOUR GENDER\n\n");
gets(c);
printf("ENTER YOUR'S PARTNERS NAME\n\n");
gets(b);
printf("ENTER GENDER\n\n");
gets(d);
for(i=0;a[i]!='\0';i++)
{
for(j=0;b[j]!='\0';j++)
{
if(a[i]==b[j])
s++;
}
}
l1=strlen(a);
l2=strlen(b);
l3=l1+l2;
l4=((float)s/(float)l3)*100;
k=strcmp(c,d);
if(k==0)
printf("YOU TWO ARE HOMOSEXUAL\n\n");
printf("YOUR LOVE SCORE IS %f%\n\n",l4);
if(l4<25)
printf("VERY POOR RELATION");
if(l4>=25&&l4<50)
printf("YOUR RELATION WITH YOUR PARTNER IS NOT FINE\n YOU NEED TO KNOW MORE ABOUT YOUR PARTNER");
else
{
if(l4>=50&&l4<75)
printf("YOUR RELATION WITH YOUR PARTNER IS OK\n BUT YOU SHOULD TRY TO GET MORE CLOSE TO YOUR PARTNER");
else
{
if(l4>=75)
printf("YOUR RELATION IS MADE IN THE HEAVEN\n YOU TWO ARE REALLY MADE FOR EACH OTHER\n CONGRATULATIONS !!\n ENJOY YOUR LIFE");
}
}
getch();
}
MosaicFuneral 812 Nearly a Posting Virtuoso

Poorly formatted, do not use conio.h, it's int main() not void main() it has to have a return value; try fgets() and specify the buffer size, and what do any of those variable names even mean?

niladri.saha06 0 Newbie Poster

Mr Mosaic Funeral this the worst & wrong comment i have ever seen , it has been a personal attack

MosaicFuneral 812 Nearly a Posting Virtuoso

Wrong for telling you the C standard; attacking for showing you how to avoid a buffer-overflow - explain how-so?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.