CODE
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<graphics.h>
#define MAX 100
struct profile{
char mayari[20];
char plaka[13];
char modelo[30];
}record[MAX];
void view();
void box(int startx, int starty, int endx, int endy, int color);
void main()
{
main:
clrscr();
int driver, mode;
driver=VGA;
mode=VGAMED;
initgraph(&driver,&mode,"");
box(80, 20, 570, 320, GREEN);
box(450, 55, 200, 70, BLUE);
char choice;
char xo;
outtextxy(220,60," \t PROTOCOL'S AUTOMOBILE \t");
setcolor(RED);
outtextxy(170,120,"[R] - Registration");
outtextxy(170,140,"[S] - Search");
outtextxy(170,160,"[E] - Exit");
setcolor(YELLOW);
outtextxy(135,284," >>Enter your choice: ");
gotoxy(43,21);
choice=getche();
switch(choice)
{
case 'R':
{goto lagay; }
case 'V':
{goto view; }
case 'E':
{getch(); }
default:
{main(); }
}
lagay:
int bilangCount;
int optxn;
int watawat;
int reNum = 10;
char sNgalan[20];
static struct profile student[10];
clrscr();
bilangCount = 1;
outtextxy(170,1,"\t R E G I S T R A T I O N \t");
for(bilangCount=1; bilangCount <= reNum; bilangCount++)
{
printf("\nEntry Number %d", bilangCount);
printf("\n\nPlate No.:\n ");
gets(student[bilangCount].plaka);
printf("\n\nOwner's Name: \n");
gets(student[bilangCount].mayari);
printf("\n\nAutomobile Model: \n");
gets(student[bilangCount].modelo);
clrscr();
}
for(bilangCount=1; bilangCount <= reNum; bilangCount++)
{
printf("\nEntry Number %d", bilangCount);
printf("\n\nPlate Number: %s", student[bilangCount].plaka);
printf("\nOwner's Name: %s", student[bilangCount].mayari);
printf("\nAutomobile Model: %s", student[bilangCount].modelo);
}
printf("\nPress any key to continue...");
getch();
retry:
clrscr();
printf("\nWhat would you like to do???");
printf("\n\n1 - Search");
printf("\n2 - Exit");
scanf("%d",&optxn);
if(optxn == 1)
{
clrscr();
printf("\nEnter Keyword: ");
scanf("%s",&sNgalan);
watawat = 1;
clrscr();
printf("\nRESULT BELOW: ");
for(bilangCount = 1; bilangCount <= reNum; bilangCount++)
{
if(strcmp(sNgalan,student[bilangCount].plaka) == 0)
{
watawat = 2;
printf("\nResult found in Entry No. %d",bilangCount);
printf(": Plate Number");
}
if(strcmp(sNgalan,student[bilangCount].mayari) == 0)
{
watawat = 2;
printf("\nResult found in Entry No. %d",bilangCount);
printf(": Owner's Name");
}
if(strcmp(sNgalan,student[bilangCount].modelo) == 0)
{
watawat = 2;
printf("\nResult found in Entry No. %d",bilangCount);
printf(": Automobile Model");
}
printf("\n\n\n\nPress any key to continue...");
getch();
goto retry;
}
if(watawat == 1)
{
printf("\n\nKeyword not found!");
printf("\n\n\n\nPress any key to continue...");
getch();
goto retry;
}
}
if(optxn == 2)
{
return;
}
if((optxn != 1) && (optxn != 2))
{
goto retry;
}
getch();
}
void view()
{
static struct profile student[10];
int bilangCount, reNum;
for(bilangCount=1; bilangCount <= reNum; bilangCount++)
{
printf("\nEntry Number %d", bilangCount);
printf("\n\nPlate Number: %s", student[bilangCount].plaka);
printf("\nOwner's Name: %s", student[bilangCount].mayari);
printf("\nAutomobile Model: %s", student[bilangCount].modelo);
}
printf("\nPress any key to continue...");
getch();
}
void box(int startx, int starty, int endx, int endy, int color)
{
setcolor(color);
line(startx, starty, startx, endy);
line(startx, starty, endx, starty);
line(endx, starty, endx, endy);
line(endx, endy, startx, endy);
}