Professional Documents
Culture Documents
Mks 1083: Data Structures and Algorithm SEMESTER 1 SESI 2020/2021 Group Project
Mks 1083: Data Structures and Algorithm SEMESTER 1 SESI 2020/2021 Group Project
Mks 1083: Data Structures and Algorithm SEMESTER 1 SESI 2020/2021 Group Project
ALGORITHM
GROUP PROJECT
NAME: 1) LEE ZHEE NAN (E20191025081)
2) SAMMI TEH SIM YEE
(E20191025091)
3) TAN YAN JUN (E20191025043)
PROGRAM: DIPLOMA IN COMPUTER SCIENCE
GROUP: B
PROGRAM: CLINIC PATIENTS MANAGEMENT
SYSTEM
LECTURER PUAN HASNATUL NAZUHA BINTI
: HASSAN
Table Of Content
NO. INDEX PAGE
2. 2.0 Flowchart
5
4. 4.0 Output
-1. Import or create file
-2. Adding new patient record
-3. Updating an existing patient record
-4. Search a patient record 22- 47
-5. View patients record
-6. Remove a patient record
-7. Save
-0. Exit
Nowadays, doctor and nurse worry about the available system is because it is not quite
popular and it required some specific skills in order to install or operate it. The functionality
of the system can actually replace using the traditional way which is the paperwork in their
2
mind. The current clinic patient management system that available in the market is just
replace the paperwork by using computer and store the data into the database. The normal
functionalities include the patient record management module. There is not much new
functionality that available in the system. In this project, we intend to solve the problem that
the doctor and nurse worry about in the available system and add in new innovations that help
the patient and staff of clinic in our developed system.
Compare with the available system, there are a lot of modules inside. We will focus the
problems in these modules which are registration, updating, searching, viewing and deleting
information modules.
Modules Problems
Registration module When a patient first time visits the clinic,
he/she need to register into the system.
Nurse needs to type the details of patient
into the system which may slow down the
3
process of registration and typo will be
occurred sometimes.
Information update module If a patient wants to update his/her
information for address and phone number.
New information that is added may not
properly stored or old information may still
be the same data.
Search information module If doctors or staff nurses want to view for a
particular patient’s record. It requires a lot
of time to search for it. It may occur
duplication of data or data error.
View information module When a doctor or nurse wants to view all
the patients’ information, it may occur lost
in data information or data error. Some of
the data information may also not be shown
if there is a crash or jammed of information
lists.
Delete information module If doctor or nurse wants to delete a patient’s
record, they might accidentally delete the
wrong data due to duplication of
information.
2.0 Flowchart
4
3.0 Coding C++
5
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
typedef struct {
int id;
char name[50];
int age;
char gender[8];
int contact;
char address[200];
}patient;
patient data;
}LNode,* LinkList;
LinkList L = NULL;
FILE* fp;
6
char filename[10];
void menu();
void CreateList();
void OpenFile();
void PrintAll();
void SearchMenu();
void SearchID();
void AddData();
void DeleteMenu();
void DeleteID();
void ModifyData();
void SaveData();
void menu() {
7
cout << "\t| 3. Updating An Existing Patient Record |\n";
void CreateList() {
L = (LNode*)malloc(sizeof(LNode));
L->next = NULL;
void OpenFile() {
CreateList();
LNode * p, *q;
q = L;
while (true) {
cout << "\tFile didn't existed. Do you want to create a new file?(y/n):";
8
if (ch == 'Y' || ch == 'y') {
else break;
else continue;
else break;
while (true) {
p = (LNode*)malloc(sizeof(LNode));
free(p);
system("pause");
break;
p->next = NULL;
q->next = p;
q = q->next;
fclose(fp);
9
}
void PrintAll() {
system("cls");
LinkList p;
p = L->next;
if (p == NULL) {
system("pause");
return;
while (p!=NULL) {
p = p->next;
system("pause");
void SearchMenu() {
10
int choise = -1;
while (choise != 2) {
system("cls");
switch (choise)
case 1:
SearchID();
break;
default:
break;
11
void SearchID() {
system("cls");
LinkList q = L->next;
while (q != NULL) {
if (q->data.id == id) {
system("pause");
return;
q = q->next;
system("pause");
12
void DeleteMenu() {
while (choise != 2) {
system("cls");
switch (choise)
case 1:
DeleteID();
break;
default:
break;
13
void DeleteID() {
LinkList q = L;
while (q != NULL) {
if (q->next->data.id == id) {
LinkList p = q->next;
q->next = p->next;
free(p);
system("pause");
return;
q = q->next;
system("pause");
void AddData() {
14
system("cls");
LinkList p, q;
p = (LNode*)malloc(sizeof(LNode));
q = L->next;
while (q != NULL) {
if (q->data.id == p->data.id) {
q = L->next;
continue;
else q=q->next;
fflush(stdin);
cin.getline(p->data.name,50);
15
fflush(stdin);
fflush(stdin);
cin.getline(p->data.gender,10);
fflush(stdin);
fflush(stdin);
cin.getline(p->data.address,200);
if (L->next == NULL) {
p->next = NULL;
L->next = p;
else {
q = L->next;
while (q != NULL) {
if (q->next != NULL) {
p->next = q->next;
16
q->next = p;
break;
else {
p->next = NULL;
q->next = p;
break;
q = q->next;
system("pause");
void ModifyData() {
system("cls");
17
LinkList q = L ;
while (q != NULL) {
q = q->next;
if (q->data.id == id) {
break;
if (q->next == NULL) {
q = L->next;
continue;
pnew->next = NULL;
fflush(stdin);
cin.getline(pnew->data.address,200);
18
q->data.age = pnew->data.age;
q->data.contact = pnew->data.contact;
strcpy(q->data.address,pnew->data.address);
free(pnew);
system("pause");
void SaveData() {
LinkList q = L->next;
system("pause");
return;
else {
while (q != NULL) {
q = q->next;
19
fclose(fp);
system("pause");
int main() {
while(choise){
system("cls");
menu();
switch(choise){
case 1:
OpenFile();
break;
case 2:
AddData();
break;
case 3:
ModifyData();
20
break;
case 4:
SearchMenu();
break;
case 5:
PrintAll();
break;
case 6:
DeleteMenu();
break;
case 7:
SaveData();
break;
default:
break;
return 0;
4.0 Output
21
Output: Main menu
22
1.0 Main menu enter ‘1’ to import or create a file name: premium_clinic
23
1.2 File doesn’t exist, enter ‘n’ to try enter file name again.
1.3 File doesn’t exist, enter ‘y’ to create new file. File created.
24
2.0 Main menu enter ‘2’ to add new patients record.
2.1 After enter ‘2’, enter numbers of patient we want to add. Try enter ‘5’.
25
2.2 After enter numbers of patient, we can start enter patient details (ID, Name, Age, Gender,
Phone no. , Address)
2.3 Finished enter details of first patient, continue to enter details of second patient and so on
until fifth patient.
26
2.4 We try adding patient with ID: 103 at second (for later to test is it ‘sorting by ID’ function
working or not). When adding details of no.5 patient, we try enter ID which already existed
to test ‘unique’ of ID function or not. It is functioning properly, so display message to ask
user to enter the ID again.
27
2.5 Done adding all patients details.
28
2.6 Back to main menu. Enter ‘5’ to view and check all records we added just now.
2.7 All patients record we added just now is show properly. All records also sorted follow by
ID
29
2.8 Back to main menu. Enter ‘7’ to save patients record we added just now into
premium_clinic file we created just now.
30
2.9.1 Open premium_clinic file to check record save successful or not. All records save
successfully.
31
3.1 After enter ‘3’, we can enter patient’s ID which we want to update.
3.2 After enter patient’s ID, we can enter the new age, phone number and address to update.
32
3.3 Update patient with ID 102. Age ‘22’ become ‘25’, phone number ‘0127839821’ become
‘0173491293’ and address ‘C134, Taman Cahaya, Tanjong Malim’ become ‘C54, Taman
Ceriah, Tanjong Malim’. Update successfully.
3.4 Back to main menu. Enter ‘5’ to view and check record after updated.
33
3.5 Confirm record we updated just now was successful.
3.6 Back to main menu. Enter ‘7’ to save update we make just now.
34
3.7 Records saved.
3.7.1 Open premium_clinic file to check updated record save successful or not. All records
save successfully.
35
4.0 Main menu enter ‘4’ to search a patient record.
36
4.2 Enter ‘1’ to search patient record by ID.
4.3 After enter ‘1’, we can enter patient’s ID which we want to search.
37
4.4 try enter ID that didn’t exist. Display message “ID not exits”.
38
4.6 Back to ‘Search Patient Record’ menu. Enter ‘2’ back to main menu.
39
5.0 To view all patients record.
40
6.0 Back to main menu. Enter ‘6’ to remove a patient record.
41
6.2 Enter ‘1’ to remove a patient record by ID.
6.3 Enter ID 103 to remove patient with number ID 103. Remove successfully.
42
6.4 Back to ‘Remove A Patient Record’ menu. Enter 2 back to main menu.
43
6.6 Enter ‘5’ to view and check record after removed.
44
6.8 Back to main menu. Enter ‘7’ to save remove we make just now.
45
6.9.1 Open premium_clinic file to check record after removed save successful or not. All
records save successfully.
46
7.1 After enter ‘0’, program end.
47