Sunday, February 15, 2009

Exercise no. 8

Exercise # 8:

#include
#include


void main()
{
clrscr();
float sum,grade,average;
int a=0;
gotoxy(17,3);textcolor(WHITE);cprintf("E X E R C I S E # 8/ G R A D I N G S Y S T E M\n");
while(grade!=-1)
{sum=sum+grade;
printf("\nEnter grade;-1 to exit:");
scanf("%f",&grade);

if(grade==-1)
{printf("\nAverage is %.2f\n",average=sum/a);}
a++;
}
if(average>=95 && average<=100.00){
printf("\n\nRated of this average: A");}
else if(average>=90 && average<=94.99){
printf("\n\nRated of this average: B");}
else if(average>=85 && average<=89.99){
printf("\n\nRated of this average: C");}
else if(average>=80 && average<=84.99){
printf("\n\nRated of this average: D");}
else if(average>=75 && average<=79.99){
printf("\n\nRated of this average: E");}
else if(average<74){
printf("\n\nS O R R Y!!! Y O U F A I L E D ! ! !");
}
getch();
}
OUTPUT:

Exercise no. 7

Exercise # 7:

#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(LIGHTCYAN);cprintf("Í");
//delay (10);
gotoxy(2+x,21);textcolor(LIGHTCYAN);cprintf("Í");
//delay (10);
}
for(y=1;y<=20;y++)
{
gotoxy(3,1+y);textcolor(LIGHTCYAN);cprintf("º");
//delay (10);
gotoxy(79,1+y);textcolor(LIGHTCYAN);cprintf("º");
//delay (10);
}
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()
{
nextscreen();
nextscreen2();
int choice,a,b,n,y,sum=0,sub=0,mul=0,div=0,z;
gotoxy(30,2);textcolor(YELLOW);cprintf("E X E R C I S E 7");
gotoxy(30,5);textcolor(LIGHTRED);cprintf("W E L C O M E ! ! !");
gotoxy(26,6);textcolor(CYAN);cprintf("\nSelect operation you like to Try!");
gotoxy(25,8);textcolor(YELLOW+BLINK);cprintf("\n\t[A] for ADDITION");
gotoxy(25,9);textcolor(GREEN);cprintf("\n\t[B] for SUBTRACTION");
gotoxy(25,10);textcolor(LIGHTMAGENTA+BLINK);cprintf("\n\t[C] for MULTIPLICATION");
gotoxy(25,11);textcolor(LIGHTBLUE);cprintf("\n\t[D] for DIVISION");
gotoxy(25,12);textcolor(RED+BLINK);cprintf("\n\t[E] for Exit");
gotoxy(25,14);textcolor(CYAN);cprintf("\nEnter your choice operation here:");
scanf("%s",&choice);
switch(choice)
{
case 'A':

clrscr();

nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(RED);cprintf("A] A D D I T I O N");
gotoxy(25,6);textcolor(RED);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(BLUE);cprintf("Enter another number:");
scanf("%d",&b);
sum=a+b;
gotoxy(25,10);textcolor(YELLOW+BLINK);cprintf("Sum of two number is: %d",sum);
gotoxy(25,12);textcolor(CYAN);cprintf("NICE ONE!!!!!!!!!!\n");
gotoxy(25,14);textcolor(LIGHTBLUE);cprintf("Do you want to try again,y/n?");
scanf("%s",&z);
menu();
getch();
break;


}
switch(choice)
{
case 'B': clrscr();
nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(YELLOW);cprintf("B] S U B T R A C T I O N");
gotoxy(25,6);textcolor(RED);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(LIGHTCYAN);cprintf("Enter another number:");
scanf("%d",&b);
sub=a-b;
gotoxy(25,10);textcolor(YELLOW+BLINK);cprintf("Subtraction of two number is: %d",sub);
gotoxy(25,12);textcolor(CYAN);cprintf("NICE ONE!!!!!!!!!!");
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();
nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(YELLOW);cprintf("C] M U L T I P L I C A T I O N");
gotoxy(25,6);textcolor(RED);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(BLUE);cprintf("Enter another number:");
scanf("%d",&b);
mul=a*b;
gotoxy(25,10);textcolor(YELLOW+BLINK);cprintf("Muliplication of two number is: %d",mul);
gotoxy(25,12);textcolor(CYAN);cprintf("NICE ONE!!!!!!!!!!");
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();
nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(YELLOW);cprintf("D] D I V I S I O N");
gotoxy(25,6);textcolor(LIGHTRED);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(LIGHTCYAN);cprintf("Enter another number:");
scanf("%d",&b);
div=a/b;
gotoxy(25,10);textcolor(YELLOW+BLINK);cprintf("Division of two number is: %d",div);
gotoxy(25,12);textcolor(CYAN);cprintf("NICE ONE!!!!!!!!!!");
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(25,18);textcolor(WHITE+BLINK);cprintf("Originated by: \"Richard C. Aguillon\"");
gotoxy(15,18);textcolor(CYAN);cprintf("\n\nEnd of the program,Thankyou very much!!!! har har har har....");

}


}
void nextscreen2()

{
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(RED);cprintf("É");
gotoxy(3,21);textcolor(RED);cprintf("È");
gotoxy(79,1);textcolor(RED);cprintf("»");
gotoxy(79,21);textcolor(RED);cprintf("¼");
for(a=1;a<=49;a++)
{
gotoxy(15+a,4);textcolor(LIGHTBLUE);cprintf("ß");
gotoxy(15+a,17);textcolor(LIGHTBLUE);cprintf("Ü");
}
for(b=1;b<=14;b++)
{
gotoxy(16,3+b);textcolor(LIGHTBLUE);cprintf("°");
gotoxy(65,3+b);textcolor(LIGHTBLUE);cprintf("° ");
}
}
void main()
{
clrscr();

nextscreen();
nextscreen2();
menu();
getch();

}
OUTPUT:




Exercise no. 6

Exercise # 6:


#include
#include

void main(){
clrscr();
int salary,years,bonus,sum;
gotoxy(28,5);textcolor(LIGHTCYAN);cprintf("E X E R C I S E 6 / S A L A R Y");
gotoxy(24,6);textcolor(LIGHTCYAN);cprintf("\n\tEnter employees Salary here:");
scanf("%d",&salary);

gotoxy(24,7);textcolor(LIGHTRED);cprintf("\n\tEnter years:");
scanf("%d",&years);

switch(years){

case 1:
bonus=0.10*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(RED);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTBLUE);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 2:
bonus=0.20*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(YELLOW);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 3:
bonus=0.20*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTGREEN);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTCYAN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 4:
bonus=0.10*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTCYAN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 5:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTRED);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTBLUE);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 6:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(GREEN);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTCYAN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;

case 7:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(25,8);textcolor(YELLOW);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTGREEN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 8:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTRED);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTGREEN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 9:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(DARKGRAY);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;

case 10:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTCYAN);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTBLUE);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
}
if(years>=11)
{
bonus=0.75*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTGREEN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
}
gotoxy(25,11);textcolor(WHITE);cprintf("\n\n\" GOOD JOB! KEEP UP THE GOOD WORK!!! \"");

getch();
}
OUTPUT:

Exercise no. 5

Exercise # 5:

#include
#include
#include

void main(){
clrscr();
int h,i,j,x,y,choice,X;
gotoxy(26,3);textcolor(LIGHTCYAN+BLINK);cprintf("E X E R C I S E 5 / P A T T E R N");
gotoxy(25,4);textcolor(LIGHTRED);cprintf("\nEnter your favorite number:");
gotoxy(52,5);textcolor(WHITE);scanf("%d",&h);
gotoxy(25,6);textcolor(CYAN);cprintf("\nSelect pattern you like to appear!");
gotoxy(25,8);textcolor(BLUE);cprintf("\n\t[A] for Pattern 1");
gotoxy(25,9);textcolor(DARKGRAY);cprintf("\n\t[B] for Pattern 2");
gotoxy(25,10);textcolor(LIGHTGREEN);cprintf("\n\t[C] for Pattern 3");
gotoxy(25,11);textcolor(YELLOW);cprintf("\n\t[D] for Pattern 4");
gotoxy(25,13);textcolor(RED);cprintf("\nEnter your choice Pattern here:");
gotoxy(56,14);textcolor(WHITE);scanf("%s",&choice);
switch(choice)
{
case 'A':
for(i=1,y=15;i<=h;i++,y++)
{
for(j=1,x=40;j<=i;j++,x++)
{
gotoxy(x,y);
printf("*");
}
}
break;
}
switch(choice)
{
case 'B':
for(i=1,y=15;i<=h;i++,y++)
{
for(j=1,x=40;j<=i;j++,x--)
{
gotoxy(x,y);
printf("*");
}
}
break;
}
switch(choice)
{
case 'C':
for(i=h,y=15;i<=h;i--,y++)
{
for(j=i,x=40;j>=1;j--,x++)
{
gotoxy(x,y);
printf("*");
}
}
break;
}
switch(choice)
{
case 'D':
for(i=h,y=15;i>=1;i--,y++)
{
for(j=i,x=40;j>=1;j--,x--)
{
gotoxy(x,y);
printf("*");
}
}
break;
}
gotoxy(15,20);textcolor(MAGENTA);cprintf("\n\nEnd of the program,Thankyou very much!!!! hahahahahah....");
getch();
}
OUTPUT:



Exercise no. 4

Exercise # 4:

#include
#include

