Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Clinic.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <iomanip>
- using namespace std;
- class Consult
- {
- private:
- char name[30];
- protected:
- int cause;
- public:
- int age;
- int num_sec;
- float weight;
- float height;
- char sex;
- public:
- Consult();
- void Input();
- void Show();
- };
- Consult::Consult()
- {
- }
- void Consult::Input()
- {
- int flag;
- int option;
- int count_patients = 0;
- int count_f = 0;
- int count_f = 0;
- int count_sprain = 0;
- int count_infection = 0;
- int count_alergies = 0;
- int count_burns = 0;
- int count_broken = 0;
- int count_bites = 0;
- int count_cough = 0;
- fflush(stdin);
- cout << "Patient data: " << endl;
- cout << "Name: ";
- cin >> name;
- cout << "Age: ";
- cin >> age;
- cout << "Sex (f/m): ";
- cin.get(sex);
- cout << "Security number: ";
- cin >> num_sec;
- cout << "Weight(kg): ";
- cin >> weight;
- cout << "Height(cm): ";
- cin >> height;
- cout << "Select cause: " << endl;
- cout << "1. Sprain" << endl;
- cout << "2. Infection" << endl;
- cout << "3. Alergies" << endl;
- cout << "4. Burns" << endl;
- cout << "5. Broken bones" << endl;
- cout << "6. Bites" << endl;
- cout << "7. Cough" << endl;
- if (sex == 'f')
- count_f++;
- else if (sex == 'm')
- count_m++;
- else if (cause == 1)
- count_sprain++;
- else if (cause == 2)
- count_infection++;
- else if (cause == 3)
- count_alergies++;
- else if (cause == 4)
- count_burns++;
- else if (cause == 5)
- count_broken++;
- else if (cause == 6)
- count_bites++;
- else if (cause == 7)
- count_cough++;
- else
- {
- flag--;
- count_patients++;
- }
- flag++;
- count_patients--;
- cout << "\n";
- }
- void Consult::Show()
- {
- cout << "\n\n";
- cout << name;
- cout << endl;
- cout << age;
- cout << endl;
- cout << sex;
- cout << endl;
- cout << num_sec;
- cout << endl;
- cout << weight;
- cout << endl;
- cout << height;
- cout << "\n\n";
- }
- int main()
- {
- int num_est = 0;
- int num_obj = 0;
- int opt;
- int opt2;
- int i = 0;
- int n = 0;
- int dim;
- Consult *p;
- cout << "How many patients were during the day?";
- cin >> dim;
- cout << "\n";
- p = new Consult[dim];
- if (p == 0)
- {
- cout << "Error, not enough space.";
- return 0;
- };
- do
- {
- cout << " Menu" << endl;
- cout << "1. Register a new patient." << endl;
- cout << "2. See specific patients." << endl;
- cout << "3. Exit." << endl;
- cout << "-----------------------------------------------------------" << endl;
- fflush(stdin);
- cout << "\n Choose an option from the menu(1-3):";
- cin >> opt;
- switch (opt)
- {
- case 1:
- (p + num_obj)->Input();
- num_obj++;
- system("cls");
- break;
- case 2:
- cout << "Select cause: " << endl;
- cout << "1. Sprain" << endl;
- cout << "2. Infection" << endl;
- cout << "3. Alergies" << endl;
- cout << "4. Burns" << endl;
- cout << "5. Broken bones" << endl;
- cout << "6. Bites" << endl;
- cout << "7. Cough" << endl;
- cin >> opt2;
- /*switch (opt2)
- {
- case 1:
- break;
- case 2:
- break;
- case 3:
- break;
- case 4:
- break;
- case 5:
- break;
- case 6:
- break;
- case 7:
- break;
- default:
- cout << "Not specific cause." << endl;
- break;
- }
- cout << "\n";
- cout << "---------------" << endl;
- cout << "PATIENTS" << endl;
- cout << "---------------" << endl;
- for (i = 0; i<num_obj; i++)
- {
- cout << "Patient number " << i + 1;
- cout << ":";
- (p)->Show();
- cout << "\n";
- }*/
- cout << endl;
- system("pause");
- system("cls");
- break;
- case 3:
- break;
- default:
- cout << "\n\n Choose a valid option from the menu.\n";
- system("pause");
- system("cls");
- }
- }
- while (opt != 3);
- delete[]p;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement