Create your own love-meter.Copy and paste the below code into your C compiler(Recommended:Borland C).Then compile and execute the file.
Source Code:
Enjoy C Programming........... :)
Source Code:
#include<stdlib.h>
#include<stdio.h>
#include<graphics.h>
main()
{
int sh,q,w,i=0,j=0,k,a1,a2,count,n,m,l,p,x,y,z,gm,gn;
char nm1[20],nm2[20];
clrscr();
label:clrscr();
a1=0;
a2=0;
count=0;
textcolor(4);
cprintf("__________________________________________");
i=0;
textcolor(1);
cprintf("\n\n\n\n Welcome To Love-Meter\n");
textcolor(2);
cprintf("* ---------------- * --------------*\n");
textcolor(3);
cprintf(" enter your name:\n");
scanf("%s",&nm1);
textcolor(5);
cprintf(" enter ur partner's:\n");
scanf("%s",nm2);
i=0;
while(nm1[i]!=0)
{
i++;
a1++;
}
i=0;
while(nm2[i]!=0)
{
i++;
a2++;
}
if(a1>a2)
{
n=a1;
m=a2;
}
else
{
n=a2;
m=a1;
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(nm1[i]==nm2[j])
{
count++;
break;
}
}
}
p=count*100/m;
textcolor(4);
cprintf(" .*'''*.*'''*. ");
cprintf(" * . * ");
cprintf(" * %3d% * ",p);
cprintf(" * * ");
cprintf(" * * ");
cprintf(" * ");
textcolor(9);
cprintf("\n\n\n LOVE percentage is %d%\n",p);
textcolor(10);
cprintf("HaVe A LOVING rElaTiOnShiP");
textcolor(13);
cprintf(" aLL tHe BeSt ...........");
textcolor(14);
cprintf(" \n\n\nto conti. enter 0 or to EXIT 1");
scanf("%d",&sh);
if(sh==0)
goto label;
textcolor(4);
cprintf("\n\n\n\n\n\n\n\n\n\n\n\n\n***** software designed n developed by Solvedcprogram.blogspot.com *****\n\n\n\n\n\n\n\n\n\n\n");
getch();
}
Enjoy C Programming........... :)