Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ExamPreparationUni.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include<iostream>
- #include<iomanip>
- #include<math.h>
- #include<string>
- using namespace std;
- class Patient
- {
- private:
- string ID;
- string name;
- double values[3];
- public:
- Patient();
- Patient(string aID, string name1, double values1[]);
- Patient(string aID, string name1, double v0, double v1, double v2);
- Patient(const Patient &P);
- string get_ID();
- string get_name();
- double get_values(int index);
- void set_ID(string aID);
- void set_name(string name1);
- void set_values(double values1[]);
- void set_Patient(string aID, string name1, double v0, double v1, double v2);
- void input();
- void output();
- Patient& operator =(Patient &P);
- };
- Patient::Patient()
- {
- ID = "";
- name = "";
- for (int i = 0; i<3; i++) {
- values[i] = 0;
- }
- }
- Patient::Patient(string aID, string name1, double values1[3])
- {
- ID = aID;
- name = name1;
- for (int i = 0; i<3; i++)
- {
- values[i] = values1[i];
- }
- }
- Patient::Patient(string aID, string name1, double v0, double v1, double v2)
- {
- ID = aID;
- name = name1;
- values[0] = v0;
- values[1] = v1;
- values[2] = v2;
- }
- Patient::Patient(const Patient &Original)
- {
- name = Original.name;
- ID = Original.ID;
- for (int i = 0; i<3; i++)
- {
- values[i] = Original.values[i];
- }
- }
- string Patient::get_ID()
- {
- return ID;
- }
- string Patient::get_name()
- {
- return name;
- }
- double Patient::get_values(int index)
- {
- return values[index];
- }
- void Patient::set_ID(string aID)
- {
- ID = aID;
- }
- void Patient::set_name(string name1)
- {
- name = name1;
- }
- void Patient::set_values(double values1[])
- {
- for (int i = 0; i<3; i++)
- {
- values[i] = values1[i];
- }
- }
- void Patient::set_Patient(string aID, string name1, double v0, double v1, double v2)
- {
- ID = aID;
- name = name1;
- values[0] = v0;
- values[1] = v1;
- values[2] = v2;
- }
- void Patient::input()
- {
- cout << "ID: "; getline(cin, ID);
- cout << "\nName: "; getline(cin, name);
- cout << "\nValues: ";
- for (int i = 0; i<3; i++)
- {
- cin >> values[i];
- }
- }
- void Patient::output()
- {
- cout << endl;
- cout << "ID: " << ID << "\nName: " << name << endl;
- cout << "Values: ";
- for (int i = 0; i<3; i++)
- {
- cout << values[i] << " ";
- }
- cout << endl;
- }
- Patient& Patient::operator= (Patient &P)
- {
- this->name = P.name;
- ID = P.ID;
- for (int i = 0; i<3; i++)
- {
- values[i] = P.values [i];
- }
- return *this;
- }
- int main()
- {
- Patient P;
- P.set_Patient("1234", "Ivan Ivanov Ivanov", 2.23, 5.50, 4.34);
- P.output();
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement