Monday, February 16, 2009

Output:
Exer8




#include
#include
#include
#include

void nextscreen();
void nextscreen2();
void box();
void loop();


void main()
{
nextscreen();
nextscreen2();
getche();
}

void loop()
{
for(int i=1;i<=25;i++) { gotoxy(29+i,16);textcolor(RED);cprintf("Û"); delay(60); } for(int o=1;o<=25;o++) { gotoxy(29+o,16);textcolor(YELLOW);cprintf("°"); } } void nextscreen2() { clrscr(); int a,b,x,y,z,choice; 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(YELLOW);cprintf("É"); gotoxy(3,21);textcolor(YELLOW);cprintf("È"); gotoxy(79,1);textcolor(YELLOW);cprintf("»"); gotoxy(79,21);textcolor(YELLOW);cprintf("¼"); for(a=1;a<=49;a++) { gotoxy(15+a,4);textcolor(CYAN);cprintf("ß"); gotoxy(15+a,17);textcolor(CYAN);cprintf("Ü"); } for(b=1;b<=14;b++) { gotoxy(16,3+b);textcolor(CYAN);cprintf("Þ"); gotoxy(65,3+b);textcolor(CYAN);cprintf("Ý "); } gotoxy(35,3);textcolor(GREEN);cprintf("M E N U"); gotoxy(30,6);textcolor(GREEN);cprintf("[1] Addition "); gotoxy(30,8);textcolor(GREEN);cprintf("[2] Subtraction"); gotoxy(30,10);textcolor(GREEN);cprintf("[3] Multplication"); gotoxy(30,12);textcolor(GREEN);cprintf("[4] Division"); gotoxy(30,14);textcolor(GREEN);cprintf("[5] Exit"); gotoxy(30,15);textcolor(YELLOW);cprintf("Please make your choice:"); scanf("%d",&choice); switch(choice){ case 1: float sum=0,x,y; clrscr(); box(); gotoxy(30,7);textcolor(LIGHTRED);cprintf("Enter 1st number: "); scanf("%f", &x); gotoxy(30,8);textcolor(LIGHTRED);cprintf("Enter 2nd number: "); scanf("%f", &y); sum=x+y; gotoxy(30,10);textcolor(YELLOW);cprintf("Sum is %f.", sum); getche(); nextscreen2(); break; case 2: float dif=0,a,b; clrscr(); box(); gotoxy(30,7);textcolor(LIGHTRED);cprintf("Enter 1st number: "); scanf("%f", &a); gotoxy(30,8);textcolor(LIGHTRED);cprintf("Enter 2nd number: "); scanf("%f", &b); dif=a-b; gotoxy(30,10);textcolor(YELLOW);cprintf("Difference is %f.", dif); getche();nextscreen2(); break; case 3: float pro=0,c,d; clrscr(); box(); gotoxy(30,7);textcolor(LIGHTRED);cprintf("Enter 1st number: "); scanf("%f", &c); gotoxy(30,8);textcolor(LIGHTRED);cprintf("Enter 2nd number: "); scanf("%f", &d); pro=c*d; gotoxy(30,10);textcolor(YELLOW);cprintf("Product is %f.", pro); getche();nextscreen2(); break; case 4: float quo=0,e,f; clrscr(); box(); gotoxy(30,7);textcolor(LIGHTRED);cprintf("Enter 1st number: "); scanf("%f", &e); gotoxy(30,8);textcolor(LIGHTRED);cprintf("Enter 2nd number: "); scanf("%f", &f); quo=e/f; gotoxy(30,10);textcolor(YELLOW);cprintf("Quotient is %f.", quo); getche();nextscreen2(); break; case 5: exit (0);nextscreen2(); break; default: gotoxy(30,16);textcolor(WHITE);cprintf("Invalid input"); getche();nextscreen2(); break; } getche(); } void nextscreen() { 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(YELLOW);cprintf("É"); gotoxy(3,21);textcolor(YELLOW);cprintf("È"); gotoxy(79,1);textcolor(YELLOW);cprintf("»"); gotoxy(79,21);textcolor(YELLOW);cprintf("¼"); for(a=1;a<=49;a++) { gotoxy(15+a,4);textcolor(CYAN);cprintf("ß"); gotoxy(15+a,17);textcolor(CYAN);cprintf("Ü"); } for(b=1;b<=14;b++) { gotoxy(16,3+b);textcolor(CYAN);cprintf("Þ"); gotoxy(65,3+b);textcolor(CYAN);cprintf("Ý "); } gotoxy(35,3);textcolor(GREEN);cprintf("W E L C O M E"); gotoxy(40,6);textcolor(GREEN);cprintf("T O"); gotoxy(30,8);textcolor(GREEN);cprintf("C S 1 2 1 "); gotoxy(40,10);textcolor(GREEN);cprintf("P R O G R A M M I N G"); gotoxy(30,12);textcolor(GREEN);cprintf("W O R L D"); for(z=1;z<=25;z++){ gotoxy(29+z,16);textcolor(YELLOW);cprintf("ß"); } gotoxy(28,15);textcolor(RED);cprintf("LOADING......"); for(int d=1;d<=5;d++) { loop(); } } void box() { 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(CYAN);cprintf("É"); gotoxy(3,21);textcolor(CYAN);cprintf("È"); gotoxy(79,1);textcolor(CYAN);cprintf("»"); gotoxy(79,21);textcolor(CYAN);cprintf("¼"); for(a=1;a<=49;a++) { gotoxy(15+a,4);textcolor(CYAN);cprintf("ß"); gotoxy(15+a,17);textcolor(CYAN);cprintf("Ü"); } for(b=1;b<=14;b++) { gotoxy(16,3+b);textcolor(CYAN);cprintf("Þ"); gotoxy(65,3+b);textcolor(CYAN);cprintf("Ý "); } }
Output:
Exer7



