All About C++

Get Pure Concepts of C++

Monday 6 June 2016

C++ car parking management system

This is C++ car parking management system. The statement of car parking management system is:
There are three floors in a building and every floor has capacity of ten cars to park.one floor is for Civic, one for Accord and one for City. Whenever a car system should ask either it is civic, Accord or City and it should be park on its floor if there exists room.

#include<iostream>
using namespace std;
enum{M=10};
class park
{private:
int capacity[M];int front,rear,g;
public:
            park()
            {front=rear=-1;g=0;}
            void inpark()
            {if(rear==M-1)
            {cout<<"floor is full,no room for any car more"<<endl;return;}
            else
            {if(front==-1)
            {rear++;front++;g++;
            capacity[rear]=g+1;
            cout<<"your car has parked "<<endl<<endl;}
            else
            {rear++;g++;
            capacity[rear]=g+1;
            cout<<"your car has parked "<<endl<<endl;}}}
            void outpark()
            {if(front==-1)
            {cout<<"there is no car in this floor "<<endl<<endl;}
            else
            {rear--;
            cout<<"remaining cars on this floor are   "<<rear<<endl<<endl;}}};
            void main()
            {park a,b,c;
            char x;
            start:
            cout<<"if u want to park a CIVIC ,then press 'A'  "<<endl;
            cout<<"if u want to park a CITY,then press 'B'  "<<endl;
            cout<<"if u want to park a Accord,then press 'C'  "<<endl;
            cout<<"if u want to car back,then press 'S'"<<endl;
            cout<<"if u want to exit,then press 'x' "<<endl;
            cin>>x;
            if(x=='A')
            {system("cls");a.inpark();goto start;}
            if(x=='B')
            {system("cls");b.inpark();goto start;}
            if(x=='C')
            {system("cls");c.inpark();goto start;}
            if(x=='S')
            {system("cls");
            cout<<"if u want to car back a CITY car,press 'C'"<<endl;
            cout<<"if u want to car back a CIVIC car,press 'D'"<<endl;
            cout<<"if u want to car back a Accord car,press 'E'"<<endl;
            cout<<"if u want to exit,then press 'x' "<<endl;
            cin>>x;
            if(x=='C')
            {system("cls");b.outpark();goto start;}
            if(x=='D')
            {system("cls");a.outpark();goto start;}
            if(x=='E')
            {system("cls");c.outpark();goto start;}}
            if(x=='x')
            {goto end;}
            else
            {cout<<"u entered wrong choice  "<<endl;
            goto start;}
end:
            system("pause");}


14 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. We are also the company who provides parking management system and solutions, Parking Management System are designed to showcase a new conception in resolving your parking problems.

    Parking Management System

    ReplyDelete
  3. It is an excellent article, Thanks for sharing the marvelous info.
    Parking Management System

    ReplyDelete
  4. Very much interested to read this blog, thanks
    smart logistics services

    ReplyDelete
  5. I invite you to the page where you can read with interesting information on similar topics. General Contractors in Canada

    ReplyDelete
  6. Thanks for your recommendations on this blog. One thing I want to say is that purchasing electronic products items over the Internet is not something new. The fact is, in the past several years alone, the marketplace for online electronic devices has grown noticeably. Today, you’ll find practically any kind of electronic device and tools on the Internet, ranging from cameras and also camcorders to computer elements and video games consoles. Vehicle Accessories

    ReplyDelete