void main(){
clrscr();
int day,z,d;
gotoxy(30,3);textcolor(LIGHTCYAN);cprintf("E X E R C I S E 4");
gotoxy(28,5);textcolor(LIGHTRED);cprintf("Enter an integer:");
scanf("%d",&day);

switch(day){
case 1:
gotoxy(35,7);textcolor(LIGHTGREEN+BLINK);cprintf("Sunday");
break;
case 2:
gotoxy(35,7);textcolor(LIGHTRED+BLINK);cprintf("Monday");


break;
case 3:
gotoxy(35,7);textcolor(MAGENTA+BLINK);cprintf("Tuesday");
break;
case 4:
gotoxy(35,7);textcolor(GREEN+BLINK);cprintf("Wednesday");
break;
case 5:
gotoxy(35,7);textcolor(CYAN+BLINK);cprintf("Thursday");
break;
case 6:
gotoxy(35,7);textcolor(YELLOW+BLINK);cprintf("Friday");
break;
case 7:
gotoxy(35,7);textcolor(LIGHTBLUE+BLINK);cprintf("Saturday");
break;

default:
gotoxy(20,9);textcolor(CYAN);cprintf("S O R R Y ! ! !Day is not available!!!!!");}


getch();

}
OUTPUT:

Exercise no. 3

Exercise # 3:


#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(LIGHTBLUE);cprintf("Í");

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

}
for(y=1;y<=20;y++)
{
gotoxy(3,1+y);textcolor(LIGHTBLUE);cprintf("º");

gotoxy(79,1+y);textcolor(LIGHTBLUE);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()
{ clrscr();
nextscreen();
nextscreen2();
int a,b,sum=0,sub=0,mul=0,div=0;

gotoxy(22,5);textcolor(LIGHTCYAN);cprintf("S I M P L E C A L C U L A T I O N ! ! !");
gotoxy(22,7);textcolor(LIGHTRED);cprintf("Enter first number:");
scanf("%d",&a);
gotoxy(22,8);textcolor(YELLOW);cprintf("Enter Second Number:");
scanf("%d",&b);
sum=a+b;
sub=a-b;
mul=a*b;
div=a/b;

gotoxy(25,11);textcolor(LIGHTRED);cprintf("The sum of two number is %d\n",sum);
gotoxy(25,12);textcolor(YELLOW);cprintf("The difference of two number is %d",sub);
gotoxy(25,13);textcolor(LIGHTBLUE);cprintf("The product of two number is %d",mul);
gotoxy(25,14);textcolor(CYAN);cprintf("The qoutient of two number is %d",div);


}
void nextscreen2()

{
clrscr();
int a,b,x,y,z;

for(x=1;x<=77;x++)
{
gotoxy(2+x,1);textcolor(YELLOW);cprintf("Í");
gotoxy(2+x,21);textcolor(YELLOW);cprintf("Í");
}
for(y=1;y<=20;y++){
gotoxy(3,1+y);textcolor(YELLOW);cprintf("º");
gotoxy(79,1+y);textcolor(YELLOW);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("¼");
for(a=1;a<=49;a++)
{
gotoxy(15+a,4);textcolor(LIGHTBLUE);cprintf("°");
gotoxy(15+a,17);textcolor(LIGHTBLUE);cprintf("°");
}
for(b=1;b<=14;b++)
{
gotoxy(16,3+b);textcolor(LIGHTBLUE);cprintf("°");
gotoxy(65,3+b);textcolor(LIGHTBLUE);cprintf("° ");
}
}
void main()
{
clrscr();

nextscreen();
nextscreen2();
menu();
getch();



}
OUTPUT:

Exercise no. 2

Exercise # 2:

#include
#include

void main()
{
clrscr();
gotoxy(18,1);textcolor(LIGHTBLUE);cprintf("E X E R C I S E 2/ A U T O B I O G R A P H Y");
gotoxy(18,3);textcolor(CYAN);cprintf("  W E L C O M E T O M Y P R O F I L E \n\n");

gotoxy(18,5);textcolor(LIGHTBLUE);cprintf("MY name is Richard Aguillon, a man who are aiming to be a famous person in the world!!!!I was born on July 6, 1989; at Bula Zone 9 G.S.C. there I grow up and Learn something about reality that LIfe is so very short but so so.....so exciting and full of surprise you've never been experienced. I am a serious kind of person, I have a lot of friends but few of them I consider my True friends.I like people who have positive outlook in life, Kind,Generous,Loving and Caring.");
gotoxy(18,12);textcolor(YELLOW);cprintf("\"Pain is always been there in life........This pain makes us more brave and strong enough to deal with this unsophisticated LIFE. But because of the people surrounded us, LOVE us and CARE us we face all the odds with courage and determination\"");
gotoxy(18,16);textcolor(LIGHTRED);cprintf("Education is my first priority, cause i know that thi]s will give me a bright future someday, despite of all challenges I've been experiences in these couple of days.");
gotoxy(22,20);textcolor(LIGHTGREEN);cprintf("THANK YOU FOR READING AND VIEWING ME!!!");

getch();


}
OUTPUT: