Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- struct Patient
- {
- int ID;
- string firstName;
- string lastName;
- string address;
- int age;
- string nationality;
- struct Allergy {
- char Allergic;
- string typeOfAllergy;
- }a;
- struct Surgery {
- char surgery;
- string typeOfSurgery;
- struct dateOfSurgery {
- int day;
- int month;
- int year;
- //write a function to print it out!
- }dos;
- }s;
- string bloodType;
- double weight;
- double height;
- string physician;
- string insurance;
- Patient() {};
- Patient(int i, string fn, string ln, string a, int ag, string n, string bt, double w, double h, string ph,
- string in) {
- ID = i;
- firstName = fn;
- lastName = ln;
- address = a;
- age = ag;
- nationality = n;
- bloodType = bt;
- weight = w;
- height = h;
- physician = ph;
- insurance = in;
- cout << "First Name: " << firstName << endl;
- };
- };
- void DisplayMenu() {
- cout << "---------------------------------------------------------" << endl;
- cout << "Patient Management System (CSC301, Fall2016)" << endl;
- cout << "---------------------------------------------------------" << endl;
- cout << "1- Create a new patient file" << endl;
- cout << "2- Delete all patient files having the same nationality" << endl;
- cout << "3- Display all patients having the same nationality" << endl;
- cout << "4- Check if a particular patient exists based on his blood type and weight" << endl;
- cout << "0- Quit" << endl;
- cout << "---------------------------------------------------------" << endl;
- }
- int UserMenuChoice() {
- int choice = 1000;
- while (choice > 4) {
- cout << "Your choice (0, 1, 2, 3, 4)?";
- cin >> choice;
- }
- return choice;
- }
- void CreatePatient() {
- char moreData;
- do {
- Patient patient1;
- cout << "Please enter the patient's ID: " << endl;
- cin >> patient1.ID;
- cout << "Please enter the patient's first name: " << endl;
- cin >> patient1.firstName;
- cout << "Please enter the patient's last name:" << endl;
- cin >> patient1.lastName;
- cout << "Please enter the patient's address: " << endl;
- cin >> patient1.address;
- cout << "Please enter the patient's age: " << endl;
- cin >> patient1.age;
- cout << "Please enter the patient's nationality: " << endl;
- cin >> patient1.nationality;
- cout << "Please enter the patient's blood Type: " << endl;
- cin >> patient1.bloodType;
- cout << "Please enter the patient's Weight: " << endl;
- cin >> patient1.weight;
- cout << "Please enter the patient's height: " << endl;
- cin >> patient1.height;
- cout << "Please enter the patient's physician: " << endl;
- cin >> patient1.physician;
- /*cout << "Does the patient do any surgery ? Enter Y / N" << endl;
- cin >> patient1.s.surgery;
- if (patient1.s.surgery == ('y') || patient1.s.surgery == ('Y')) {
- cout << "When He/She did it ?/n Day ";
- cin >> patient1.s.dos.day;
- cout << " Month ";
- cin >> patient1.s.dos.month;
- cout << " Year ";
- cin >> patient1.s.dos.year;
- }
- else
- cout << ".................... " << endl;*/
- cout << "Which Type Of Surgey did He/She do ? " << endl;
- cin >> patient1.s.typeOfSurgery;
- cout << "Does the patient have Allergy? Enter Y / N" << endl;
- cin >> patient1.a.Allergic;
- if (patient1.a.Allergic == 'y' || patient1.a.Allergic == 'Y') {
- cout << "Which Type of allergy does He/She have ?? " << endl;
- cin >> patient1.a.typeOfAllergy;
- }
- else
- cout << ".................... " << endl;
- cout << "Does the patient have insurance? Enter Yes / No" << endl;
- cin >> patient1.insurance;
- cout << "Do you want to input more data? Enter Y/N" << endl;
- cin >> moreData;
- } while (moreData == ('Y') || moreData == ('y'));
- }
- void DeletePatients() {
- cout << "This function will delete all patients of the same Nationality. Proceed? Y/N";
- char choice;
- cin >> choice;
- if (choice == 'y' || choice == 'Y') {}
- }
- void ListPatients() {
- string d;
- int PatientArray[10]; //change this~~!
- for (int i = 0; i <= sizeof(PatientArray); i++) {
- PatientArray[i];
- //cout <<i<< d.Pateint(2132435,"fds","gfd") << endl;
- }
- }
- void SearchPatient() {
- ;// To be completed
- }
- int main(int argc, char* argv[])
- {
- int userChoice;
- do {
- Patient PatientArray[1000];
- system("cls"); // this clears the screen
- DisplayMenu();
- userChoice = UserMenuChoice();
- switch (userChoice) {
- case 1: CreatePatient(); break;
- case 2: DeletePatients(); break;
- case 3: ListPatients(); break;
- case 4: SearchPatient(); break;
- default: cout << "Thanks for using my CSC301's Patient Managenment System. Good Bye...";
- }
- } while (userChoice != 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement