Note: This is a monolithic program not following any design patterns/standards. Intent to create this program was to get a up running parking lot software in minimal time.
- Download this main.cpp file.
- Create 2 text files namely -> input.txt and output.txt in same directory as of main.cpp
- Provide test case in input.txt file
- Run main.cpp from terminal or any IDE
- See the result/output in output.txt
Compile using Clang
$ g++ -o main main.cpp Run the binary executable:
$ ./main
In case of Ubuntu it doesn't have C++ compiler by default. You need to install it by below command:
sudo apt-get install g++
Now you can compile your programs like this:
g++ main.cpp -o output
Now you can run the same with below command:
./output
Troubleshoting: By default g++ creates executable output. If in case you have permission denied error then try command:
chmod u+x output
comment out following line in main.cpp
freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); Go to ideone , paste code in editor
provide input and click run. That's it.
Create_parking_lot 6
Park KA-01-HH-1234 driver_age 21
Park PB-01-HH-1234 driver_age 21
Slot_numbers_for_driver_of_age 21
Park PB-01-TG-2341 driver_age 40
Slot_number_for_car_with_number PB-01-HH-1234
Leave 2
Park HR-29-TG-3098 driver_age 39
Vehicle_registration_number_for_driver_of_age 18