#include
#include

int salary,years,bonus;
void main()
{
clrscr();
printf("Enter salary:\n");
scanf("%d",&salary);
printf("Enter years of service:\n");
scanf("%d",&years);
bonus=0;
if (years==1)
{
bonus=salary*0.10;
printf("Bonus:%d",bonus);
}
else if((years<=5)&&(years>=2)){
bonus=salary*0.20;
printf("Bonus:%d",bonus);
}
else if((years<=10&&(years>=6)))
{
bonus=salary*0.50;
printf("Bonus:%d",bonus);}
else if((years<=11)){
bonus=salary*0.75;
printf("Bonus:%d",bonus);
}
getch();
}
Output:
Exer6




#include

#include
float grade, average, items, sum;

void main(){

clrscr();

average=0;sum=0;do{

printf("Enter grade (-1 to exit): ");

scanf("%f", &grade);

if((grade!=-1)&&(grade<=100)){items++;sum=sum+grade;}}

while(grade!=-1);
average=sum/items;printf("Class Average: %.2f\n", average);
if((average>=95)&&(average<=100)){

printf("Rating: A");}

else if((average>=90)&&(average<=94)){printf("Rating: B");}

else if((average>=85)&&(average<=89)){printf("Rating: C");}

else if((average>=80)&&(average<=84)){printf("Rating: D");}

else if((average>=75)&&(average<=79)){printf("Rating: E");}

else if(average<=74){printf("Rating: FAILED");} getch();

}
Output:
Exer5





#include
#include

