Simple Clinic Management System using C++
Simple a Clinic Management System using C++ Hey coder, Welcome to our codewithrandom blog. In this article, we will learn how to create a Simple Clinic Management System using C++ (With Complete Source Code). It is a simple to use console application which is easy to create and understand by the users. A Smart & […]
Simple a Clinic Management System using C++
Hey coder, Welcome to our codewithrandom blog. In this article, we will learn how to create a Simple Clinic Management System using C++ (With Complete Source Code). It is a simple to use console application which is easy to create and understand by the users.
A Smart & Easy Clinic Management designed based on the idea of documenting patients’ information. Its main purpose is to assist clinics, hospitals and private practices in managing patient data, appointments, prescriptions, billing and other administrative activities and also saves time.

Simple and paperless clinic management systems can help healthcare practitioners enhance patient care by streamlining their process, reducing paperwork, and streamlining their workflow. They can also assist with billing and invoicing, insurance claims management, and financial reporting. And this data cannot be forgotten by mistake like a paper bill is lost but this paperless data remains saved in computer and mobile.
Base Convertor project using C++ (With source code)
What does a Simple Clinic Management system do?
This project allows users to collect patient information. doctor can add patient records, medicines, view patient history, delete or modify patient data. This project will keep patients records. The entire project is written in only C++ programming language. The project only keeps track of patients’ personal information and medications. And with this, one can easily find out about the patient’s past diseases without wasting time in searching for papers, users will search their name in their computer and all the data will come immediately.
Overview of the UI:
- 1 Add New Patient Record
- 2 Add Patient prescription
- 3 Full History of the Patient
- 4 delete Patient Record
- 5 modify Patient Record
The user will choose option 1 to add a new patient record into the clinic management system and then can further go on to choose the other options to perform the given operations in the system. Each of the given options will display their functionalities upon choosing them.
Simple a Clinic Management System Source code:
The entire system is written in C++. You can directly use this code by copying it in your IDE to understand the working and then can create it by understanding the project.
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
struct node
{
char fname[20];
char sname[20];
char address[200];
char contact[10];
char cnic[100];
int age;
char gender[8];
char blood_gp[5];
char disease_past[50];
int id;
char symptom[500];
char diagnosis[500];
char medicine[500];
char addmission[30];
struct node *next;
bool diagnose;
};
struct node *head,*lastptr;
bool check=true;
int arr[20]={0},i=0;
bool check_id(int ch)
{
for(int a=0;a<i;a++)
{
if(ch==arr[a])
{
return true;
}
}
return false;
};
class doctor
{
public:
void add()
{
node *p;
p=new node;
p->diagnose=false;
cout<<"enter Patient ID"<<endl;
cin>>p->id;
cout<<"enter Patient First name"<<endl;
cin>>p->fname;
cout<<"enter Patient Last name"<<endl;
cin>>p->sname;
cout<<"enter Patient Age"<<endl;
cin>>p->age;
cout<<"enter Patient Gender"<<endl;
cin>>p->gender;
cout<<"enter Patient Blood Group"<<endl;
cin>>p->blood_gp;
cout<<"enter Patient Contact "<<endl;
cin>>p->contact;
fflush(stdin);
cout<<"enter Patient CNIC"<<endl;
cin.getline(p->cnic,100);
fflush(stdin);
cout<<"enter Patient Address"<<endl;
cin.getline(p->address,1000);
p->next=NULL;
arr[i]=p->id;
i++;
if(check)
{
head=p;
lastptr=p;
check=false;
}
else
{
lastptr->next=p;
lastptr=p;
}
}
void show()
{
int n;
node *current=NULL,*prev=NULL;
prev=head;
current=head;
int ch;
cout<<"enter Patient ID"<<endl;
cin>>ch;
if(check_id(ch))
{
while(current->id!=ch)
{
prev=current;
current=current->next;
}
cout<<"enter Patient First name"<<endl;
cout<<current->fname<<endl;
cout<<"enter Patient Last name"<<endl;
cout<<current->sname<<endl;
cout<<"enter Patient ID"<<endl;
cout<<current->id<<endl;
cout<<"enter Patient Age"<<endl;
cout<<current->age<<endl;
cout<<"enter Patient Gender"<<endl;
cout<<current->gender<<endl;
cout<<"enter Patient Blood Group"<<endl;
cout<<current->blood_gp<<endl;
cout<<"enter Patient Contact "<<endl;
cout<<current->contact<<endl;
cout<<"CNIC number"<<endl;
cout<<current->cnic<<endl;
cout<<"enter Patient Address"<<endl;
cout<<current->address<<endl;
cout<<"*********************************"<<endl;
if(current->diagnose){
cout<<"Enter Symptoms"<<endl;
cout<<current->symptom<<endl;
cout<<"Enter Diagnosis"<<endl;
cout<<current->diagnosis<<endl;
cout<<"Enter Medicines"<<endl;
cout<<current->medicine<<endl;
cout<<"Admit Required to Hospital?"<<endl;
cout<<current->addmission<<endl;
}}
else
{
cout<<"ID not present"<<endl;
}
}
void diagnosis()
{
int n;
node *p=NULL,*prev=NULL;
p=new node;
prev=head;
p=head;
int ch;
cout<<"enter Patient ID"<<endl;
cin>>ch;
if(check_id(ch)){
while(p->id!=ch )
{
prev=p;
p=p->next;
}
p->diagnose=true;
cout<<"Enter Symptoms"<<endl;
cin>>p->symptom;
cout<<"Enter Diagnosis"<<endl;
cin>>p->diagnosis;
cout<<"Enter Medicines"<<endl;
cin>>p->medicine;
cout<<"Admit Required to Hospital?"<<endl;
cin>>p->addmission;
}
else
cout<<"ID is not Registered\n";
}
void deleteList()
{
int counter=0;
node *current=NULL,*prev=NULL;
//current =new node;
prev=head;
current=head;
int ch;
cout<<"Enter the ID: ";
cin>>ch;
if(check_id(ch)){
// temp=head;
while(current->id!=ch)
{
prev=current;
current=current->next;
}
prev->next=current->next;
free(current);
// while(head != NULL)
// {
// temp = head;
// head = head->next;
//
// free(temp);
// }
for(int a=0;a<i;a++)
{
if(arr[a]==ch){
for (int j=a;j<i;j++){
arr[j]=arr[j+1];
}
i--;
}
}
cout<<"SUCCESSFULLY DELETED ALL NODES OF LINKED LIST\n";
}
else
cout<<"ID not present"<<endl;
}
void update_menu()
{
cout<<"enter 1 Patient First name"<<endl;
cout<<"enter 2 Patient Last name"<<endl;
cout<<"enter 3 Patient ID"<<endl;
cout<<"enter 4 Patient Age"<<endl;
cout<<"enter 5 Patient Gender"<<endl;
cout<<"enter 6 Patient Blood Group"<<endl;
cout<<"enter 7 Patient Contact "<<endl;
cout<<"enter 8 patient CNIC"<<endl;
cout<<"enter 9 Patient Address"<<endl;
cout<<"*********************************"<<endl;
cout<<"Enter 10 Symptoms"<<endl;
cout<<"Enter 11 Diagnosis"<<endl;
cout<<"Enter 12 Medicines"<<endl;
cout<<"Admit 13 Required to Hospital?"<<endl;
}
void update_data(){
node *current=NULL,*prev=NULL;
current=head;
prev=head;
int id,ch;
cout<<"enter ID"<<endl;
cin>>id;
if(check_id(id)){
while(current->id!=id)
{
prev=current;
current=current->next;
}
update_menu();
cout<<"chose number"<<endl;
cin>>ch;
if(ch==1){
cout<<"enter first name"<<endl;
cin>>current->fname;
}
else if(ch==2){
cout<<"enter second name"<<endl;
cin>>current->sname;
}
else if(ch==3){
cout<<"enter ID"<<endl;
cin>>current->id;
}
else if(ch==4){
cout<<"enter age"<<endl;
cin>>current->age;
}
else if(ch==5){
cout<<"enter gender"<<endl;
cin>>current->gender;
}
else if(ch==6){
cout<<"enter blood group"<<endl;
cin>>current->blood_gp;
}
else if(ch==7){
cout<<"enter contact"<<endl;
cin>>current->contact;
}
else if(ch==8){
cout<<"enter CNIC"<<endl;
cin>>current->cnic;
}
else if(ch==9){
cout<<"enter address"<<endl;
cin>>current->address;
}
else if(ch==10){
cout<<"Enter 10 Symptoms"<<endl;
cin>>current->symptom;
}
else if(ch==11){
cout<<"Enter 11 Diagnosis"<<endl;
cin>>current->diagnosis;
}
else if(ch==12){
cout<<"Enter 12 Medicines"<<endl;
cin>>current->medicine;
}
else if(ch==13){
cout<<"Admit 13 Required to Hospital?"<<endl;
cin>>current->addmission;
}
}
else
cout<<"ID not present"<<endl;
}
};
void dis()
{
cout<<"1 Add New Patient Record "<<endl;
cout<<"2 Add Patient prescription "<<endl;
cout<<"3 Full History of the Patient"<<endl;
cout<<"4 delete Patient Record"<<endl;
cout<<"5 update Patient Record"<<endl;
}
void menu()
{
cout<<"press 1 to doctor menu"<<endl;
cout<<"press 2 to patients menu"<<endl;
cout<<"press 3 to pharmacist menu"<<endl;
}
int main()
{
struct node* head=NULL;
doctor u;
int i=0;
do{
dis();
cin>>i;
if(i==1)
u.add();
else if(i==2)
u.diagnosis();
else if(i==3)
u.show();
else if(i==4)
u.deleteList();
else if(i==5)
u.update_data();
}while(1);
return 0;
}
Now let us understand the code:-
- We will start by writing the header of the code with the required libraries – iostream for input/output operations, ctime for accessing the system clock, and cstdlib for generating random numbers.
- Now we will declare a struct node which will define the attributes for the patient record : fname (first name), sname (last name), address, contact, cnic (CNIC number of the patient), age, gender,
blood_gp, disease_past, id(unique for patients), symptom, diagnosis, medicine, addmission, next (pointer for the next node in the linked list), diagnose (boolean variable to tell whether the patient has been diagnosed yet).
- After the variable declaration we will define a function called check_id(int ch), it will check whether the ID number already exists in the linked list and returns a boolean value.
- We will create a class called doctor which with member functions to perform operations on the linked list. It will have the following functions – add(), show(), diagnosis(), deleteList(), update_menu(), update_data().
- The add() function will allow doctor to add a new patient to the list by reading/inputting their information in.
- The show() function will display the information of a particular patient based on their unique ID.
- The diagnosis() function will allow the doctor to diagnose a patient by filling in their symptoms, diagnosis, and prescribed medicine, admission status.
- The deleteList() function will delete a patient record from the list based on their ID by deleting the node with that ID number from the linked list. If the ID number is not found, it will return an error message.
- The update_menu() function will display a menu of data which the doctor can update.
- The update_data() function will allow the doctor to update the specified fields of a particular patient and store, update that data in the list.
- Now we will define the functions outside the doctor class.
- The dis() function displays the list of operations a user can perform in the system. Before proceeding on to any other option, user will choose 1st option to add new patient record.
- The menu() function will display options to go to different menus – doctor menu, patients menu, pharmacist menu.
- The main() function will have the function calls within a do-while loop. The respective function will be called when a user chooses an option from the given operations to perform in the system.
- This sums up our project of Clinic Management System using C++.
Bakery Management System using C++ (With Source Code)
Final Output:-
Here is an example to show how this project works

Choosing option 1

Choosing option 2:Add patient prescription

Choosing option 3 : Full History of the patient

Conclusion
So our learners here become familiar with the Simple Clinic Management System using C++ but this is not the last as “knowledge is the power, learn more, achieve more”, we will again meet with another knowledgeable blog. For any queries feel free to ask in the comment section. Keep learning, Keep coding!!!
Visit more interesting projects :- codewithrandom
If you enjoyed the article and learned something new today, let us know in the comments.
We create new collections like this every day so don’t forget to visit codewithrandom every day.
Thank you And Keep Learning!!!
Happy Reading! 🙂
Follow : CodewithRandom