0% found this document useful (0 votes)
20 views3 pages

Output Code

Uploaded by

tanishknamdev981
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Output Code

Uploaded by

tanishknamdev981
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <iostream>

#include <cstdlib>
#include <string>
#include <conio.h>

struct Node {
std::string name;
int age;
std::string address;
int phone;
std::string bloodgroup;
int reg;
int priority;
Node* next;
};

Node* start = nullptr;

Node* insert(Node* start);


Node* deleteRecord(Node* start);
void display(Node* start);
void table();

int main() {
int option;
do {
system("COLOR 4F");
std::cout << "\t\t\t-------------------------------\n";
std::cout << "\t\t\t WELCOME TO ANDROIDHIRE HOSPITAL!\n";
std::cout << "\t\t\t-------------------------------\n";
std::cout << "\t\t\t1. ADD A PATIENT\n";
std::cout << "\t\t\t2. DELETE A RECORD\n";
std::cout << "\t\t\t3. DISPLAY ALL APPOINTMENTS\n";
std::cout << "\t\t\tEnter your choice: ";
std::cin >> option;

switch (option) {
case 1:
start = insert(start);
std::cin.ignore();
system("cls");
break;
case 2:
start = deleteRecord(start);
std::cin.ignore();
system("cls");
break;
case 3:
display(start);
std::cin.ignore();
system("cls");
break;
case 4:
exit(0);
break;
}
} while (option != 4);
}
Node* insert(Node* start) {
int val2, val4, val6, pri;
Node* ptr = new Node;
Node* p;

std::cout << "Enter patient Name: ";


std::cin >> ptr->name;
std::cout << "Enter the patient's age: ";
std::cin >> val2;
std::cout << "Enter your home address: ";
std::cin >> ptr->address;
std::cout << "Enter your phone number: ";
std::cin >> val4;
std::cout << "Enter the blood group of Patient: ";
std::cin >> ptr->bloodgroup;
std::cout << "Enter the reg no: ";
std::cin >> val6;
std::cout << "Enter your disease Number: ";
table();
std::cin >> pri;

ptr->age = val2;
ptr->phone = val4;
ptr->reg = val6;
ptr->priority = pri;

if ((start == nullptr) || pri < start->priority) {


ptr->next = start;
start = ptr;
} else {
p = start;
while (p->next != nullptr && p->next->priority <= pri)
p = p->next;
ptr->next = p->next;
p->next = ptr;
}
return start;
}

Node* deleteRecord(Node* start) {


if (start == nullptr) {
std::cout << "\n NO PATIENT RECORD TO DELETE";
return start;
} else {
Node* ptr = start;
std::cout << "\n Deleted Record is : " << ptr->reg;
start = start->next;
delete ptr;
}
return start;
}

void display(Node* start) {


if (start == nullptr) {
std::cout << "\nTHERE IS NO PATIENT";
} else {
std::cout << "\nPriority wise appointments are:\n";
Node* ptr = start;
while (ptr != nullptr) {
std::cout << "The name of patient is: " << ptr->name << "\n";
std::cout << "The age of patient is: " << ptr->age << "\n";
std::cout << "The address of patient is: " << ptr->address << "\n";
std::cout << "Phone Number: " << ptr->phone << "\n";
std::cout << "The blood group of patient is: " << ptr->bloodgroup << "\
n";
std::cout << "---------------------------------------------------\n";
ptr = ptr->next;
}
}
std::cin.get();
}

void table() {
std::cout << "\t\tPlease Refer this Table for your disease!\n";
std::cout << "1. Heart attack\n";
std::cout << "2. Severe wound/Bleeding\n";
std::cout << "3. Cancer\n";
std::cout << "4. Chest pain\n";
std::cout << "5. Fracture\n";
std::cout << "6. Diabetes Checkup\n";
std::cout << "7. Infection\n";
std::cout << "8. Viral Fever\n";
std::cout << "9. Common Cold/Head ache\n";
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy