Advertisement
Guest User

Untitled

a guest
May 26th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.58 KB | None | 0 0
  1. // license.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4.  
  5.  
  6. #include <stdafx.h>
  7. #include <iostream>
  8. #include <string>
  9. #include <fstream>
  10. #include <sstream>
  11. #include <list>
  12. #include "new"
  13. using namespace std;
  14.  
  15.  
  16. class license{
  17.  
  18. protected:
  19. string owner_remark;
  20. string name;
  21. string valid_from;
  22. string valid_till;
  23. string license_num;
  24.  
  25. public:
  26. friend class company;
  27. string get_License_num(){
  28. return license_num;
  29. }
  30.  
  31.  
  32. //Copy constructor needed.......................................
  33.  
  34.  
  35. license(string as_name,string as_valid_from,string as_valid_till,string as_license_num, string as_owner_remark){
  36.  
  37. owner_remark=as_owner_remark; //
  38. name=as_name;
  39. valid_from=as_valid_from;
  40. valid_till=as_valid_till; //
  41. license_num=as_license_num;}
  42.  
  43. void print_license(){
  44. cout<<"These information is for the LICENSE of the below metioned bearer:"<<endl;
  45. cout<<"Names:"<<" "<<name<<endl;
  46. cout<<"Licence remarks:"<<" "<<owner_remark<<endl;
  47. cout<<"Valid from:"<<" "<<valid_from<<endl;
  48. cout<<"Valid Till:"<<" "<<valid_till<<endl;
  49. cout<<"Licence Number:"<<" "<<license_num<<endl;}
  50.  
  51.  
  52.  
  53. };
  54.  
  55.  
  56.  
  57. class d_license: public license {
  58. private:
  59. friend class company;
  60. string date_of_birth;
  61. string license_class;
  62. string passport_num;
  63. string city;
  64. string vehicle_type;
  65. string surname;
  66. public:
  67. int get_d_license();// Not used yet
  68. // copy constructors needed.
  69.  
  70. d_license(string as_surname,string as_date_of_birth,string as_license_class, string as_passport_num,
  71. string as_city,string as_vehicle_type,string as_name,string as_valid_from,string as_valid_till,
  72. string as_license_num, string as_owner_remark)
  73. :license( as_name, as_valid_from,as_valid_till,as_license_num,as_owner_remark){
  74.  
  75.  
  76. surname=as_surname;
  77. date_of_birth=as_date_of_birth;
  78. license_class=as_license_class;
  79. passport_num=as_passport_num;
  80. city=as_city;
  81. vehicle_type=as_vehicle_type;}
  82.  
  83. void print_license(){
  84. cout<<"These information is for the DRIVING LICENSE of the below metioned bearer:"<<endl;
  85. cout<<"Name:"<<" "<<name<<endl;
  86. cout<<"Surname:"<<" "<<surname<<endl;
  87. cout<<"Date of birth:"<<" "<<date_of_birth<<endl;
  88. cout<<"Licence class:"<<" "<<license_class<<endl;
  89. cout<<"Passport Number:"<<" "<<passport_num<<endl;
  90. cout<<"City:"<<" "<<city<<endl;
  91. cout<<"Vehicle Type:"<<" "<<vehicle_type<<endl;
  92. cout<<"Licence remarks:"<<" "<<owner_remark<<endl;
  93. cout<<"Valid from:"<<" "<<valid_from<<endl;
  94. cout<<"Valid Till:"<<" "<<valid_till<<endl;
  95. cout<<"Licence Number:"<<" "<<license_num<<endl;
  96. }
  97.  
  98. };
  99.  
  100. class business_license:public license{
  101.  
  102. private:
  103. friend class company;
  104. string location;
  105. string remark;
  106. string category;
  107.  
  108. public:
  109. int get_business_license();
  110.  
  111. business_license(string as_location,string as_remark,string as_category,string as_name,string as_valid_from,
  112. string as_valid_till,string as_license_num, string as_owner_remark)
  113. :license(as_name, as_valid_from,as_valid_till,as_license_num,as_owner_remark){
  114.  
  115.  
  116. location=as_location;
  117. remark=as_remark;
  118. category=as_category;
  119. }
  120. void print_license(){
  121. cout<<"Name:"<<" "<<name<<endl;
  122. cout<<"Licence remarks:"<<" "<<owner_remark<<endl;
  123. cout<<"Valid from:"<<" "<<valid_from<<endl;
  124. cout<<"Valid Till:"<<" "<<valid_till<<endl;
  125. cout<<"Licence Number:"<<" "<<license_num<<endl;
  126. cout<<"Location:"<<" "<<location<<endl;
  127. cout<<"Remark:"<<" "<<remark<<endl;
  128. cout<<"category:"<<" "<<category<<endl;
  129. }
  130.  
  131. };
  132.  
  133.  
  134.  
  135. class animal_license : public license{
  136.  
  137. private:
  138. friend class company;
  139. string district;
  140. string animal_type;
  141. public:
  142. int get_animal_license();
  143.  
  144. animal_license(string as_district,string as_animal_type, string as_name,string as_valid_from,string as_valid_till,
  145. string as_license_num, string as_owner_remark)
  146. :license(as_name, as_valid_from,as_valid_till,as_license_num,as_owner_remark){
  147.  
  148.  
  149. district=as_district;
  150. animal_type=as_animal_type;
  151. }
  152.  
  153. void print_license(){
  154. cout<<"Name:"<<" "<<name<<endl;
  155. cout<<"Licence remarks:"<<" "<<owner_remark<<endl;
  156. cout<<"Valid from:"<<" "<<valid_from<<endl;
  157. cout<<"Valid Till:"<<" "<<valid_till<<endl;
  158. cout<<"Licence Number:"<<" "<<license_num<<endl;
  159. cout<<"District:"<<" "<<district<<endl;
  160. cout<<"Type of Animal:"<<" "<<animal_type<<endl;}
  161.  
  162. };
  163.  
  164. class company{
  165. private:
  166. list<license*>general;
  167. list<license*>::iterator l;
  168.  
  169. list<d_license*>vehicle;
  170. list<d_license*>::iterator v;
  171.  
  172. list<business_license*>business;
  173. list<business_license*>::iterator b;
  174.  
  175. list<animal_license*>animal;
  176. list<animal_license*>::iterator a;
  177.  
  178. public:
  179. //operators that add/removes objects to/from the list
  180. void operator+(license &licen){
  181. general.push_back(&licen);
  182. return;}
  183.  
  184. void operator+(d_license &vehi){
  185. vehicle.push_back(&vehi);
  186. return;}
  187.  
  188. void operator+(business_license &lic){
  189. business.push_back(&lic);
  190. return;
  191. }
  192.  
  193. void operator+(animal_license &anim){
  194. animal.push_back(&anim);
  195. return;
  196. }
  197. //////////////////////////////////////////////////////////////////////////////////////////////
  198.  
  199. /*
  200. void operator-(animal_license &anim){
  201. animal.erase(&anim);
  202. return;
  203. }
  204. */
  205. ///////////////////////////////////////////////////////////////////////////
  206.  
  207. //Methods dispaly
  208. void display_license(){
  209. cout<<"Total #:"<<general.size()<<endl;
  210. int i=1;
  211. l=general.begin();
  212. while(l!=general.end()){
  213. cout<<i<<")"<<endl;
  214. (*l)->print_license();
  215. cout<<endl;
  216. i+=1;
  217. l++;}
  218.  
  219. return;}
  220.  
  221. void display_d_license(){
  222. int i=1;
  223. cout<<"Total #:"<<vehicle.size()<<endl;
  224. v=vehicle.begin();
  225. while(v!=vehicle.end()){
  226. cout<<i<<")"<<endl;
  227. (*v)->print_license();
  228. cout<<endl;
  229. i+=1;
  230. v++;
  231. }
  232.  
  233. return;}
  234.  
  235. void display_business_license(){
  236. int i=1;
  237. cout<<"Total #:"<<business.size()<<endl;
  238. b=business.begin();
  239. while(b!=business.end()){
  240. cout<<i<<")"<<endl;
  241. (*b)->print_license();
  242. cout<<endl;
  243. i+=1;
  244. b++;
  245. }
  246.  
  247. return;}
  248.  
  249. void display_animal_license(){
  250. int i=1;
  251. cout<<"Total #:"<<animal.size()<<endl;
  252. //if(animal.size()!=0){
  253. a=animal.begin();
  254. while(a!=animal.end()){
  255. cout<<i<<")"<<endl;
  256. (*a)->print_license();
  257. cout<<endl;
  258. i+=1;
  259. a++;
  260. }
  261. //}
  262.  
  263. return;}
  264. //Methods search.
  265.  
  266. void search_license(string alf){
  267.  
  268. if((general.size())!=0){
  269. l=general.begin();
  270. while(l!=general.end()){
  271. //cout<<(*l)->license_num<<" is "<<alf<<endl;//////////////////////////////////////
  272. if((*l)->license_num==alf){
  273. (*l)->print_license();
  274. return;}
  275.  
  276. l++;
  277.  
  278. }}
  279. cout<<"Sorry, there is no such License number as "<<" '"<<alf<<"' "<<"registered in our database"<<endl;
  280. }
  281.  
  282.  
  283. void search_d_license(string alf){
  284.  
  285. if((vehicle.size())!=0){
  286. v=vehicle.begin();
  287. while(v!=vehicle.end()){
  288. if((*v)->license_num==alf){
  289. (*v)->print_license();
  290. return;}
  291.  
  292. v++;
  293.  
  294. }}
  295.  
  296.  
  297. cout<<"Sorry, there is no such License number as "<<" '"<<alf<<"' "<<"registered in our database"<<endl;
  298. }
  299.  
  300.  
  301. void search_business_license(string alf){
  302.  
  303. if((business.size())!=0){
  304. b=business.begin();
  305. while(b!=business.end()){
  306. if((*b)->license_num==alf){
  307. (*b)->print_license();
  308. return;}
  309.  
  310. b++;
  311.  
  312. }}
  313.  
  314.  
  315. cout<<"Sorry, there is no such License number as "<<" '"<<alf<<"' "<<"registered in our database"<<endl;
  316. }
  317.  
  318.  
  319. void search_animal_license(string alf){
  320.  
  321. if((animal.size())!=0){
  322. a=animal.begin();
  323. while(a!=animal.end()){
  324. if((*a)->license_num==alf){
  325. (*a)->print_license();
  326. return;}
  327.  
  328. a++;
  329.  
  330. }}
  331.  
  332. cout<<"Sorry, there is no such License number as "<<" '"<<alf<<"' "<<"registered in our database"<<endl;
  333.  
  334. }
  335.  
  336. //method remove
  337.  
  338. void remove_license(string alf){
  339.  
  340. if((general.size())!=0){
  341. l=general.begin();
  342. while(l!=general.end()){
  343. if((*l)->license_num==alf){
  344. general.remove(*l);
  345. return;}
  346.  
  347. l++;
  348.  
  349. }}
  350. cout<<"Sorry, the document with license#:"<<alf<<" can not be deleted because it doesn't exist"<<endl;
  351. }
  352.  
  353. void remove_d_license(string alf){
  354.  
  355. if((vehicle.size())!=0){
  356. v=vehicle.begin();
  357. while(v!=vehicle.end()){
  358. if((*v)->license_num==alf){
  359. vehicle.remove(*v);
  360. return;}
  361.  
  362. v++;
  363.  
  364. }}
  365. cout<<"Sorry, the document with license#:"<<alf<<" can not be deleted because it doesn't exist"<<endl;
  366. }
  367.  
  368.  
  369. void remove_business_license(string alf){
  370.  
  371. if((business.size())!=0){
  372. b=business.begin();
  373. while(b!=business.end()){
  374. if((*b)->license_num==alf){
  375. business.remove(*b);
  376. return;}
  377.  
  378. b++;
  379.  
  380. }}
  381. cout<<"Sorry, the document with license#:"<<alf<<" can not be deleted because it doesn't exist"<<endl;
  382. }
  383.  
  384. void remove_animal_license(string alf){
  385.  
  386. if((animal.size())!=0){
  387. a=animal.begin();
  388. while(a!=animal.end()){
  389. if((*a)->license_num==alf){
  390. animal.remove(*a);
  391. return;}
  392.  
  393. a++;
  394.  
  395. }}
  396. cout<<"Sorry, the document with license#:"<<alf<<" can not be deleted because it doesn't exist"<<endl;
  397. }
  398.  
  399.  
  400.  
  401.  
  402. void save_license(ofstream &license){
  403. l=general.begin();
  404. while(l!=general.end()){
  405. license<<(*l)->name<<' '<<(*l)->valid_from<<' '<<(*l)->valid_till<<' '<<(*l)->license_num<<' '<<(*l)->owner_remark<<endl;
  406.  
  407. l++;}
  408. }
  409.  
  410. void save_business_license(ofstream &business_license){
  411. b=business.begin();
  412. while(b!=business.end()){
  413. business_license<<(*b)-> location<<' '<< (*b)->remark<<' '<< (*b)->category<<' '<<(*b)->name<<' '<<(*b)->valid_from<<' '<<(*b)->valid_till<<' '<<(*b)->license_num<<' '<<(*b)->owner_remark<<endl;
  414.  
  415. b++;}
  416. }
  417.  
  418.  
  419. void save_d_license(ofstream &d_license){
  420. v=vehicle.begin();
  421. while(v!=vehicle.end()){
  422. d_license<<(*v)->surname<<' '<< (*v)->date_of_birth<<' '<<(*v)->license_class<<' '<<(*v)->passport_num<<' '<<(*v)->city<<' '<<(*v)->vehicle_type<<' '<<(*v)->name<<' '<<(*v)->valid_from<<' '<<(*v)->valid_till<<' '<<(*v)->license_num<<' '<<(*v)->owner_remark<<endl;
  423.  
  424. v++;}
  425. }
  426.  
  427.  
  428. void save_animal_license(ofstream &animal_license){
  429. a=animal.begin();
  430. while(a!=animal.end()){
  431. animal_license<<(*a)->district<<' '<<(*a)->animal_type<<' '<<(*a)->name<<' '<<(*a)->valid_from<<' '<<(*a)->valid_till<<' '<<(*a)->license_num<<' '<<(*a)->owner_remark<<endl;
  432.  
  433. a++;}
  434. }
  435.  
  436.  
  437.  
  438. };
  439. int main()
  440. {
  441. company folder;
  442.  
  443.  
  444. string name;
  445. string valid_from;
  446. string valid_till;
  447. string license_num;
  448. string owner_remark;
  449. string surname;
  450. string date_of_birth;
  451. string license_class;
  452. string passport_num;
  453. string city;
  454. string vehicle_type;
  455. string owner_name;
  456. string pet_name;
  457. string owner_location;
  458. string location;
  459. string remark;
  460. string category;
  461. string district;
  462. string animal_type;
  463.  
  464. ifstream file2;//
  465. file2.open("licenses.txt");
  466. if(file2.is_open()){
  467. while(!(file2.eof()) ){
  468. getline(file2,name);
  469. getline(file2,valid_from);
  470. getline(file2,valid_till);
  471. getline(file2,license_num);
  472. getline(file2,owner_remark);
  473. license km(name,valid_from,valid_till,license_num,owner_remark);
  474.  
  475. folder+km;
  476. file2.close();}}
  477.  
  478.  
  479. ifstream file3;//
  480. file3.open("vehicles.txt");
  481. if(file3.is_open()){
  482. while(!(file3.eof()) ){
  483. getline(file3,surname);
  484. getline(file3,date_of_birth);
  485. getline(file3,license_class);
  486. getline(file3,passport_num);
  487. getline(file3,city);
  488. getline(file3,vehicle_type);
  489. getline(file3,valid_from);
  490. getline(file3,valid_till);
  491. getline(file3,license_num);
  492. getline(file3,owner_remark);
  493. d_license kc( surname, date_of_birth,license_class,passport_num,city,vehicle_type,name,valid_from,valid_till,license_num,owner_remark);
  494.  
  495. folder+kc;
  496. file3.close();}}
  497.  
  498. ifstream file4;//
  499. file4.open("businesss.txt");
  500. if(file4.is_open()){
  501. while(!(file4.eof()) ){
  502. getline(file4,location);
  503. getline(file4,remark);
  504. getline(file4,category);
  505. getline(file4,name);
  506. getline(file4,valid_from);
  507. getline(file4,valid_till);
  508. getline(file4,license_num);
  509. getline(file4,owner_remark);
  510. business_license op( location, remark, category,name,valid_from,valid_till,license_num,owner_remark);;
  511.  
  512. folder+op;
  513. file4.close();}}
  514.  
  515.  
  516. ifstream file5;//
  517. file5.open("animals.txt");
  518. if(file5.is_open()){
  519. while(!(file5.eof()) ){
  520. getline(file5,district);
  521. getline(file5,animal_type);
  522. getline(file5,name);
  523. getline(file5,valid_from);
  524. getline(file5,valid_till);
  525. getline(file5,license_num);
  526. getline(file5,owner_remark);
  527. animal_license zz(district,animal_type,name,valid_from,valid_till,license_num,owner_remark);
  528.  
  529. folder+zz;
  530. file5.close();}}
  531.  
  532.  
  533.  
  534.  
  535.  
  536. cout<<"Please correctly Enter license Number for the document( If you only want to view documents(Licenses) please exit this field with the Enter botton) :"<<endl;
  537.  
  538.  
  539. cout<<"Enter:";
  540. getline(cin,license_num);
  541.  
  542. cout<<license_num<<endl;
  543.  
  544. int q,w,e;
  545.  
  546. cout<<"\t\t\t\t"<<"Welcome!!"<<endl<<endl;
  547. cout<<" What do you want to do now?:"<<endl;
  548. cout<<"1. Add a Document(Licenses)?::Enter '1' !!!!"<<endl;
  549. cout<<"2. Search for a document(Licenses)?::Enter '2' !!!!"<<endl;
  550. cout<<"3. Delete a document(Licenses)?::Enter '3' !!!!"<<endl;
  551. cout<<"4. View all documents(Licenses)?::Enter '4' !!!!"<<endl<<endl;
  552.  
  553. cout<<"Enter:";
  554.  
  555. cin>>q;
  556.  
  557. cout<<endl<<endl;
  558.  
  559. /*if(q==2 || q==3 || ){ VERY IMPORTANT
  560.  
  561. cout<<"Please correctly Enter license Number for the document( If you only want to view documents(Licenses) please exit this field with the Enter botton) :"<<endl;
  562. cout<<"Enter:";
  563. getline(cin,license_num);
  564. cout<<license_num<<endl;}*/
  565.  
  566.  
  567.  
  568. if(q==1){
  569.  
  570.  
  571. cout<<"What License?:"<<endl;
  572. cout<<"General License(s)::Enter '1' !!!"<<endl;
  573. cout<<"Business License(s)::Enter '2' !!!"<<endl;
  574. cout<<"Driving License(s)::Enter '3' !!!"<<endl;
  575. cout<<"Animal/pet License(s)::Enter '4' !!!"<<endl<<endl;
  576. cout<<"Enter:";
  577.  
  578.  
  579. cin>>w;
  580.  
  581. while(w==1){
  582.  
  583. cout<<"Fill these following fields:"<<endl<<endl;
  584. cout<<"Names(First name and last name):";
  585. getline(cin,name);
  586. if(getline(cin,name)==" " || name==""){
  587. cout<<"Sorry all information in this field are required!"<<endl;
  588. continue;
  589. }
  590. cout<<endl;
  591.  
  592. cout<<"Issued date :";
  593. getline(cin,valid_from);
  594. if( valid_from==""){
  595. cout<<"Sorry this field is required!"<<endl;
  596. continue;
  597. }
  598. cout<<endl;
  599.  
  600.  
  601. cout<<"Expiry Date:";
  602. getline(cin,valid_till);
  603.  
  604. if( valid_till==""){
  605. cout<<"Sorry all information in this field are required!"<<endl;
  606. continue;
  607. }
  608. cout<<endl;
  609.  
  610.  
  611. cout<<"License Number:";
  612. getline(cin,license_num);
  613. if( name==""){
  614. cout<<"Sorry all information in this field are required!"<<endl;
  615. continue;
  616. }
  617. cout<<endl;
  618.  
  619. cout<<"Remark for the bearer:";
  620. getline(cin,owner_remark);
  621. if( owner_remark==""){
  622. cout<<"Sorry all information in this field are required!"<<endl;
  623. continue;
  624. }
  625. cout<<endl<<endl;
  626.  
  627. cout<<"Name:"<<name<<endl;
  628. cout<<"Issued from:"<<valid_from<<endl;
  629. cout<<"Expiry date:"<<valid_till<<endl;
  630. cout<<"License Number:"<<license_num<<endl;
  631. cout<<"Remark for the bearer:"<<owner_remark<<endl;
  632.  
  633. cout<<"Verify! If correct enter '1' else '0':";
  634. cin>>e;
  635.  
  636. if(e==1){
  637. license on( name, valid_from,valid_till,license_num,owner_remark);
  638. folder + on;
  639. ofstream file1;
  640. file1.open("licenses.txt");
  641. folder.save_license(file1);
  642. file1.close();
  643.  
  644. }
  645.  
  646. else{
  647.  
  648.  
  649. continue;
  650. }
  651.  
  652. break;
  653.  
  654. }
  655.  
  656. /////////////////////////////////////////
  657.  
  658.  
  659.  
  660.  
  661. while(w==3){
  662.  
  663. cout<<"Fill these following fields:"<<endl<<endl;
  664. cout<<"Name:";
  665. getline(cin,name);
  666. if(getline(cin,name)==" " || name==""){
  667. cout<<"Sorry all information in this field are required!"<<endl;
  668. continue;
  669. }
  670. cout<<endl;
  671.  
  672.  
  673. cout<<"Surname:";
  674. getline(cin,surname);
  675. if( surname==""){
  676. cout<<"Sorry all information in this field are required!"<<endl;
  677. continue;
  678. }
  679. cout<<endl;
  680.  
  681.  
  682. cout<<"Date of Birth:";
  683. getline(cin,date_of_birth);
  684. if( date_of_birth==""){
  685. cout<<"Sorry all information in this field are required!"<<endl;
  686. continue;
  687. }
  688. cout<<endl;
  689.  
  690.  
  691.  
  692. cout<<"License class:";
  693. getline(cin,license_class);
  694. if( license_class==""){
  695. cout<<"Sorry all information in this field are required!"<<endl;
  696. continue;
  697. }
  698. cout<<endl;
  699.  
  700.  
  701. cout<<"Passport Number:";
  702. getline(cin,passport_num);
  703. if( passport_num==""){
  704. cout<<"Sorry all information in this field are required!"<<endl;
  705. continue;
  706. }
  707. cout<<endl;
  708.  
  709. cout<<"City:";
  710. getline(cin,city);
  711. if( city==""){
  712. cout<<"Sorry all information in this field are required!"<<endl;
  713. continue;
  714. }
  715. cout<<endl;
  716.  
  717. cout<<"Vehicle Type:";
  718. getline(cin,vehicle_type);
  719. if( vehicle_type==""){
  720. cout<<"Sorry all information in this field are required!"<<endl;
  721. continue;
  722. }
  723. cout<<endl;
  724.  
  725.  
  726.  
  727. cout<<"Issued date :";
  728. getline(cin,valid_from);
  729. if( valid_from==""){
  730. cout<<"Sorry this field is required!"<<endl;
  731. continue;
  732. }
  733. cout<<endl;
  734.  
  735.  
  736. cout<<"Expiry Date:";
  737. getline(cin,valid_till);
  738.  
  739. if( valid_till==""){
  740. cout<<"Sorry all information in this field are required!"<<endl;
  741. continue;
  742. }
  743. cout<<endl;
  744.  
  745.  
  746. cout<<"License Number:";
  747. getline(cin,license_num);
  748. if( name==""){
  749. cout<<"Sorry all information in this field are required!"<<endl;
  750. continue;
  751. }
  752. cout<<endl;
  753.  
  754. cout<<"Remark for the bearer:";
  755. getline(cin,owner_remark);
  756. if( owner_remark==""){
  757. cout<<"Sorry all information in this field are required!"<<endl;
  758. continue;
  759. }
  760. cout<<endl<<endl;
  761.  
  762. cout<<"Name:"<<name<<endl;
  763. cout<<"Surname:"<<surname<<endl;
  764. cout<<"Date of birth:"<<date_of_birth<<endl;
  765. cout<<"License class:"<<license_class<<endl;
  766. cout<<"Passport Number:"<<passport_num<<endl;
  767. cout<<"City:"<<city<<endl;
  768. cout<<"Vehicle Type:"<<vehicle_type<<endl;
  769. cout<<"Issued from:"<<valid_from<<endl;
  770. cout<<"Expiry date:"<<valid_till<<endl;
  771. cout<<"License Number:"<<license_num<<endl;////////////////////
  772. cout<<"Remark for the bearer:"<<owner_remark<<endl;
  773.  
  774. cout<<"Verify! If correct enter '1' else '0':";
  775. cin>>e;
  776.  
  777. if(e==1){
  778. d_license k( surname, date_of_birth,license_class,passport_num,city,vehicle_type,name,valid_from,valid_till,license_num,owner_remark);////
  779.  
  780. folder+k;
  781. ofstream file3;
  782. file3.open("vehicles.txt");
  783. folder.save_d_license(file3);
  784. file3.close();
  785.  
  786. }
  787.  
  788. else{
  789.  
  790. continue;}
  791.  
  792.  
  793.  
  794.  
  795. break;
  796.  
  797.  
  798. }
  799.  
  800.  
  801. while(w==2){
  802.  
  803. cout<<"Fill these following fields:"<<endl<<endl;
  804. cout<<"Company's name:";
  805. getline(cin,name);
  806. if(getline(cin,name)==" " || name==""){
  807. cout<<"Sorry all information in this field are required!"<<endl;
  808. continue;
  809. }
  810. cout<<endl;
  811.  
  812. cout<<"Issued date :";
  813. getline(cin,valid_from);
  814. if( valid_from==""){
  815. cout<<"Sorry this field is required!"<<endl;
  816. continue;
  817. }
  818. cout<<endl;
  819.  
  820.  
  821. cout<<"Expiry Date:";
  822. getline(cin,valid_till);
  823.  
  824. if( valid_till==""){
  825. cout<<"Sorry all information in this field are required!"<<endl;
  826. continue;
  827. }
  828. cout<<endl;
  829.  
  830.  
  831. cout<<"License Number:";
  832. getline(cin,license_num);
  833. if( name==""){
  834. cout<<"Sorry all information in this field are required!"<<endl;
  835. continue;
  836. }
  837. cout<<endl;
  838.  
  839. cout<<"Remark for the bearer:";
  840. getline(cin,owner_remark);
  841. if( owner_remark==""){
  842. cout<<"Sorry all information in this field are required!"<<endl;
  843. continue;
  844. }
  845. cout<<endl;
  846.  
  847.  
  848. cout<<"Location of Business:";
  849. getline(cin,location);
  850. if( location==""){
  851. cout<<"Sorry all information in this field are required!"<<endl;
  852. continue;
  853. }
  854. cout<<endl;
  855.  
  856.  
  857. cout<<"Companies Remark:";
  858. getline(cin,remark);
  859. if( remark==""){
  860. cout<<"Sorry all information in this field are required!"<<endl;
  861. continue;
  862. }
  863. cout<<endl;
  864.  
  865. cout<<"Category of Business:";
  866. getline(cin,category);
  867. if( category==""){
  868. cout<<"Sorry all information in this field are required!"<<endl;
  869. continue;
  870. }
  871. cout<<endl<<endl;
  872.  
  873. cout<<"Name:"<<name<<endl;
  874. cout<<"Issued from:"<<valid_from<<endl;
  875. cout<<"Expiry date:"<<valid_till<<endl;
  876. cout<<"License Number:"<<license_num<<endl;
  877. cout<<"Remark for the bearer:"<<owner_remark<<endl;
  878. cout<<"Business Location:"<<location<<endl;
  879. cout<<"Company's Remark:"<<remark<<endl;
  880. cout<<"Category of Business:"<<category<<endl;
  881.  
  882. cout<<"Verify! If correct enter '1' else '0':";
  883. cin>>e;
  884.  
  885. if(e==1){
  886. business_license n( location, remark, category,name,valid_from,valid_till,license_num,owner_remark);
  887. folder + n;
  888. ofstream file4;
  889. file4.open("businesss.txt");
  890. folder.save_business_license(file4);
  891. file4.close();
  892.  
  893. }
  894.  
  895. else{
  896.  
  897.  
  898. continue;
  899. }
  900.  
  901.  
  902. break;
  903. }
  904.  
  905.  
  906.  
  907. while(w==4){
  908. cout<<"Fill these following fields:"<<endl<<endl;
  909. cout<<"Animal's name:";
  910. getline(cin,name);
  911. if(getline(cin,name)==" " || name==""){
  912. cout<<"Sorry all information in this field are required!"<<endl;
  913. continue;
  914. }
  915. cout<<endl;
  916.  
  917. cout<<"Issued date :";
  918. getline(cin,valid_from);
  919. if( valid_from==""){
  920. cout<<"Sorry this field is required!"<<endl;
  921. continue;
  922. }
  923. cout<<endl;
  924.  
  925.  
  926. cout<<"Expiry Date:";
  927. getline(cin,valid_till);
  928.  
  929. if( valid_till==""){
  930. cout<<"Sorry all information in this field are required!"<<endl;
  931. continue;
  932. }
  933. cout<<endl;
  934.  
  935.  
  936. cout<<"License Number:";
  937. getline(cin,license_num);
  938. if( name==""){
  939. cout<<"Sorry all information in this field are required!"<<endl;
  940. continue;
  941. }
  942. cout<<endl;
  943.  
  944. cout<<"Remark for pet owner:";
  945. getline(cin,owner_remark);
  946. if( owner_remark==""){
  947. cout<<"Sorry all information in this field are required!"<<endl;
  948. continue;
  949. }
  950. cout<<endl;
  951.  
  952.  
  953.  
  954. cout<<"District:";
  955. getline(cin,district);
  956. if( district==""){
  957. cout<<"Sorry all information in this field are required!"<<endl;
  958. continue;
  959. }
  960. cout<<endl;
  961.  
  962.  
  963. cout<<"Type of Animal/pet:";
  964. getline(cin,animal_type);
  965. if( animal_type==""){
  966. cout<<"Sorry all information in this field are required!"<<endl;
  967. continue;
  968. }
  969. cout<<endl<<endl;
  970.  
  971. cout<<"Name:"<<name<<endl;
  972. cout<<"Issued from:"<<valid_from<<endl;
  973. cout<<"Expiry date:"<<valid_till<<endl;
  974. cout<<"License Number:"<<license_num<<endl;
  975. cout<<"Remark for the bearer:"<<owner_remark<<endl;
  976. cout<<"District:"<<district<<endl;
  977.  
  978. cout<<"Verify! If correct enter '1' else '0':";
  979. cin>>e;
  980.  
  981. if(e==1){
  982. animal_license l(district,animal_type,name,valid_from,valid_till,license_num,owner_remark);
  983. folder + l;
  984. ofstream file5;
  985. file5.open("animals.txt");
  986. folder.save_business_license(file5);
  987. file5.close();
  988.  
  989. }
  990.  
  991. else{
  992.  
  993.  
  994. continue;
  995. }
  996.  
  997.  
  998. break;
  999. }
  1000.  
  1001. }
  1002.  
  1003. if (q==2){
  1004.  
  1005.  
  1006.  
  1007. cout<<"What Category of Document ?:"<<endl;
  1008. cout<<"General License?::Enter 1"<<endl;
  1009. cout<<"Bussiness License?::Enter 2"<<endl;
  1010. cout<<"Driving license?::Enter 3"<<endl;
  1011. cout<<"Animal License?::Enter 4"<<endl;
  1012. cout<<endl<<"Enter:";
  1013.  
  1014.  
  1015.  
  1016.  
  1017. cin>>e;
  1018. if(e=1){
  1019. company qw;
  1020. qw.search_license(license_num);
  1021.  
  1022. }
  1023.  
  1024. if(e=2){
  1025. company qe;
  1026. qe.search_business_license(license_num);
  1027.  
  1028. }
  1029.  
  1030. if(e=3){
  1031. company qr;
  1032. qr.search_d_license(license_num);
  1033.  
  1034. }
  1035. if(e=4){
  1036. company qt;
  1037. qt.search_animal_license(license_num);
  1038.  
  1039. }
  1040. }//*****
  1041.  
  1042.  
  1043.  
  1044. if (q==3){
  1045. cout<<"What Category of Document ?:"<<endl;
  1046. cout<<"General License?::Enter 1"<<endl;
  1047. cout<<"Bussiness License?::Enter 2"<<endl;
  1048. cout<<"Driving license?::Enter 3"<<endl;
  1049. cout<<"Animal License?::Enter 4"<<endl;
  1050. cout<<endl<<"Enter:";
  1051.  
  1052. cin>>e;
  1053. if(e=1){
  1054. company aw;
  1055. aw.remove_license(license_num);
  1056. }
  1057. if(e=2){
  1058. company ae;
  1059. ae.remove_business_license(license_num);
  1060. }
  1061. if(e=3){
  1062. company ar;
  1063. ar.remove_d_license(license_num);
  1064.  
  1065. }
  1066. if(e=4){
  1067. company at;
  1068. at.remove_animal_license(license_num);
  1069.  
  1070. }
  1071. }
  1072.  
  1073. if (q==4){
  1074. cout<<"What Category of Document ?:"<<endl;
  1075. cout<<"General License?::Enter 1"<<endl;
  1076. cout<<"Bussiness License?::Enter 2"<<endl;
  1077. cout<<"Driving license?::Enter 3"<<endl;
  1078. cout<<"Animal License?::Enter 4"<<endl;
  1079. cout<<endl<<"Enter:";
  1080.  
  1081. cin>>e;
  1082. if(e=1){
  1083. company zw;
  1084. zw.display_license();
  1085. }
  1086. if(e=2){
  1087. company ze;
  1088. ze.display_business_license();
  1089. }
  1090. if(e=3){
  1091. company zr;
  1092. zr.display_d_license();
  1093.  
  1094. }
  1095. if(e=4){
  1096. company zt;
  1097. zt.display_animal_license();
  1098.  
  1099. }
  1100. }
  1101.  
  1102.  
  1103.  
  1104. if(q!=1 || q!=2 || q!=3 || q!=4){
  1105. cout<<"Please Use what u have been given: 1,2,3,4 ONLY!!!"<<endl;
  1106. }
  1107.  
  1108.  
  1109.  
  1110.  
  1111. return 0;
  1112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement