Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream.h>
- #include<stdio.h>
- #include<string.h>
- #include<conio.h>
- #include<stdlib.h>
- void clear_recent();
- void recent();
- void login_menu();
- void login();
- void change();
- void main_menu();
- void mainmenu3();
- void create_record();
- void read_record();
- void search();
- void modify();
- void Delete();
- void add_car();
- void add_inf();
- void delete_car();
- void delete_inf();
- void display_car();
- void display_inf();
- void delay(long);
- void CreateAniline(int,long);
- char pass[30];
- long delay_time=100000;
- class crimdata
- {
- int code;
- char fname[30];
- char lname[30];
- long cost_to_state;
- long fines_due;
- long bounty;
- char casehistory[500];
- public:
- void getd();
- void putd();
- int getcode();
- long getbounty();
- long getfines();
- long getcst();
- char* getfirstname();
- char* getlastname();
- char* getcasehistory();
- }c;
- crimdata stmp;
- long crimdata::getbounty()
- {
- return bounty;
- }
- long crimdata::getfines()
- {
- return fines_due;
- }
- long crimdata::getcst()
- {
- return cost_to_state;
- }
- char* crimdata::getfirstname()
- {
- return fname;
- }
- char* crimdata::getlastname()
- {
- return lname;
- }
- char* crimdata::getcasehistory()
- {
- return casehistory;
- }
- void crimdata::getd()
- {
- cout<<"\nENTER CRIMINAL CODE:\n";
- cin>>code;
- cout<<"\nENTER CRIMINAL'S FIRST NAME:\n";
- gets(fname);
- cout<<"\nENTER CRIMINAL'S LAST NAME:\n";
- gets(lname);
- cout<<"\nENTER COST TO STATE:\n";
- cin>>cost_to_state;
- cout<<"\nENTER FINES DUE:\n";
- cin>>fines_due;
- cout<<"\nENTER BOUNTY:\n";
- cin>>bounty;
- cout<<"\nENTER CASE HISTORY:\n";
- gets(casehistory);
- }
- void crimdata::putd()
- {
- cout<<code<<"\t\t\t"<<fname<<" "<<lname<<"\t\t\t"<<bounty<<endl;
- }
- int crimdata::getcode()
- {
- return code;
- }
- class infractions
- {
- char category[50];
- int no_of_times;
- public:
- void getd();
- void putd();
- char* getiname();
- }i;
- void infractions::getd()
- {
- cout<<"\nENTER INFRACTION CATEGORY CAUSED BY CRIMINAL:\n";
- gets(category);
- cout<<"\nENTER THE NO. OF TIMES THE CRIMINAL HAS CAUSED THE INFRACTION:\n";
- cin>>no_of_times;
- }
- void infractions::putd()
- {
- cout<<category<<"\t\t\t\t"<<no_of_times<<endl;
- }
- char* infractions::getiname()
- {
- return category;
- }
- class vehicle
- {
- char name[30];
- int impound_strike;
- public:
- void getd();
- void putd();
- char* getvname();
- }v;
- void vehicle::getd()
- {
- cout<<"\nENTER VEHICLE NAME USED BY CRIMINAL:\n";
- gets(name);
- cout<<"\nENTER THE NO. OF IMPOUND STRIKES:\n";
- cin>>impound_strike;
- }
- void vehicle::putd()
- {
- cout<<name<<"\t\t\t\t"<<impound_strike<<endl;
- }
- char* vehicle::getvname()
- {
- return name;
- }
- void login_menu()
- {
- char str[30];
- strcpy(str,"DELHI POLICE DEPARTMENT");
- int c,l;
- l=strlen(str);
- cout<<"\n\n\n";
- cout<<"\t - - - - - - - - - - - - - - \n";
- cout<<"\t - - - - - - - - - - - - - - - - \n";
- cout<<"\t - - - - - - - - - - - - \n";
- cout<<"\t - - - - - - - - - - - - - - \n";
- cout<<"\t - - - - - - - - - - - - - \n";
- cout<<"\t - - - - - - - - - - \n";
- cout<<"\t - - - - - - - - - - - \n";
- cout<<"\t - - - - o - - o - - - - \n";
- cout<<"\n\t ";
- for(int i=0;i<=l;i++)
- {
- cout<<str[i];
- delay(delay_time*4);
- }
- cout<<endl;
- cout<<"\n\t\t\t 1. LOGIN";
- cout<<"\n\t\t\t 2. CHANGE PASSWORD";
- cout<<"\n\t\t\t 3. EXIT\n";
- cout<<"\n\t\t\tENTER YOUR CHOICE:";
- cin>>c;
- if(c==1)
- {
- clrscr();
- login();
- }
- else if(c==2)
- {
- clrscr();
- change();
- }
- else if(c==3)
- exit(0);
- else
- {
- clrscr();
- cout<<"\n\n\n\n\t\t\t!!INVALID CHOICE!! ";
- getche();
- clrscr();
- login_menu();
- }
- }
- void login()
- {
- clrscr();
- char p[30];
- int c;
- cout<<"\n\n\n\n\n\t\t\t PASSCODE: ";
- int t=0;
- char ch;
- while(ch!=13)
- {
- ch=getch();
- if(ch==8)
- {
- clrscr();
- cout<<"\n\n\n\n\n\t\t\t PASSCODE: ";
- t=t-1;
- for(int i=0;i<t;i++)
- {
- cout<<"*";
- }
- p[t]='\0';
- }
- else
- {
- p[t]=ch;
- cout<<"*";
- t++;
- }
- }
- p[t-1]='\0';
- ifstream fin("pass.dat",ios::binary);
- fin.getline(pass,30);
- fin.close();
- if(strcmp(p,pass)==0)
- {
- clrscr();
- char str[30];
- int l;
- strcpy(str,"LOGIN SUCCESSFULL");
- l = strlen(str);
- cout<<"\n\n\n\n\n\n\t\t\t ";
- for(int i=0;i<=l;i++)
- {
- cout<<str[i];
- delay(delay_time*4);
- }
- cout<<endl;
- getche();
- clrscr();
- main_menu();
- }
- else
- {
- clrscr();
- selection:
- cout<<"\n\t\t\t!! WRONG PASSCODE !!\n";
- cout<<"\n\t\t\tWANT TO TRY AGAIN???\n";
- cout<<"\n\t\t\t 1. YES ";
- cout<<"\n\t\t\t 2. NO ";
- cout<<"\n\n\t\t\tENTER YOUR CHOICE:";
- cin>>c;
- if(c==1)
- {
- clrscr();
- login();
- }
- else if(c==2)
- {
- clrscr();
- login_menu();
- }
- else
- {
- clrscr();
- cout<<"\n\n\n\n\t\t\tINVALID CHOICE...ENTER A VALID CHOICE!!\n";
- getche();
- clrscr();
- goto selection;
- }
- }
- }
- void change()
- {
- int c;
- char tmp[30];
- clrscr();
- cout<<"\nENTER CURRENT PASSWORD:";
- int t=0;
- char ch;
- while(ch!=13)
- {
- ch=getch();
- if(ch==8)
- {
- clrscr();
- cout<<"\nENTER CURRENT PASSWORD:";
- t=t-1;
- for(int i=0;i<t;i++)
- {
- cout<<"*";
- }
- tmp[t]='\0';
- }
- else
- {
- tmp[t]=ch;
- cout<<"*";
- t++;
- }
- }
- tmp[t-1]='\0';
- ifstream fin("pass.dat",ios::binary);
- fin.getline(pass,30);
- fin.close();
- if(strcmp(pass,tmp)==0)
- {
- t=0;
- clrscr();
- cout<<"\nENTER NEW PASSWORD:";
- ch=0;
- while(ch!=13)
- {
- ch=getch();
- if(ch==8)
- {
- clrscr();
- cout<<"\nENTER NEW PASSWORD:";
- t=t-1;
- for(int i=0;i<t;i++)
- {
- cout<<"*";
- }
- tmp[t]='\0';
- }
- else
- {
- tmp[t]=ch;
- cout<<"*";
- t++;
- }
- }
- tmp[t-1]='\0';
- strcpy(pass,tmp);
- int l=strlen(pass);
- ofstream fout("pass.dat",ios::binary|ios::trunc);
- for(int i=0;i<=l;i++)
- {
- fout.put(pass[i]);
- }
- fout.close();
- cout<<"\n!!PASSWORD CHANGED SUCCESSFULLY!!";
- getche();
- clrscr();
- login_menu();
- }
- else
- {
- selection2:
- clrscr();
- cout<<"\nWRONG CURRENT PASSWORD";
- cout<<"\nWANT TO TRY AGAIN?\n";
- cout<<"\n1.YES\n";
- cout<<"\n2.NO \n";
- cout<<"\nENTER YOUR CHOICE:";
- cin>>c;
- if(c==1)
- {
- clrscr();
- change();
- }
- else if(c==2)
- {
- clrscr();
- login_menu();
- }
- else
- {
- clrscr();
- cout<<"\n\n\n\t\t\tINVALID CHOICE...ENTER A VALID ONE!!";
- getche();
- clrscr();
- goto selection2;
- }
- }
- }
- void main_menu()
- {
- int ch;
- cout<<"\t _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n";
- cout<<"\t _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n";
- cout<<"\t _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n";
- cout<<"\t _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n";
- cout<<"\t _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n";
- cout<<"\n\t\t\t1. CREATE NEW CRIMINAL RECORD";
- cout<<"\n\t\t\t2. DISPLAY ALL CRIMINAL RECORDS";
- cout<<"\n\t\t\t3. DISPLAY RECENTLY OPENED PROFILES";
- cout<<"\n\t\t\t4. ENTER INTO CRIMINAL PROFILE";
- cout<<"\n\t\t\t5. MODIFY EXISTING RECORD";
- cout<<"\n\t\t\t6. REMOVE EXISTING RECORD";
- cout<<"\n\t\t\t7. CLEAR RECENTLY OPENED PROFILES";
- cout<<"\n\t\t\t8. LOGOUT";
- cout<<"\n\t\t\tENTER YOUR CHOICE:";
- cin>>ch;
- if(ch==1)
- {
- clrscr();
- create_record();
- }
- else if(ch==2)
- {
- clrscr();
- read_record();
- }
- else if(ch==3)
- {
- clrscr();
- recent();
- }
- else if(ch==4)
- {
- clrscr();
- search();
- }
- else if(ch==5)
- {
- clrscr();
- modify();
- }
- else if(ch==6)
- {
- clrscr();
- Delete();
- }
- else if(ch==7)
- {
- clrscr();
- clear_recent();
- cout<<"\n\n\n\n\t\t\t HISTORY CLEARED SUCCESSFULLY!! ";
- getche();
- clrscr();
- main_menu();
- }
- else if(ch==8)
- {
- clrscr();
- login_menu();
- }
- else
- {
- cout<<"\nINVALID CHOICE\n";
- getche();
- clrscr();
- main_menu();
- }
- }
- void create_record()
- {
- clrscr();
- char inf[30];
- char car[30];
- ofstream afile("Main.rap",ios::binary|ios::app);
- c.getd();
- afile.write((char*)&c,sizeof(c));
- afile.close();
- cout<<"\nRECORD CREATED SUCCESSFULLY\n";
- getche();
- clrscr();
- main_menu();
- }
- void read_record()
- {
- clrscr();
- ifstream bfile("MAIN.rap",ios::binary);
- cout<<"CODE\t\t\tNAME\t\t\t\tBOUNTY\n";
- while(bfile.read((char*)&c, sizeof(c)))
- {
- CreateAniline(79,delay_time);
- cout<<endl;
- c.putd();
- }
- CreateAniline(79,delay_time);
- bfile.close();
- getche();
- clrscr();
- main_menu();
- }
- void recent()
- {
- ifstream fin("history.rap",ios::binary);
- if(!fin)
- {
- cout<<"\n\n\n\n\t\t\t\tNO RECENT HISTORY ";
- getche();
- clrscr();
- main_menu();
- }
- else
- {
- cout<<"CODE\t\t\tNAME\t\t\t\tBOUNTY";
- cout<<endl;
- CreateAniline(79,delay_time);
- while(fin.read((char*)&c,sizeof(c)))
- {
- c.putd();
- CreateAniline(79,delay_time);
- }
- fin.close();
- getche();
- clrscr();
- main_menu();
- }
- }
- void clear_recent()
- {
- remove("history.rap");
- cout<<"\n\n\n\n\n\n\t\t\tHISTORY REMOVED ";
- getche();
- clrscr();
- main_menu();
- }
- void search()
- {
- int ch;
- cout<<"\n\t\t\tPROFILE MENU";
- cout<<"\n\n\n\n\n\t\t\t1.SEARCH PROFILE BY CODE\n";
- cout<<"\t\t\t2.SEARCH PROFILE BY FIRST NAME\n";
- cout<<"\t\t\t3.SEARCH PROFILE BY BOUNTY\n";
- cout<<"\t\t\t4.BACK\n\n\n";
- cout<<"\t\t\tENTER YOUR CHOICE:";
- cin>>ch;
- crimdata tmp;
- int p=-1;
- int r;
- long b;
- char tmp1[30];
- if(ch==1)
- {
- ifstream cfile("MAIN.rap",ios::binary);
- clrscr();
- cout<<"ENTER THE CRIMINAL CODE:";
- cin>>r;
- clrscr();
- while(cfile.read((char*)&c, sizeof(c)))
- {
- if(c.getcode()==r)
- {
- p++;
- stmp=c;
- ofstream fout("history.rap",ios::binary|ios::app);
- fout.write((char*)&c, sizeof(c));
- fout.close();
- clrscr();
- mainmenu3();
- }
- }
- cfile.close();
- if(p==-1)
- {
- cout<<"\nRECORD NOT FOUND\n";
- getche();
- clrscr();
- main_menu();
- }
- }
- else if(ch==2)
- {
- ifstream cfile("MAIN.rap",ios::binary);
- clrscr();
- cout<<"ENTER THE CRIMINAL FIRST NAME:";
- gets(tmp1);
- clrscr();
- while(cfile.read((char*)&c, sizeof(c)))
- {
- if(strcmp(c.getfirstname(),tmp1)==0)
- {
- p++;
- stmp=c;
- ofstream fout("history.rap",ios::binary|ios::app);
- fout.write((char*)&c, sizeof(c));
- fout.close();
- clrscr();
- mainmenu3();
- }
- }
- cfile.close();
- if(p==-1)
- {
- cout<<"\nRECORD NOT FOUND\n";
- getche();
- clrscr();
- main_menu();
- }
- }
- else if(ch==3)
- {
- ifstream cfile("MAIN.rap",ios::binary);
- clrscr();
- cout<<"ENTER THE CRIMINAL BOUNTY:";
- cin>>b;
- clrscr();
- while(cfile.read((char*)&c, sizeof(c)))
- {
- if(c.getbounty()==b)
- {
- p++;
- stmp=c;
- ofstream fout("history.rap",ios::binary|ios::app);
- fout.write((char*)&c, sizeof(c));
- fout.close();
- clrscr();
- mainmenu3();
- }
- }
- cfile.close();
- if(p==-1)
- {
- cout<<"\nRECORD NOT FOUND\n";
- getche();
- clrscr();
- main_menu();
- }
- }
- else if(ch==4)
- {
- clrscr();
- main_menu();
- }
- else
- {
- cout<<"\nINVALID CHOICE. CHOOSE A VALID OPTION\n";
- getche();
- clrscr();
- search();
- }
- }
- void modify()
- {
- clrscr();
- int ch;
- cout<<"\n\t\t\tMODIFY MENU";
- cout<<"\n\n\n\n\n\t\t\t1.MODIFY BY CODE\n";
- cout<<"\t\t\t2.MODIFY BY FIRST NAME\n";
- cout<<"\t\t\t3.MODIFY BY BOUNTY\n";
- cout<<"\t\t\t4.BACK\n\n\n";
- cout<<"\t\t\tENTER YOUR CHOICE:";
- cin>>ch;
- int p=-1,r,t=0;
- long b;
- char tmp[30];
- if(ch==1)
- {
- fstream finout("MAIN.rap",ios::binary|ios::in|ios::out);
- clrscr();
- cout<<"\nENTER THE CODE OF CRIMINAL:\n";
- cin>>r;
- clrscr();
- while(finout.read((char*)&c,sizeof(c)))
- {
- t++;
- if(c.getcode()==r)
- {
- p++;
- finout.seekp((t-1)*sizeof(c),ios::beg);
- c.getd();
- finout.write((char*)&c,sizeof(c));
- }
- }
- finout.close();
- if(p==-1)
- {
- cout<<"\nRECORD NOT FOUND!!!\n";
- getche();
- clrscr();
- main_menu();
- }
- else
- {
- cout<<"\nRECORD MODIFIED\n";
- getche();
- clrscr();
- main_menu();
- }
- }
- else if(ch==2)
- {
- fstream finout("MAIN.rap",ios::binary|ios::in|ios::out);
- clrscr();
- cout<<"\nENTER THE FIRST NAME OF CRIMINAL:\n";
- gets(tmp);
- clrscr();
- while(finout.read((char*)&c,sizeof(c)))
- {
- t++;
- if(strcmp(c.getfirstname(),tmp)==0)
- {
- p++;
- finout.seekp((t-1)*sizeof(c),ios::beg);
- c.getd();
- finout.write((char*)&c,sizeof(c));
- }
- }
- finout.close();
- if(p==-1)
- {
- cout<<"\nRECORD NOT FOUND!!!\n";
- getche();
- clrscr();
- main_menu();
- }
- else
- {
- cout<<"\nRECORD MODIFIED\n";
- getche();
- clrscr();
- main_menu();
- }
- }
- else if(ch==3)
- {
- fstream finout("MAIN.rap",ios::binary|ios::in|ios::out);
- clrscr();
- cout<<"\nENTER THE BOUNTY OF CRIMINAL:\n";
- cin>>b;
- clrscr();
- while(finout.read((char*)&c,sizeof(c)))
- {
- t++;
- if(c.getbounty()==b)
- {
- p++;
- finout.seekp((t-1)*sizeof(c),ios::beg);
- c.getd();
- finout.write((char*)&c,sizeof(c));
- }
- }
- finout.close();
- if(p==-1)
- {
- cout<<"\nRECORD NOT FOUND!!!\n";
- getche();
- clrscr();
- main_menu();
- }
- else
- {
- cout<<"\nRECORD MODIFIED\n";
- getche();
- clrscr();
- main_menu();
- }
- }
- else if(ch==4)
- {
- clrscr();
- main_menu();
- }
- else
- {
- clrscr();
- cout<<"\n\n\n\n\t\t\t\tINVALID CHOICE...ENTER A VALID ONE\n";
- getche();
- clrscr();
- modify();
- }
- }
- void Delete()
- {
- int r;
- cout<<"\nENTER CRIMINAL CODE TO BE REMOVED:\n";
- cin>>r;
- ofstream fout("tmp.rap",ios::binary|ios::out);
- ifstream fin("MAIN.rap",ios::binary|ios::in);
- while(fin.read((char*)&c,sizeof(c)))
- {
- if(c.getcode()!=r)
- {
- fout.write((char*)&c,sizeof(c));
- }
- }
- remove("MAIN.rap");
- rename("tmp.rap","MAIN.rap");
- fin.close();
- fout.close();
- cout<<"\nRECORD REMOVED\n";
- getche();
- clrscr();
- main_menu();
- }
- void delay(long i)
- {
- for(long j=0;j<=i;j++)
- {}
- }
- void CreateAniline(int s,long t)
- {
- for(int k=0;k<=s;k++)
- {
- cout<<"-";
- delay(t);
- }
- }
- void mainmenu3()
- {
- clrscr();
- int c;
- cout<<"\n";
- CreateAniline(79,delay_time);
- cout<<"\nNAME:"<<stmp.getfirstname()<<" "<<stmp.getlastname()<<"\t\t\t\t"<<"BOUNTY:"<<stmp.getbounty()<<endl;
- cout<<"COST TO STATE:"<<stmp.getcst()<<"\t\t\t\t"<<"FINES DUE:"<<stmp.getfines()<<endl;
- CreateAniline(79,delay_time);
- cout<<"\n\n\n";
- char str1[20];
- cout<<"1. ADD VEHICLE USED\n";
- cout<<"2. ADD INFRACTION CAUSED\n";
- cout<<"3. DELETE VEHICLE USED\n";
- cout<<"4. DELETE INFRACTION CAUSED\n";
- cout<<"5. DISPLAY VEHICLE USED\n";
- cout<<"6. DISPLAY INFRACTIONS CAUSED\n";
- cout<<"7. DISPLAY CASE HISTORY\n";
- cout<<"8. BACK\n";
- cout<<"\n\n";
- cout<<"ENTER YOUR CHOICE:";
- cin>>c;
- switch(c)
- {
- case 1:
- add_car();
- break;
- case 2:
- add_inf();
- break;
- case 3:
- delete_car();
- break;
- case 4:
- delete_inf();
- break;
- case 5:
- display_car();
- break;
- case 6:
- display_inf();
- break;
- case 7:
- clrscr();
- cout<<"\t\t\t\tCASE HISTORY"<<endl;
- CreateAniline(79,delay_time);
- puts(stmp.getcasehistory());
- cout<<endl;
- CreateAniline(79,delay_time);
- getche();
- clrscr();
- mainmenu3();
- break;
- case 8:
- clrscr();
- main_menu();
- break;
- default:
- cout<<"\nINVALID CHOICE\n";
- getche();
- clrscr();
- mainmenu3();
- }
- }
- void add_car()
- {
- clrscr();
- char car[40];
- char fileext[45];
- strcpy(car,"car");
- strcpy(fileext,".car");
- strcat(car,stmp.getfirstname());
- strcat(car,fileext);
- ofstream fout(car,ios::binary|ios::app);
- v.getd();
- fout.write((char*)&v,sizeof(v));
- fout.close();
- cout<<"\n\n"<<"CAR ADDED";
- getche();
- clrscr();
- mainmenu3();
- }
- void add_inf()
- {
- clrscr();
- char inf[40];
- char fileext[45];
- strcpy(inf,"inf");
- strcpy(fileext,".inf");
- strcat(inf,stmp.getfirstname());
- strcat(inf,fileext);
- ofstream fout(inf,ios::binary|ios::app);
- i.getd();
- fout.write((char*)&i,sizeof(i));
- fout.close();
- cout<<"\n\n"<<"INFRACTION ADDED";
- getche();
- clrscr();
- mainmenu3();
- }
- void delete_car()
- {
- clrscr();
- char carname[50];
- char car[40];
- char fileext[45];
- strcpy(car,"car");
- strcpy(fileext,".car");
- strcat(car,stmp.getfirstname());
- strcat(car,fileext);
- cout<<"ENTER THE NAME OF CAR";
- gets(carname);
- ofstream fout("tmp.car",ios::binary);
- ifstream fin(car,ios::binary);
- while(fin.read((char*)&v,sizeof(v)))
- {
- if(strcmp(v.getvname(),carname)!=0)
- {
- fout.write((char*)&v,sizeof(v));
- }
- }
- remove(car);
- rename("tmp.dat",car);
- fout.close();
- fin.close();
- cout<<"\n\nCAR DELETED";
- getche();
- clrscr();
- mainmenu3();
- }
- void delete_inf()
- {
- clrscr();
- char infname[50];
- char inf[40];
- char fileext[45];
- strcpy(inf,"inf");
- strcpy(fileext,".inf");
- strcat(inf,stmp.getfirstname());
- strcat(inf,fileext);
- cout<<"ENTER THE NAME OF INFRACTION";
- gets(infname);
- ofstream fout("tmp.inf",ios::binary);
- ifstream fin(inf,ios::binary);
- while(fin.read((char*)&i,sizeof(i)))
- {
- if(strcmp(i.getiname(),infname)!=0)
- {
- fout.write((char*)&i,sizeof(i));
- }
- }
- remove(inf);
- rename("tmp.dat",inf);
- fin.close();
- fout.close();
- cout<<"\n\nINFRACTION DELETED";
- getche();
- clrscr();
- mainmenu3();
- }
- void display_inf()
- {
- clrscr();
- char inf[40];
- char fileext[45];
- strcpy(inf,"inf");
- strcpy(fileext,".inf");
- strcat(inf,stmp.getfirstname());
- strcat(inf,fileext);
- ifstream fin(inf,ios::binary);
- cout<<"INFRACTION\t\t\t\tNO OF TIMES"<<endl;
- while(fin.read((char*)&i,sizeof(i)))
- {
- CreateAniline(79,delay_time);
- cout<<endl;
- i.putd();
- cout<<endl;
- }
- CreateAniline(79,delay_time);
- getche();
- clrscr();
- mainmenu3();
- }
- void display_car()
- {
- clrscr();
- char car[40];
- char fileext[45];
- strcpy(car,"car");
- strcpy(fileext,".car");
- strcat(car,stmp.getfirstname());
- strcat(car,fileext);
- ifstream fin(car,ios::binary);
- cout<<"VEHICLE NAME\t\t\t\tIMPOUND STRIKES"<<endl;
- while(fin.read((char*)&v,sizeof(v)))
- {
- CreateAniline(79,delay_time);
- cout<<endl;
- v.putd();
- cout<<endl;
- }
- CreateAniline(79,delay_time);
- getche();
- clrscr();
- mainmenu3();
- }
- void main()
- {
- clrscr();
- char ch,tmp[30];
- int t=0;
- ifstream fin("pass.dat",ios::binary);
- if(fin)
- {
- clrscr();
- fin.close();
- login_menu();
- }
- else
- {
- cout<<"\nSET A DEFAULT PASSCODE...YOU CAN CHANGE IT LATER\n";
- cout<<"\nENTER PASSCODE:";
- while(ch!=13)
- {
- ch=getch();
- if(ch==8)
- {
- clrscr();
- cout<<"\nSET A DEFAULT PASSCODE...YOU CAN CHANGE IT LATER\n";
- cout<<"\nENTER PASSCODE:";
- t=t-1;
- for(int i=0;i<t;i++)
- {
- cout<<"*";
- }
- tmp[t]='\0';
- }
- else
- {
- tmp[t]=ch;
- cout<<"*";
- t++;
- }
- }
- tmp[t-1]='\0';
- strcpy(pass,tmp);
- int l=strlen(pass);
- ofstream fout("pass.dat",ios::binary|ios::trunc);
- for(int i=0;i<=l;i++)
- {
- fout.put(pass[i]);
- }
- fout.close();
- cout<<"\nPASSWORD SET SUCCESSFULLY\n";
- getche();
- clrscr();
- login_menu();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment