Doctor Appointment Booking Project using C++ Language
Last updated Jan 20, 2022In this project, we will see how to build the DOCTOR APPOINTMENT BOOKING project using C++ programming language. This Doctor Appointment Booking project is a straightforward console program written in C++ with no visuals. This project will teach you how to utilize the stream class and how to handle files in the C++ programming language.
In this project, these following are the main features of project we going to learn:
- Manage Doctor Appointment Slots: It is used to create available slots which will be displayed when a patient/user wants to see or book the slots.
- Book Appointment : A user/patient can book appointment slot.
- See All Existing Slots : Using this we can check how many slot is available or booked.
Important: The appointment record will be saved even if the app is closed.
Tools Used using project:
I used Dev C++ IDE or you can use any IDE which is suitable to you.
Implementation of Project:
Step 1. Create a new Project in Dev C++.
File > New > Source File or Ctrl + N |
Step 2. First of all we will include all Header file which will use in project.
#include |
Step 3. Add the following line below header file:
using namespace std; |
The using namespace statement simply implies that in the scope in which it is present, all items in the std namespace are available without needing to prefix them with std::
Step 4. Now create the I/o Stream and Associate with actual files, You can read about File and Streams in c++
It used to read any input or write any output, open the file streams and associate them with the actual files:
ofstream fout; |
Step 5. Now we will create a function for bookAppointment and the code be like:
In this we use cout for print output data and int BookAppointment() is a function which returns a value because it used int before method. IF we used void BookAppointment that means it will not return any value.
int bookAppointment() //check if record already exist.. cout<<"\n Please any key to continue.."; |
Step 6. Next, we will create a new function existingAppointment()
The existingAppointment() function is created because to get all the available slots of doctor. This function have variables, commands for print output, get input from users, file read, file open and show data, arrays for iterate data.
int existingAppointment() ofstream out; cout<<"\n Please any key to continue.."; |
Step 7. Finally, we will create a main method to call all functions and run the project
In main method we will make it int type because we want that main() method return data.
int main(int argc, char** argv) { } |
As you see in code we use switch case in main() method
On Case 1: We call bookAppointment() function which is used for booking the appointment.
On Case 2: We call existingAppointment() function which will display all existing appointments.
On Case 0: We use 0 to go back and finally close the application.
Step 8. Run the project and you will get the following output:
Main Screen:
The first screen when you run the project
![]() |
Book your appointment Screen:
Slots will be displayed to you basis of hours with reference E.g: A, B, C and so on.. with a status Available or Booked.
![]() |
Appointment Booked Screen:
In this screen you will get a message of successfully booked.
![]() |
Already Booked Slot:
In case you select the booked appointment it will display you a following screen.
![]() |
Existing Appointment Screen:
![]() |
Exit Screen:
![]() |
Conclusion: In this project we have covered how to build project on Doctor Appointment Booking using C++ and how to book slots, get available slots data and so on.
Article Contributed By :
|
|
|
|
4711 Views |