Sunday, March 29, 2009

Case1




#include
#include
#include
#include
#include
#include

int car;
int park[5]={0,0,0,0,0};

void view();
void out();
void in();
void loop();
void load();
void exit();
void swtch();
void frame();
void main()
{

clrscr();
frame();
load();
swtch();
getche();
}

void swtch(){
clrscr();
frame();
_setcursortype(_NOCURSOR);
char c[]={" G A R A G E P A R K I N G S Y S T E M "};
for(int i=0;i5)
{
gotoxy(27,15);textcolor(MAGENTA);cprintf("Slot does not exist!");
getch();

}

if(park[slot-1]==0)
{
park[slot-1]=plate;
gotoxy(25,15);textcolor(MAGENTA);cprintf("Slot was successfully occupied..");
getch();
}

else
{
gotoxy(27,15);textcolor(RED+BLINK);cprintf("Slot is already occupied!");
getch();
}
}

void out()
{
int slot,plate,hours;
int f,e;

gotoxy(34,6);textcolor(LIGHTBLUE);cprintf("O U T");
gotoxy(30,9);textcolor(YELLOW);cprintf("Enter slot:");
scanf("%d",&slot);
gotoxy(30,11);textcolor(YELLOW);cprintf("Enter Plate #: ");
scanf("%d",&plate);
gotoxy(30,13);textcolor(YELLOW);cprintf("Enter hours:");
scanf("%d",&hours);
gotoxy(26,21);textcolor(RED+BLINK);cprintf("Press any key to return...");

if(hours==1){
gotoxy(25,15);textcolor(YELLOW);cprintf(" Your total payment is P5.00");
scanf("%d", &f);
}
else if(hours>=1){
f=hours+2;

gotoxy(25,15);textcolor(YELLOW);cprintf("Your total payment is: P%d",f);
}
else{
gotoxy(29,16);textcolor(WHITE+BLINK);cprintf("INVALID HOURS!");
}
if(slot>5)
{
gotoxy(28,17);textcolor(RED+BLINK);cprintf("Error! Slot not found!!");
getch();
}
if(park[slot-1]==plate&&park[slot-1]!=hours)
{
park[slot-1]=0;
gotoxy(28,18);textcolor(WHITE);cprintf("Slot is now available.");
getch();
}
else
{
gotoxy(29,19);textcolor(WHITE+BLINK);cprintf("Invalid slot...");
getch();
}
}

void view()
{
int save;

gotoxy(28,6);textcolor(LIGHTBLUE);cprintf(" V I E W R E C O R D S");
gotoxy(26,9);textcolor(GREEN);cprintf(" SLOT PLATE # ");
gotoxy(26,21);textcolor(RED+BLINK);cprintf("Press any key to return...");

for(save=0;save<=4;save++) { gotoxy(28,10+save);textcolor(GREEN);cprintf("[%d] %d\n\n",save+1,park[save]); } getch(); } void frame() { int x,y; int a,b; for(x=1;x<=77;x++) { gotoxy(2+x,1);textcolor(7);cprintf("Ñ"); gotoxy(2+x,24);textcolor(7);cprintf("Ñ"); } for(y=1;y<=22;y++){ gotoxy(3,1+y);textcolor(YELLOW);cprintf("¶"); gotoxy(79,1+y);textcolor(YELLOW);cprintf("¶"); } gotoxy(3,1);textcolor(YELLOW);cprintf("É"); gotoxy(3,24);textcolor(YELLOW);cprintf("È"); gotoxy(79,1);textcolor(YELLOW);cprintf("»"); gotoxy(79,24);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("Ý "); } time_t timer; struct tm *tblock; timer = time(NULL); tblock = localtime(&timer); gotoxy(35,23);textcolor(WHITE);cprintf("The time is: %s", asctime(tblock)); } void loop() { _setcursortype(_NOCURSOR); for(int e=0;e<=25;e++){ gotoxy(5+e,23);textcolor(YELLOW);cprintf("¯"); } for(int p=0;(p<=25*4);p++){ gotoxy(5+(p/4),23);textcolor(RED);cprintf("¯"); gotoxy(5,24);textcolor(6);cprintf("%d%",p); delay(7); } for(int o=0;o<=25;o++){ gotoxy(5+o,23);textcolor(GREEN);cprintf("¯"); } } void load() { _setcursortype(_NOCURSOR); for(int e=0;e<=25;e++){ gotoxy(5+e,23);textcolor(WHITE);cprintf("¯"); } gotoxy(9,20);textcolor(RED+BLINK);cprintf("LOADING......"); for(int i=0;(i<=50*2);i++){ gotoxy(5+(i/4),21);textcolor(RED);cprintf("¯"); gotoxy(5,22);textcolor(6);cprintf("%d%",i); delay(10); } for(int o=0;o<=25;o++){ gotoxy(5+o,23);textcolor(GREEN);cprintf("¯"); } } void exit() { clrscr(); frame(); _setcursortype(_SOLIDCURSOR); char c[]={"Thank You! and Come Again!!"}; for(int x=0;x
gotoxy(25+x,9);
textcolor(CYAN);
cprintf("%c",c[x]);
delay(40);
}}

No comments:

Post a Comment