Thursday, February 19, 2009

calculator


#include
#include
#include
#include


void swtch();
void frme();
void ext();
void loop();

void main(){



clrscr();
frme();
loop();
swtch();
getche();

}

void frme()
{

int x,y;

for(x=1;x<=77;x++){ gotoxy(1,1);textcolor(GREEN);cprintf("Î"); gotoxy(1+x,1);textcolor(GREEN);cprintf("Î"); gotoxy(1+x,25);textcolor(GREEN);cprintf("Î"); gotoxy(1,25);textcolor(GREEN);cprintf("Î"); } for(y=1;y<=23 ;y++){ gotoxy(1,1+y);textcolor(GREEN);cprintf("Î"); gotoxy(78,1);textcolor(GREEN);cprintf("Î"); gotoxy(78,1+y);textcolor(GREEN);cprintf("Î"); gotoxy(78,1);textcolor(GREEN);cprintf("Î"); } for(x=5;x<=72;x++){ gotoxy(5,3);textcolor(GREEN);cprintf("Î"); gotoxy(1+x,3);textcolor(GREEN);cprintf("Î"); gotoxy(1+x,23);textcolor(GREEN);cprintf("Î"); gotoxy(5,23);textcolor(GREEN);cprintf("Î"); } for(y=1;y<=19 ;y++){ gotoxy(5,3+y);textcolor(GREEN);cprintf("Î"); gotoxy(73,3);textcolor(GREEN);cprintf("Î"); gotoxy(73,3+y);textcolor(GREEN);cprintf("Î"); gotoxy(73,23);textcolor(GREEN);cprintf("Î"); } } void swtch() { clrscr(); frme(); int A,B,C,D,choice; gotoxy(33,6);textcolor(RED+BLINK);cprintf("W E L C O M E"); gotoxy(32,8);textcolor(YELLOW);cprintf("[1]. ADDITION"); gotoxy(32,10);textcolor(YELLOW);cprintf("[2]. SUBTRACTION"); gotoxy(32,12);textcolor(YELLOW);cprintf("[3]. MULTIPLICATION"); gotoxy(32,14);textcolor(YELLOW);cprintf("[4]. DIVISION"); gotoxy(32,16);textcolor(YELLOW);cprintf("[5]. E X I T"); gotoxy(32,18);textcolor(WHITE);cprintf("Enter the number of choice:"); scanf("%d",&choice); switch(choice){ case 1: clrscr(); frme(); int num1,num2,ans; gotoxy(34,6);textcolor(YELLOW+BLINK);cprintf("ADDITION"); gotoxy(32,8);textcolor(RED);cprintf("Enter 1st:"); scanf("%d",&num1); gotoxy(32,9);textcolor(RED);cprintf("Enter 2nd:"); scanf("%d",&num2); ans=num1+num2; gotoxy(32,10);textcolor(YELLOW);cprintf("Sum is: %d",ans); getche(); clrscr(); loop(); frme(); swtch(); break; case 2: clrscr(); frme(); int e,s,diff; gotoxy(33,6);textcolor(YELLOW+BLINK);cprintf("SUBTRACTION"); gotoxy(32,8);textcolor(RED);cprintf("Enter 1st:"); scanf("%d",&e); gotoxy(32,9);textcolor(RED);cprintf("Enter 2nd:"); scanf("%d",&s); diff=e-s; gotoxy(32,10);textcolor(YELLOW);cprintf("Diff is: %d",diff); getche(); clrscr(); loop(); frme(); swtch(); break; case 3: clrscr(); frme(); int l,k,prod; gotoxy(33,6);textcolor(YELLOW+BLINK);cprintf("MULTIPLICATION"); gotoxy(32,8);textcolor(RED);cprintf("Enter 1st:"); scanf("%d",&l); gotoxy(32,9);textcolor(RED);cprintf("Enter 2nd:"); scanf("%d",&k); prod=l*k; gotoxy(32,10);textcolor(YELLOW);cprintf("Prod is: %d",prod); getche(); clrscr(); loop(); frme(); swtch(); break; case 4: clrscr(); frme(); int o,u,quo; gotoxy(34,6);textcolor(WHITE+BLINK);cprintf("DIVISION"); gotoxy(32,8);textcolor(BLUE);cprintf("Enter 1st:"); scanf("%d",&o); gotoxy(32,9);textcolor(BLUE);cprintf("Enter 2nd:"); scanf("%d",&u); quo=o/u; gotoxy(32,10);textcolor(WHITE);cprintf("Quo is: %d",quo); if("Qou<=0") printf(" connot be"); getche(); clrscr(); loop(); frme(); swtch(); break; case 5: clrscr(); loop(); ext(); exit(1); getche(); break; default: clrscr(); loop(); frme(); gotoxy(32,12);textcolor(RED+BLINK);cprintf("ÞÞÞERRORÞÞÞ"); } } void ext() { clrscr(); int l,m; for(l=1;l<=65;l++) { gotoxy(6+l,7);printf(""); gotoxy(72-l,18);printf(""); delay(20); } { gotoxy(31,13);textcolor(RED);cprintf("Program termination"); gotoxy(31,14);textcolor(BLUE+BLINK);cprintf("Press Any Key"); getche(); } } void loop() { for(int e=1;e<=25;e++){ gotoxy(27+e,24);textcolor(YELLOW);cprintf("Þ"); } gotoxy(27,23);textcolor(WHITE+BLINK);cprintf("LOADING......"); gotoxy(40,23);textcolor(YELLOW);cprintf("(Please Wait)"); for(int i=1;(i<=25*4);i++) { gotoxy(27+(i/4),24);textcolor(RED);cprintf("±"); gotoxy(54,24);textcolor(6);cprintf("%d%",i); delay(40); } for(int o=1;o<=25;o++) { gotoxy(27+o,24);textcolor(YELLOW);cprintf("²"); } }

No comments:

Post a Comment