#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<graphics.h>
#include<ctype.h>
#define MAX 100
struct info{
char name[10];
char car[10];
char plate[10];
}
record [MAX];
counter [MAX];
void box(int startx, int starty, int endx, int endy, int color);
void main()
{
FILE *fp;
main:
int count;
int driver,mode;
driver=VGA;
mode=VGAMED;
initgraph(&driver,&mode,"");
gotoxy(25,1);
char a,b,l;
box(100,20,500,200,70);
setcolor(GREEN);
outtextxy(150,30,"AUTOMOBILE REGISTRATION");
outtextxy(150,50,"Type R for registration of your car");
outtextxy(150,70,"Type S to search the list of listed cars");
outtextxy(150,90,"Type E to Exit");
outtextxy(150,110,"Select R/S/E: ");
a=getche();
clrscr();
switch (toupper(a))
{
case 'R':
count=0;
reg:
clrscr();
int drive,mod;
drive=VGA;
mod=VGAMED;
initgraph(&drive,&mod,"");
box(100,20,500,200,70);
setcolor(BLUE);
fp=fopen("record.dat","a+");
{
if((fp=fopen("record.dat","w"))!=NULL);
{
if((fp=fopen("counter.dat","w"))!=NULL);
}
}
count=count+1;
outtextxy(150,30,"Registration no: ");
gotoxy(45,3);
printf("%d",count);
outtextxy(150,60,"Name of the owner: ");
gotoxy(45,5);
gets(record[count].name);
outtextxy(150,70,"Name of the car: ");
gotoxy(45,6);
gets(record[count].car);
outtextxy(150,80,"Plate number: ");
gotoxy(45,7);
gets(record[count].plate);
fwrite(&record,sizeof(struct info),MAX,fp);
fclose(fp);
clrscr();
int drivey,mody;
drivey=VGA;
mody=VGAMED;
initgraph(&drivey,&mody,"");
box(100,20,500,100,70);
setcolor(GREEN);
outtextxy(150,50,"Register again? Y/N");
b=getche();
switch (toupper(
)
{
case 'Y':
goto reg;
case 'N':
goto main;
default:
goto main;
}
case 'S':
search:
int drivec,modc;
drivec=VGA;
modc=VGAMED;
initgraph(&drivec,&modc,"");
box(100,20,500,200,40);
setcolor(WHITE);
outtextxy(150,50,"Search mode");
outtextxy(150,70,"Owners name?:");
char searchname [20];
int found = 0;
int lola;
gotoxy(40,6);
scanf("%s", &searchname);
if( strcmp(searchname,record[count].name) == 0){
{
outtextxy(150,90,"\nOwner:");
outtextxy(300,90,record[count].name);
outtextxy(150,100,"\nCar:");
outtextxy(300,100,record[count].car);
outtextxy(150,110,"\nPlate No.:");
outtextxy(300,110,record[count].plate);
getch();
}
found = 1;
clrscr();
int delqx,mqelqx;
delqx=VGA;
mqelqx=VGAMED;
initgraph(&delqx,&mqelqx,"");
box(100,20,500,200,90);
outtextxy(150,50,"Goto 1. search again? / 2. mainmenu");
lola=getche();
switch (toupper(lola))
{
case '1':
goto search;
case '2':
goto main;
default:
int delq,mqelq;
delq=VGA;
mqelq=VGAMED;
initgraph(&delq,&mqelq,"");
box(100,20,500,200,RED);
outtextxy(150,50,"INVALID SELECTION!!");
getch();
goto main;
}
} else { found = 0; }
if(found==0){
clrscr();
math:
int da,mqa,lolo;
da=VGA;
mqa=VGAMED;
initgraph(&da,&mqa,"");
box(100,20,500,200,30);
outtextxy(150,50,"No match found!!");
outtextxy(150,70,"Goto 1. search / 2. mainmenu");
lolo=getche();
switch (toupper(lolo))
{
case '1':
goto search;
case '2':
goto main;
default:
int del,mqel;
del=VGA;
mqel=VGAMED;
initgraph(&del,&mqel,"");
box(100,20,500,200,RED);
outtextxy(150,50,"INVALID SELECTION!!");
getch();
goto math;
}
}
break;
case 'E':
int d,mq;
d=VGA;
mq=VGAMED;
initgraph(&d,&mq,"");
box(100,20,500,200,40);
outtextxy(150,50,"Are you sure? Y/N");
b=getche();
switch (toupper(
)
{
case 'Y':
break;
case 'N':
goto main;
default:
clrscr();
int db,mqb;
db=VGA;
mqb=VGAMED;
initgraph(&db,&mqb,"");
box(100,20,500,200,RED);
outtextxy(150,50,"INVALID SELECTION!!");
getch();
goto main;
}
break;
default:
int de,mqe;
de=VGA;
mqe=VGAMED;
initgraph(&de,&mqe,"");
box(100,20,500,200,RED);
outtextxy(150,50,"INVALID SELECTION!!");
getch();
goto main;
}
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);
}