This Project is intended to design the graphical LOVE CALCULATOR using C Language:
/*==================================================================Programmed By: Ashok Kumar Sharma
Compiler Used : Turbo C++ 3.0
OS Used : Windows XP
==================================================================*/
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<dos.h>
void main()
{
char name1[50],name2[50],wcount;
char day1[50],day2[50],mon1[5],mon2[5],year1[5],year2[5];
char hh1[50],hh2[50],min1[5],min2[5],ss1[5],ss2[5];
int len1=0,len2=0,value1=0,value2=0,value3=0,tvalue=0,i=0;
clrscr();
main_screen();
_setcursortype(_SOLIDCURSOR);
bclr();
gotoxy(10,22);
cprintf("==>Enter Your Full Name or a part of Your Name....");
gotoxy(16,9); gets(name1);
gotoxy(10,22); erase();
gotoxy(16,10); printf(" ");
gotoxy(10,22);
cprintf("==>Enter your day of birth....");
gotoxy(10,23);
cprintf("==>If not known then enter....'00'");
gotoxy(16,10); scanf("%s",&day1);
gotoxy(24,10); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter your birth month....");
gotoxy(10,23);
cprintf("==>If not known then enter....'00'");
gotoxy(24,10); scanf("%s",&mon1);
gotoxy(32,10); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter your birth year....");
gotoxy(10,23);
cprintf("==>If not known then enter....'00'");
gotoxy(32,10); scanf("%s",&year1);
gotoxy(16,11); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter hour of your birth....");
gotoxy(10,23);
cprintf("==>If not known then enter....'00'");
gotoxy(16,11); scanf("%s",&hh1);
gotoxy(24,11); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter minutes of your birth....");
gotoxy(10,23);
cprintf("==>If not known then enter....'00'");
gotoxy(24,11); scanf("%s",&min1);
gotoxy(32,11); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter the seconds of your birth time....");
gotoxy(10,23);
cprintf("==>If not known then enter....'00'");
gotoxy(32,11); scanf("%s",&ss1);
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter Your Loves Name....");
gotoxy(55,9); gets(name2); gotoxy(55,9); gets(name2);
gotoxy(55,10); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter Your Loves day of birth....");
gotoxy(10,23);
cprintf(" (If not known then enter '00')");
gotoxy(55,10); scanf("%s",&day2);
gotoxy(63,10); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter Your Loves month of birth....");
gotoxy(10,23);
cprintf(" (If not known then enter '00')");
gotoxy(63,10); scanf("%s",&mon2);
gotoxy(70,10); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter Your Loves year of birth....");
gotoxy(10,23);
cprintf(" (If not known then enter '00')");
gotoxy(70,10); scanf("%s",&year2);
gotoxy(55,11); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter Your Loves hour of birth time....");
gotoxy(10,23);
cprintf(" (If not known then enter '00')");
gotoxy(55,11); scanf("%s",&hh2);
gotoxy(63,11); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter Your Loves minutes of birth time....");
gotoxy(10,23);
cprintf(" (If not known then enter '00')");
gotoxy(63,11); scanf("%s",&min2);
gotoxy(70,11); printf(" ");
gotoxy(10,22); erase();
gotoxy(10,22);
cprintf("==>Enter Your Loves seconds of birth time....");
gotoxy(10,23);
cprintf(" (If not known then enter '00')");
gotoxy(70,11); scanf("%s",&ss2);
gotoxy(10,22);erase();
_setcursortype(_NOCURSOR);
analyze();
//String computations
len1=strlen(name1);
i=0;
while(i<len1)
{
name1[i]=tolower(name1[i]);
i++;
}
len2=strlen(name2);
i=0;
while(i<len2)
{
name2[i]=tolower(name2[i]);
i++;
}
value1=strcmp(name1,name2);
len1=0;len2=0;i=0;
strcat(day1,mon1); strcat(day2,mon2);
strcat(day1,year1); strcat(day2,year2);
value2=strcmp(day1,day2);
strcat(hh1,min1); strcat(hh2,min2);
strcat(hh1,ss1); strcat(hh2,ss2);
value3=strcmp(hh1,hh2);
tvalue=value1+value2+value3;
analyze();
delay(2000);
while(wcount!='@')
{
draw_lov_screen();
Lov_Calculation(value1,value2,value3,tvalue);
_setcursortype(_SOLIDCURSOR);
textcolor(WHITE+BLINK);
gotoxy(5,21);
printf("Press SHIFT+2 for Exit!");
gotoxy(50,21);
textcolor(WHITE);
textbackground(BLACK);
cprintf("To Continue Press Enter....");
wcount=getch();
fflush(stdin);
if(wcount==13 && wcount!='@')
{
main();
}
_setcursortype(_NOCURSOR);
if(wcount!='@')
{
wcount=0;
gotoxy(20,16);
printf("Invalid Key! Press the Given Option....");
wcount=getch();
fflush(stdin);
gotoxy(20,16);
printf(" ");
if(wcount=='@')
{
Lov_Exit();
}
else
{
main();
}
}
}
Lov_Exit();
}
draw_lov_screen()
{
int i=0, j=0,x=0,y=0;
clrscr();
gotoxy(1,1);
textbackground(BLACK);
for(i=0; i<25; i++)
{
for(j=0; j<80; j++)
{
cprintf(" ");
}
}
gotoxy(1,1);
textbackground(LIGHTMAGENTA);
for(i=0; i<3; i++)
{
for(j=0; j<80; j++)
{
cprintf(" ");
}
}
y=0;
for(i=0; i<24; i++)
{
for(j=0; j<1; j++)
{
gotoxy(1,y=y+1);
cprintf(" ");
gotoxy(80,y);
cprintf(" ");
}
}
x=0;
for(i=0; i<80; i++)
{
gotoxy(x=x+1,25);
cprintf(" ");
}
gotoxy(10,2);
printf("W E L C O M E T O L O V E C A L C U L A T I O N");
textcolor(WHITE);
textbackground(BLACK);
return;
}
Lov_Exit()
{
clrscr();
gotoxy(23,10);
printf("Coded By: Ashok Kumar Sharma");
gotoxy(23,11);
printf("Email ID: kumarashok.sharma@facebook.com");
gotoxy(60,16);
textcolor(WHITE+BLINK);
cprintf("Press Enter....");
getch();
exit(0);
textcolor(WHITE);
textbackground(BLACK);
return;
}
Lov_Calculation(int data1,int data2,int data3,int result)
{
int i=0,count=0,x=0,y=0;
if(data1<0 && data2<0 && data3<0)
{
gotoxy(10,6);
printf("Hey Dude your loves spike are on top but your");
gotoxy(10,7);
printf("family relation effects it hardly!");
result=98;
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(GREEN);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%2d%",count);
}
gotoxy(y,13);
cprintf("%2d%",result);
}
else if(data1==0 && data2==0 && data3==0)
{
gotoxy(10,6);
printf("Woooo... You are the person who get a true love");
gotoxy(10,7);
printf("for your whole life!");
result=100;
count=0;
i=0;
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(GREEN);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%3d%",count);
}
gotoxy(y,13);
cprintf("%3d%",result);
}
else if(data1>0 && data2>0 && data3>0)
{
gotoxy(10,6);
printf("It looks like it is an one side love and it didn't");
gotoxy(10,7);
printf("go for a long time!");
gotoxy(10,8);
printf("Hey don't be sad, I am just a machine and not a God");
gotoxy(10,9);
printf("who will tell always true! It may be false, so try it");
gotoxy(10,10);
printf("with your heart, at the end you will succeed!");
result=50-result;
if(result<0)
{
result=15;
}
count=0;
i=0;
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(RED);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%3d%",count);
}
gotoxy(y,13);
cprintf("%3d%",result);
}
else if(result < -9)
{
result=100+result;
if(result<0)
{
result=70;
}
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
count=0;
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(YELLOW);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%3d%",count);
}
gotoxy(y,13);
cprintf("%3d%",result);
}
else if(result >= -9 && result<0)
{
result=100+result;
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
count=0;
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(GREEN);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%3d%",count);
}
gotoxy(y,13);
cprintf("%3d%",result);
}
else if(result==0)
{
gotoxy(10,6);
printf("Amazing... This type of love didn't find easily in");
gotoxy(10,7);
printf("this world. You both made for each-other!");
result=100;
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(GREEN);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%3d%",count);
}
gotoxy(y,13);
cprintf("%3d%",result);
}
else if(result>0 && result<9)
{
result=50+result;
if(result>65)
{
result=result-23;
}
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
count=0;
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(RED);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%3d%",count);
}
gotoxy(y,13);
cprintf("%3d%",result);
}
else if(result>=9)
{
result=50+result;
if(result>75)
{
result=75;
}
gotoxy(10,12);
textcolor(WHITE+BLINK);
cprintf("YOUR LOVE PERCENTAGE IS");
textcolor(WHITE);
count=0;
x=11;y=12;
for(i=0; i<result/3; i++)
{
textbackground(YELLOW);
count+=3;
gotoxy(x=x+1,13);
cprintf(" ");
delay(100);
gotoxy(y=y+1,13);
printf("%3d%",count);
}
gotoxy(y,13);
cprintf("%3d%",result);
}
textcolor(WHITE);
textbackground(BLACK);
return;
}
erase()
{
int i,j;
for(i=0; i<2; i++)
{
for(j=0; j<60; j++)
{
printf(" ");
}
}
return;
}
bclr()
{
textbackground(LIGHTCYAN);
textcolor(BLACK);
return;
}
main_screen()
{
int i=0,j=0,x=0,y=0;
clrscr();
cal_refresh();
cal_screen();
gotoxy(1,1);
textbackground(LIGHTRED);
for(i=0;i<240;i++)
{
cprintf(" ");
}
textbackground(LIGHTRED);
y=0;
for(i=0; i<25; i++)
{
gotoxy(1,y=y+1);
cprintf(" ");
gotoxy(40,y);
cprintf(" ");
gotoxy(80,y);
cprintf(" ");
}
x=0;
for(i=0; i<80; i++)
{
gotoxy(x=x+1,25);
cprintf(" ");
}
x=1; y=20;
for(i=0; i<78; i++)
{
gotoxy(x=x+1,y);
cprintf(" ");
}
x=1; y=21;
textbackground(LIGHTCYAN);
for(i=0; i<4; i++)
{
for(j=0; j<78; j++)
{
gotoxy(x=x+1,y);
cprintf(" ");
}
y=y+1;
x=1;
}
textbackground(LIGHTMAGENTA);
x=2;
for(i=0; i<36; i++)
{
gotoxy(x=x+1,5);
cprintf(" ");
gotoxy(x,6);
cprintf(" ");
gotoxy(x,7);
cprintf(" ");
}
textbackground(BLUE);
textbackground(LIGHTMAGENTA);
y=41;
for(i=0; i<37; i++)
{
gotoxy(y=y+1,5);
cprintf(" ");
gotoxy(y,6);
cprintf(" ");
gotoxy(y,7);
cprintf(" ");
}
textbackground(BLACK);
x=2; y=8;
for(i=0; i<11; i++)
{
for(j=0; j<36; j++)
{
gotoxy(x=x+1, y);
cprintf(" ");
}
y++;
x=2;
}
x=41; y=8;
for(i=0; i<11; i++)
{
for(j=0; j<37; j++)
{
gotoxy(x=x+1, y);
cprintf(" ");
}
y++;
x=41;
}
textbackground(BLUE);
gotoxy(25,2);
cprintf(" WELCOME TO LOVE CALCULATOR ");
gotoxy(12,6);
printf("ENTER YOUR DETAIL");
gotoxy(48,6);
printf("ENTER YOUR LOVES DETAIL");
//Detail line.
_setcursortype(_SOLIDCURSOR);
gotoxy(05,9); printf("NAME : ");
gotoxy(44,9); printf("NAME : ");
gotoxy(05,10); printf("D.O.B. : dd - mm - yyyy");
gotoxy(44,10); printf("D.O.B. : dd - mm - yyyy");
gotoxy(05,11); printf("DOB TIME : hh - mn - ss");
gotoxy(44,11); printf("DOB TIME : hh - mn - ss");
lov_anim();
textcolor(WHITE);
textbackground(BLACK);
return;
}
lov_anim()
{
int i, j,x=0,y=0;
textbackground(WHITE);
_setcursortype(_NOCURSOR);
y=12;
for(i=0; i<5; i++)
{
gotoxy(8,y=y+1);
delay(100);
cprintf(" ");
}
gotoxy(8,18);
for(i=0; i<6; i++)
{
delay(100);
cprintf(" ");
}
x=28; y=13;
for(i=0;i<3;i++)
{
gotoxy(x=x-1,y);
delay(100);
cprintf(" ");
}
delay(100);
gotoxy(24,14); cprintf(" ");
delay(100);
gotoxy(23,15); cprintf(" ");
delay(100);
gotoxy(23,16); cprintf(" ");
delay(100);
gotoxy(24,17); cprintf(" ");
gotoxy(25,18);
for(i=0;i<3;i++)
{
delay(100);
cprintf(" ");
}
delay(100);
gotoxy(28,17); cprintf(" ");
delay(100);
gotoxy(29,16); cprintf(" ");
delay(100);
gotoxy(29,15); cprintf(" ");
delay(100);
gotoxy(28,14); cprintf(" ");
x=47; y=12;
for(i=0; i<3; i++)
{
gotoxy(x,y=y+1);
delay(100);
cprintf(" ");
}
x=47; y=15;
for(i=0; i<3; i++)
{
gotoxy(x=x+1,y=y+1);
delay(100);
cprintf(" ");
}
x=50; y=18;
for(i=0; i<3; i++)
{
gotoxy(x=x+1,y=y-1);
delay(100);
cprintf(" ");
}
x=53; y=16;
for(i=0; i<3; i++)
{
gotoxy(x,y=y-1);
delay(100);
cprintf(" ");
}
x=72; y=13;
for(i=0; i<6; i++)
{
gotoxy(x=x-1,y);
delay(100);
cprintf(" ");
}
x=65; y=13;
for(i=0; i<4; i++)
{
gotoxy(x,y=y+1);
delay(100);
cprintf(" ");
}
x=65; y=18;
for(i=0; i<6; i++)
{
gotoxy(x=x+1,y);
delay(100);
cprintf(" ");
}
x=65; y=15;
for(i=0; i<5; i++)
{
gotoxy(x=x+1,y);
delay(100);
cprintf(" ");
}
textcolor(WHITE);
textbackground(BLACK);
return;
}
analyze()
{
int i, j,x=0,y=0;
textbackground(LIGHTGREEN);
textcolor(WHITE);
x=25; y=12;
for(i=0; i<3; i++)
{
for(j=0; j<30; j++)
{
gotoxy(x,y);
cprintf(" ");
x=x+1;
}
y=y+1;
x=25;
}
textbackground(MAGENTA);
gotoxy(26,13);
cprintf("Analyzing Please Wait.....");
textcolor(WHITE);
textbackground(BLACK);
return;
}
cal_refresh()
{
int i,j;
clrscr();
textbackground(BLACK);
textcolor(WHITE);
gotoxy(1,1);
for(i=0; i<50; i++)
{
for(j=0; j<80; j++)
{
cprintf(" ");
}
}
textcolor(WHITE);
textbackground(BLACK);
return;
}
cal_screen()
{
int i,j;
textcolor(WHITE);
textbackground(BLUE);
gotoxy(1,1);
for(i=0; i<23; i++)
{
for(j=0; j<80; j++)
{
cprintf(" ");
}
}
textcolor(WHITE);
textbackground(BLACK);
return;
}
No comments :
Post a Comment