Saturday, March 28, 2009

EXERCISE8



#include

#include

void menu();

{

clrscr();int a,y,z;

for(int a=1;a<=75;a++){

textbackground(MAGENTA);

gotoxy(2+x,1);textcolor(RED);cprintf("Í");

gotoxy(2+x,21);textcolor(RED);cprintf("Í");

}

for(y=1;y<=20;y++){

gotoxy(3,1+y);textcolor(RED);cprintf("º");

gotoxy(79,1+y);textcolor(RED);cprintf("º");

}

gotoxy(3,1);textcolor(RED);cprintf("É");

gotoxy(3,21);textcolor(RED);cprintf("È");

gotoxy(79,1);textcolor(RED);cprintf("»");

gotoxy(79,21);textcolor(RED);cprintf("¼");

}

void menu()

{

int choice,a,b,n,y,z;

sum=0;

sub=0;

mul=0;

div=0;

gotoxy(26,6);textcolor(RED);cprintf("\nSelect operation:");

gotoxy(25,8);textcolor(PINK);cprintf("\n\t[A] for ADDITION");

gotoxy(25,9);textcolor(PINK);cprintf("\n\t[B] for SUBTRACTION");

gotoxy(25,10);textcolor(PINK);cprintf("\n\t[C] for MULTIPLICATION");

gotoxy(25,11);textcolor(PINK);cprintf("\n\t[D] for DIVISION");

gotoxy(25,12);textcolor(PINK);cprintf("\n\t[E] for EXIT");

gotoxy(25,14);textcolor(PINK);cprintf("\nEnter choice here:");scanf("%s",&choice);

switch(choice)

{

case 'A':
clrscr();

gotoxy(35,5);textcolor(BLACK);cprintf("A] A D D I T I O N");

gotoxy(25,7);textcolor(PINK);cprintf("Enter number:");scanf("%d",&a);

gotoxy(25,8);textcolor(PINK);cprintf("Enter another number:");scanf("%d",&b);sum=a+b;

gotoxy(25,10);textcolor(BLACK);cprintf("Sum of two number is: %d",sum);

gotoxy(25,14);textcolor(BLACK);cprintf("Do you want to try again,y/n?");scanf("%s",&z);

menu();

getch();

break;
}

switch(choice)

{

case 'B':

clrscr();

gotoxy(35,5);textcolor(YELLOW);cprintf("B] S U B T R A C T I O N");

gotoxy(25,7);textcolor(LIGHTRED);cprintf("Enter number:");scanf("%d",&a);

gotoxy(25,8);textcolor(LIGHTRED);cprintf("Enter another number:");scanf("%d",&b);sub=a-b;

gotoxy(25,10);textcolor(YELLOW+BLINK);cprintf("DIFFERENCE of two number is: %d",sub);

gotoxy(25,14);textcolor(LIGHTBLUE);cprintf("Do you want to try again,y/n?");scanf("%s",&z);

menu();

getch();

break;

}

switch(choice)

{

case 'C':

clrscr();

gotoxy(35,5);textcolor(YELLOW);cprintf("C] M U L T I P L I C A T I O N");

gotoxy(25,7);textcolor(LIGHTRED);cprintf("Enter number:");scanf("%d",&a);

gotoxy(25,8);textcolor(LIGHTRED);cprintf("Enter another number:");scanf("%d",&b);mul=a*b;

gotoxy(25,10);textcolor(YELLOW+BLINK);cprintf("PRODUCT of two number is: %d",mul);

gotoxy(25,14);textcolor(GREEN);cprintf("Do you want to try again,y/n?");scanf("%s",&z);

menu();

getch();

break;
}

switch(choice)

{

case 'D':

clrscr();

gotoxy(35,5);textcolor(YELLOW);cprintf("D] D I V I S I O N");

gotoxy(25,7);textcolor(LIGHTRED);cprintf("Enter number:");scanf("%d",&a);

gotoxy(25,8);textcolor(LIGHTRED);cprintf("Enter another number:");scanf("%d",&b);div=a/b;

gotoxy(25,10);textcolor(YELLOW+BLINK);cprintf("QOUTIENT of two number is: %d",div);

gotoxy(25,14);textcolor(LIGHTGREEN);cprintf("Do you want to try again,y/n?");

scanf("%s",&z);

menu();

getch();
break;

}
switch(choice)

{

case'E':
gotoxy(15,18);textcolor(LIGHTCYAN);cprintf("\n\nThe program ends here.. THANK YOU!");
}
}

clrscr();

int a,b,x,y,z;
for(x=1;x<=77;x++){

gotoxy(2+x,1);textcolor(LIGHTCYAN);cprintf("Í");

gotoxy(2+x,21);textcolor(LIGHTCYAN);cprintf("Í");}

for(y=1;y<=20;y++)

{

gotoxy(3,1+y);textcolor(LIGHTCYAN);cprintf("º");

gotoxy(79,1+y);textcolor(LIGHTCYAN);cprintf("º");}

gotoxy(3,1);textcolor(LIGHTCYAN);cprintf("É");

gotoxy(3,21);textcolor(LIGHTCYAN);cprintf("È");

gotoxy(79,1);textcolor(LIGHTCYAN);cprintf("»");

gotoxy(79,21);textcolor(LIGHTCYAN);cprintf("¼");

for(a=1;a<=49;a++)

{

gotoxy(15+a,4);textcolor(LIGHTCYAN);cprintf("ß");

gotoxy(15+a,17);textcolor(LIGHTCYAN);cprintf("Ü");}

for(b=1;b<=14;b++){

gotoxy(16,3+b);textcolor(LIGHTCYAN);cprintf("°");

gotoxy(65,3+b);textcolor(LIGHTCYAN);cprintf("° ");

}

}

void main()

{

clrscr();
menu();getch();
}



No comments:

Post a Comment