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();
}

Exer 7 CS 121

Photobucket

#include
#include


void main()
{ clrscr();
float grade,average,sum;
int a=0;

while(grade!=-1)
{ sum=sum+grade;
printf("\n\n_-_-_-_-_-_-_-_-_-_-_");
printf("\nEnter grade; -1 to exit");
scanf("%f",&grade);

if(grade==-1)
{printf("\n\n\n\t\t\t.,.,.,.,.,.,.,.,.,.,.,.");
printf("\n\t\t\tAverage is %.2f\n",average=sum/a);}
a++;
}
if(average>=95 && average<=100){ printf("\n\nRated of this average: A");} else if(average>=90 && average<=94){ printf("\n\nRated of this average: B");} else if(average>=89 && average<=90){ printf("\n\nRated of this average: C");} printf("\n\n\n\t\t\t\t\tProgrammed by: Sherluck L. Mercado"); print("\n\t\t\t\t\t\tCS121 (5820) / 12:30-2:30 / H1I"); getch(); }

Exer 6 CS 121

Photobucket


#include
#include

int salary, years, bonus=0, sum=0;
void main(){
clrscr();
printf("\nEnter Salary of employee: P");
scanf("%d", &salary);
printf("\nEnter Years of Service of employee: ");
scanf("%d", &years);
printf("\n=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=");
if (years==1){
bonus=salary*0.10;
sum=bonus+salary;
printf("\n\n>>>Bonus of employee: P%d", bonus);
printf("\n>>>Total Salary of employee is P%d", sum);
printf("\n\n\n\n\t\t\t_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_");
printf("\n\n\t\t\tC O N G R A T U L A T I O N S!!!");
}
else if (years<=5 && years>=2){
bonus=salary*0.20;
sum=bonus+salary;
printf("\n\n>>>Bonus of employee: P%d", bonus);
printf("\n>>>Total Salary of employee is P%d", sum);
printf("\n\n\n\n\t\t\t_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_");
printf("\n\n\t\t\tC O N G R A T U L A T I O N S!!!");
}
else if ((years<=10) && (years>=6)){
bonus=salary*0.50 ;
sum=bonus+salary;
printf("\n\n>>>Bonus of employee: P%d", bonus);
printf("\n>>>Total Salary of employee is P%d", sum);
printf("\n\n\n\n\t\t\t_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_");
printf("\n\n\t\t\tC O N G R A T U L A T I O N S!!!");
}
else if (years<=11){ bonus=salary*0.75; sum=bonus+salary; printf("\n\n>>>Bonus of employee: P%d", bonus);
printf("\n>>>Total Salary of employee is P%d", sum);
printf("\n\n\n\n\t\t\t_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_");
printf("\n\n\t\tC O N G R A T U L A T I O N S!!!");
}

printf("\n\n\t\t\t ~-<<>>-~");
printf("\n\t\t\t=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
printf("\n\n\n\t\t\t\t Programmed by: Sherluck L. Mercado");
printf("\n\t\t\t\t\t\tCS121(5820) / 12:30-2:30 / H1I");

getch();
}

Exer 5 CS 121

Photobucket

#include
#include
#include

void main(){
clrscr();
int num,a,b,x,y,select;
printf("Want to create a NICE PATTERN?\nThis program could fit of what you lookin' for..!!");
printf("\n\nEnter the number of rows you want to execute:");
scanf("%d",&num);
printf("\nSelect pattern you want to appear!");
printf("\n\t¯-¯-¯ [A] for Pattern 1");
printf("\n\t¯-¯-¯ [B] for Pattern 2");
printf("\n\t¯-¯-¯ [C] for Pattern 3");
printf("\n\t¯-¯-¯ [D] for Pattern 4");
printf("\nEnter the CAPITAL letter you choose a certain pattern:");
scanf("%s",&select);

switch(select)
{
case 'A':
for(a=0,y=12;a<=num;a++,y++) { for(b=1,x=37;b<=a;b++,x++) { gotoxy(x,y); printf("*"); } } break; case 'B': for(a=0,y=12;a<=num;a++,y++) { for(b=1,x=37;b<=a;b++,x--) { gotoxy(x,y); printf("*"); } } break; case 'C': for(a=num,y=13;a<=num;a--,y++) { for(b=a,x=38;b>=1;b--,x++)
{
gotoxy(x,y);
printf("*");
}
}
break;
case 'D':
for(a=num,y=13;a>=1;a--,y++)
{
for(b=a,x=38;b>=1;b--,x--)
{
gotoxy(x,y);
printf("*");
}
}
break;
default:
printf("Inputted unavailable");
}
printf("\n\n\t\tW-O-W!! What a nice pattern you've got!!\n\t\t\tThank you for your cooperation..^-^");
printf("\n\n\t\t\t\t¯-¯-¯ Programmed by: SHERLUCK L. MERCADO");
printf("\n\t\t\t\t\tCS121(5820) / 12:30-2:30 / H1I");
getch();
}

Exer 4 CS 121


Photobucket

#include
#include

void main(){
clrscr();
int day;
gotoxy(28,5);printf("Enter an integer:");
scanf("%d",&day);

switch(day){
case 1:
gotoxy(30,10);printf("Sunday");
break;
case 2:
gotoxy(30,10);printf("Monday");
break;
case 3:
gotoxy(30,10);printf("Tuesday");
break;
case 4:
gotoxy(30,10);printf("Wednesday");
break;
case 5:
gotoxy(30,10);printf("Thursday");
break;
case 6:
gotoxy(30,10);printf("Friday");
break;
case 7:
gotoxy(30,10);printf("Saturday");
break;

default:
gotoxy(20,10);printf("S O R R Y !! Day is not available!!");}
printf("\n\n\t\t\t\t\tProgrammed by: SHERLUCK L. MERCADO");
printf("\n\t\t\t\t\tCS121 (5820) / 12:30 - 2:30 / H1I");
getch();

Tuesday, February 10, 2009

Exer 3 CS 121

Photobucket

Photobucket


#include
#include


void main(){
clrscr();
int choice,a,b,n,y,sum=0,sub=0,mul=0,div=0;

printf("\t\t\t >>>>> <<<<>>>> <<<<<"); printf("\t\t\t\t\t\t\t OF THE"); printf("\n\t\t <<<<<>>>>>");
printf("\n\nSelect operation you like to Try!");
printf("\n\n\n\t[A] for ADDITION");
printf("\n\t[B] for SUBTRACTION");
printf("\n\t[C] for MULTIPLICATION");
printf("\n\t[D] for DIVISION");
printf("\n\t[E] for EXIT");
printf("\n\nPlease enter the CAPITAL letter of the operation you choose:");
scanf("%s",&choice);
switch(choice)
{
case 'A':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
sum=a+b;
printf("\n_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
printf("\n\nSummation of two number is: -- %d --",sum);
break;

case 'B':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
sub=a-b;
printf("\n_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
printf("\n\nDifference of two number is: -- %d --",sub);
break;

case 'C':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
mul=a*b;
printf("\n_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
printf("\n\nProduction of two number is: -- %d --",mul);
break;

case 'D':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
div=a/b;
printf("\n_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
printf("\n\nDivision of two number is: -- %d --",div);
break;

case'E':
printf("\n\n-@`~_.,End of the program,._~`@-\n\n>_<>_<"); printf("\n\n\t\t\t\t\t Programmed by: SHERLUCK L. MERCADO"); printf("\n\t\t\t\t\t\tCS121(5820) / 12:30-2:30 / H1I"); } getch(); }

Exer 2 CS 121

Photobucket

#include
#include

main()
{
clrscr();
printf("\t\t\W E L C O M E T O M Y P R O F I L E ! ! \n\n\n");
printf("I am SHERLUCK L. MERCADO");
printf("\nI am 19yrs.old,");
printf("\nI was born on January 30, 1990,");
printf("\nI am simple, a dreamer\n");
printf("\nI live together with my loving family at Talomo, Davao City");
printf("\nI graduated at Talomo National High School");
printf("\n\n\n\t\tThank you for reading my profile about me!!!!");
printf("\n\n\n\n\n\t\t\t\t\t\t- Sherluck L. Mercado");
printf("\n\t\t\t\t\tCS121(5820) / 12:30-2:30 / H1I");
getch();
}