Hi..
i wanted to make a project for my 12th boards and i chose the topic "Parking Lot Administration". I had started writing all the functions and everything.. but i needed it in BINARY FILE.. n i dont know how to do it..
MY ROUGH CODING IS GIVEN BELOW :
#include<iostream.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
class vehicle
{ char vehno[15];
char typ;
int time;
int level;
public:
int parking_lot_no;
void enter_details(int a)
{ int a;
cout<<"enter the type of vehicle:"<<endl;
gets(typ);
cout<<"enter the vehicle no:"<<endl;
gets(vehno);
cout<<"enter the time of entering (in 24 hr clock):"<<endl;
cin>>time;
cout<<"enter the parking level:"<<endl;
cin>>level;
parking_lot_no=a;
cout<<"parking lot no.:"<<a;
}
void show_details()
{ cout<<"type of vehicle:"<<typ<<endl;
cout<<"vehicle no."<<vehno<<endl;
cout<<"time of entering:"<<time<<endl;
cout<<"parking level:"<<level<<endl;
cout<<"parking lot no.:"<<prking_lot_no<<endl;
}
}
vehicle objE[10000],objD[7000],objC[6000],objB[5000],objA[4000];
void vehicle_entering()
{ char type;
cout<<"two wheelers : E"<<endl;
cout<<"small sized cars : D"<<endl;
cout<<"medium sized cars : C"<<endl;
cout<<"luxury cars : B"<<endl;
cout<<"SUVs : A"<<endl;
cout<<"enter the type of vehicle"<<endl;
gets(type);
if(type==E)
E1();
if(type==D)
D1();
if(type==C)
C1();
if(type==B)
B1();
if(type==A)
A1();
}
void vehicle_leaving()
{ char type;
cout<<"two wheelers : E"<<endl;
cout<<"small sized cars : D"<<endl;
cout<<"medium sized cars : C"<<endl;
cout<<"luxury cars : B"<<endl;
cout<<"SUVs : A"<<endl;
cout<<"enter the type of vehicle"<<endl;
gets(type);
if(type==E)
E2();
if(type==D)
D2();
if(type==C)
C2();
if(type==B)
B2();
if(type==A)
A2();
}
void E1()
{ int space,count=0,i=1,v=0,cv=0;
char ans;
do while
{ space=10000-(i-1);
for(int j=1;j<10001;j++)
{ if(objE[j].parking_slot_no==0)
{ v=j;
count=count+1;
}
}
if(space==0&&count==0)
cout<<"parking lot full"<<endl;
else
if(count>0)
{ objE[v].enter_details(v);
cv=cv+1;
}
if(count==0)
{ int f=i-cv;
objE[f].enter_detail(f);
}
i=i+1;
cout<<"Do you want to continue(y/n)?";<<endl;
gets(ans);
}(ans==y);
}
void D1()
{ int space,count=0,i=1,v=0,cv=0;
char ans;
do while
{ space=7000-(i-1);
for(int j=1;j<7001;j++)
{ if(objD[j].parking_slot_no==0)
{ v=j;
count=count+1;
}
}
if(space==0&&count==0)
cout<<"parking lot full"<<endl;
else
if(count>0)
{ objD[v].enter_details(v);
cv=cv+1;
}
if(count==0)
{ int f=i-cv;
objD[f].enter_detail(f);
}
i=i+1;
cout<<"Do you want to continue(y/n)?";<<endl;
gets(ans);
}(ans==y);
}
void C1()
{ int space,count=0,i=1,v=0,cv=0;
char ans;
do while
{ space=6000-(i-1);
for(int j=1;j<6001;j++)
{ if(objC[j].parking_slot_no==0)
{ v=j;
count=count+1;
}
}
if(space==0&&count==0)
cout<<"parking lot full"<<endl;
else
if(count>0)
{ objC[v].enter_details(v);
cv=cv+1;
}
if(count==0)
{ int f=i-cv;
objC[f].enter_detail(f);
}
i=i+1;
cout<<"Do you want to continue(y/n)?";<<endl;
gets(ans);
}(ans==y);
}
void B1()
{ int space,count=0,i=1,v=0,cv=0;
char ans;
do while
{ space=5000-(i-1);
for(int j=1;j<5001;j++)
{ if(objB[j].parking_slot_no==0)
{ v=j;
count=count+1;
}
}
if(space==0&&count==0)
cout<<"parking lot full"<<endl;
else
if(count>0)
{ objB[v].enter_details(v);
cv=cv+1;
}
if(count==0)
{ int f=i-cv;
objB[f].enter_detail(f);
}
i=i+1;
cout<<"Do you want to continue(y/n)?";<<endl;
gets(ans);
}(ans==y);
}
void A1()
{ int space,count=0,i=1,v=0,cv=0;
char ans;
do while
{ space=4000-(i-1);
for(int j=1;j<4001;j++)
{ if(objA[j].parking_slot_no==0)
{ v=j;
count=count+1;
}
}
if(space==0&&count==0)
cout<<"parking lot full"<<endl;
else
if(count>0)
{ objA[v].enter_details(v);
cv=cv+1;
}
if(count==0)
{ int f=i-cv;
objA[f].enter_detail(f);
}
i=i+1;
cout<<"Do you want to continue(y/n)?";<<endl;
gets(ans);
}(ans==y);
}
void E2()
{ int pkln;
cout<<"enter parking lot no."<<endl;
cin>>pkln;
for(int i=1;i<10001;i++)
{ if(objE[i]==pkln)
objE[i].show_details;
}
cout<<"Amount to be charged Rs.5"<<endl;
cout<<"vehicle is cleared to leave"<<endl;
}
void D2()
{ int pkln;
cout<<"enter parking lot no."<<endl;
cin>>pkln;
for(int i=1;i<70001;i++)
{ if(objD[i]==pkln)
objD[i].show_details;
}
cout<<"Amount to be charged Rs.10"<<endl;
cout<<"vehicle is cleared to leave"<<endl;
}
void C2()
{ int pkln;
cout<<"enter parking lot no."<<endl;
cin>>pkln;
for(int i=1;i<10001;i++)
{ if(objC[i]==pkln)
objC[i].show_details;
}
cout<<"Amount to be charged Rs.20"<<endl;
cout<<"vehicle is cleared to leave"<<endl;
}
void B2()
{ int pkln;
cout<<"enter parking lot no."<<endl;
cin>>pkln;
for(int i=1;i<10001;i++)
{ if(objB[i]==pkln)
objB[i].show_details;
}
cout<<"Amount to be charged Rs.40"<<endl;
cout<<"vehicle is cleared to leave"<<endl;
}
void A2()
{ int pkln;
cout<<"enter parking lot no."<<endl;
cin>>pkln;
for(int i=1;i<10001;i++)
{ if(objA[i]==pkln)
objA[i].show_details;
}
cout<<"Amount to be charged Rs.30"<<endl;
cout<<"vehicle is cleared to leave"<<endl;
}
void main()
{ int ch;
cout<<"1: vehicle entering"<<endl;
cout<<"2: vehicle leaving"<<endl;
cout<<"enter choice"<<endl;
cin>>ch;
if(ch==1)
vehicle_entering();
if(ch==2)
vehicle_leaving();
else
{ cout<<"incorrect choice, enter again"<<endl;
cin>>ch;
}
}
COULD Ne1 help m eout converting it to binary and modifying it a little bit so that it looks like a decent XIIth boards program..
plssssssss do sum1 help.. my carreer depends on this :(
PLSSSS HELP!!!
regards...
djsingh