void main()
{
int a, b, c;
int choice;

clrscr();
printf("\n Enter a number: ");
scanf("%d", &a);

printf("\n\t\t[A] - Pattern 1\n\n");
printf("\t\t[B] - Pattern 2\n\n");
printf("\t\t[C] - Pattern 3\n\n");
printf("\t\t[D] - Pattern 4\n\n");

printf("Select your choice: ");
scanf("%s",&choice);

switch (choice)
{
case 'A':
printf("\n ");
for(b=1; b<=a; b++) { for(c=1; c<=b; c++) printf("*"); printf("\n "); } break; case 'B': printf("\n "); for(c=a; c>=1; c--)
{
for(b=1; b<=c; b++) printf("*"); printf("\n "); } break; case 'C': printf("\n "); for(b=1; b<=a; b++) { for(c=1; c<=(a-b); c++) printf(" "); for(c=1; c<=b; c++) printf("*"); printf("\n "); } break; case 'D': printf("\n "); for(int b=a-1; b>=0; b--)
{
for(int c=b; c
printf(" ");
for(int d=0; d<=b; d++) printf("*"); printf("\n "); } break; default: clrscr(); printf("\n\n\n\n\t\t\tYour choice is not available!\n\n\n\n\t\t\tTry again later...!!!"); } getch(); }
Output:
Exer4








#include
#include

void main(){
clrscr();
int day;
gotoxy(30,5);textcolor(YELLOW+BLINK);cprintf("._. W e L c O m e ._.");
gotoxy(15,8);textcolor(GREEN);cprintf("Enter a number:");
scanf("%d",&day);

switch(day){
case 1:
gotoxy(25,10);textcolor(LIGHTRED);cprintf("Sunday");
break;

case 2:
gotoxy(25,10);textcolor(LIGHTRED);cprintf("Monday");
break;

case 3:
gotoxy(25,10);textcolor(LIGHTRED);cprintf("Tuesday");
break;

case 4:
gotoxy(25,10);textcolor(LIGHTRED);cprintf("Wednesday");
break;

case 5:
gotoxy(25,10);textcolor(LIGHTRED);cprintf("Thursday");
break;

case 6:
gotoxy(25,10);textcolor(LIGHTRED);cprintf("Friday");
break;

case 7:
gotoxy(25,10);textcolor(LIGHTRED);cprintf("Saturday");
break;

default:
gotoxy(20,10);textcolor(LIGHTRED);cprintf("Oops! Sorry! That day is not available!");}


getch();

}
Output:
Exer3



#include
#include

float num1,num2,sum=0,diff=0,pro=0,quo=0;
void main(){
clrscr();
gotoxy(25,4);textcolor(YELLOW);cprintf("Basic Operations\n\n");
gotoxy(12,7);textcolor(GREEN);cprintf("Enter 1st number:");
scanf("%f", &num1);
gotoxy(12,8);textcolor(GREEN);cprintf("Enter 2nd number:");
scanf("%f", &num2);
sum=num1+num2;
gotoxy(15,11);textcolor(MAGENTA);cprintf("Sum of %.2f and %.2f is %.2f",num1,num2,sum);
diff=num1-num2;
gotoxy(15,13);textcolor(MAGENTA);cprintf("Difference of %.2f and %.2f is %.2f",num1,num2,diff);
pro=num1*num2;
gotoxy(15,15);textcolor(MAGENTA);cprintf("Product of %.2f and %.2f is %.2f",num1,num2,pro);
quo=num1/num2;
gotoxy(15,17);textcolor(MAGENTA);cprintf("Quotient of %.2f and %.2f is %.2f",num1,num2,quo);
getch();
}



Output:
Exer2


#include
#include

void main()
{
clrscr();
char name[22],age[2];
gotoxy(33,3);
printf("MY AUTOBIOGRAPHY\n");
gotoxy(8,5);
printf("I am Kimberly B. Barbarono, 17 yrs. old, I was born on January 1, 1992\n");
printf("in Panes, Kolambog, Isulan, Sultan Kudarat.My father's name is Tito Barbarono.\n");
printf("And my mother's name is Haide Barbarono. My father is a farmer and my mother is a housewife.");
printf("We are seven in the family, I have two sisters and two brothers.");
printf("\nI am studying at Universty of Mindanao taking up information technology.\n");
printf("I am friendly, cute and lovable");

getch();
}