Monday, February 16, 2009

Exer 8 CS 121

Photobucket

Photobucket

#include
#include
#include
void menu();
void nextscreen();
void nextscreen2();

void nextscreen()
{
clrscr();
int x,y,z;
for(x=1;x<=77;x++){
gotoxy(2+x,1);textcolor(WHITE);cprintf("Í");
//delay (10);
gotoxy(2+x,21);printf("Í");
//delay (10);
}
for(y=1;y<=20;y++){
gotoxy(3,1+y);printf("º");
//delay (10);
gotoxy(79,1+y);printf("º");
//delay (10);
}
gotoxy(3,1);printf("É");
gotoxy(3,21);printf("È");
gotoxy(79,1);printf("»");
gotoxy(79,21);printf("¼");
}
void menu()
{
nextscreen();
nextscreen2();
int choice,a,b,n,y,sum=0,sub=0,mul=0,div=0,z;
gotoxy(18,5);textcolor(WHITE);cprintf("W-E-L-C-O-M-E TO THE P.R.O.G.R.A.M OPERATION!!");
gotoxy(18,6);textcolor(WHITE);cprintf("\nSelect operation you WANT to Try!");
gotoxy(25,8);textcolor(WHITE);cprintf("\n\t[A] for ADDITION");
gotoxy(25,9);textcolor(WHITE);cprintf("\n\t[B] for SUBTRACTION");
gotoxy(25,10);textcolor(WHITE);cprintf("\n\t[C] for MULTIPLICATION");
gotoxy(25,11);textcolor(WHITE);cprintf("\n\t[D] for DIVISION");
gotoxy(25,12);textcolor(WHITE);cprintf("\n\t[E] for Exit");
gotoxy(18,14);textcolor(WHITE);cprintf("\nEnter CAPITAL letter of operation you choose:");
scanf("%s",&choice);

switch(choice)
{
case 'A':

clrscr();

nextscreen();
nextscreen2();
gotoxy(25,5);printf("A] ++ <<<>>> ++");
gotoxy(25,7);printf("Enter number: ");
scanf("%d",&a);
gotoxy(25,8);printf("Enter another number: ");
scanf("%d",&b);
sum=a+b;
gotoxy(25,10);printf("Summation of two number is: => %d <=",sum);
gotoxy(33,12);printf("NICE ADDITION!!\n");
gotoxy(18,14);printf("Just press y if you want to try again: ->");
scanf("%s",&z);
menu();
getch();

break;

case 'B': clrscr();
nextscreen();
nextscreen2();
gotoxy(25,5);printf("B] -- <<<>>> --");
gotoxy(25,7);printf("Enter number: ");
scanf("%d",&a);
gotoxy(25,8);printf("Enter another number: ");
scanf("%d",&b);
sub=a-b;
gotoxy(25,10);printf("Subtraction of two number is: => %d <=",sub);
gotoxy(33,12);printf("NICE SUBTRACTION!!");
gotoxy(18,14);printf("Just press y if you want to try again: ->");
scanf("%s",&z);
menu();
getch();

break;

case 'C': clrscr();
nextscreen();
nextscreen2();
gotoxy(22,5);printf("C] ** <<>> **");
gotoxy(23,7);printf("Enter number: ");
scanf("%d",&a);
gotoxy(23,8);printf("Enter another number: ");
scanf("%d",&b);
mul=a*b;
gotoxy(23,10);printf("Muliplication of two number is: => %d <=",mul);
gotoxy(33,12);printf("NICE MULTIPLICATION!!");
gotoxy(18,14);printf("Just press y if you want to try again: ->");
scanf("%s",&z);
menu();
getch();

break;

case 'D': clrscr();
nextscreen();
nextscreen2();
gotoxy(25,5);printf("D] // <<<>>> //");
gotoxy(25,7);printf("Enter number: ");
scanf("%d",&a);
gotoxy(25,8);printf("Enter another number: ");
scanf("%d",&b);
div=a/b;
gotoxy(25,10);printf("Division of two number is: => %d <=",div);
gotoxy(33,12);printf("NICE DIVISION!!");
gotoxy(18,14);printf("Just press y if you want to try again: ->");
scanf("%s",&z);
menu();
getch();

break;

case'E':

gotoxy(18,18);printf("End of the program... Maraming Salamat Poh!!");
gotoxy(45,19);printf("Programmed by: SHERLUCK L. MERCADO");
gotoxy(45,20);printf("CS121(5820) / 12:30-2:30 / H1I");

break;
}
}

void nextscreen2()
{
clrscr();
int a,b,x,y,z;
for(x=1;x<=77;x++){
gotoxy(2+x,1);printf("Í");
gotoxy(2+x,21);printf("Í");
}
for(y=1;y<=20;y++){
gotoxy(3,1+y);printf("º");
gotoxy(79,1+y);printf("º");
}
gotoxy(3,1);printf("É");
gotoxy(3,21);printf("È");
gotoxy(79,1);printf("»");
gotoxy(79,21);printf("¼");
for(a=1;a<=49;a++){
gotoxy(15+a,4);printf("ß");
gotoxy(15+a,17);printf("Ü");
}
for(b=1;b<=14;b++){
gotoxy(16,3+b);printf("°");
gotoxy(65,3+b);printf("° ");
}
}

void main()
{
clrscr();
nextscreen();
nextscreen2();
menu();
getch();
}

No comments:

Post a Comment