Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <locale>
- #include <stdlib.h>
- #include <time.h>
- #include <iomanip>
- using namespace std;
- struct patients
- {
- char surname[20];
- char gender[5];
- int age;
- char location[50];
- char doctor[30];
- };
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int n;
- patients *spisok;
- do
- {
- cout << "Введите количество пациентов ";
- cin >> n;
- } while (n <= 0);
- spisok = new patients[n];
- cout << "Введите информацию о пациентах " << endl;
- cout << endl;
- for (int i = 0; i < n; i++)
- {
- cout << "Пациент № ";
- cout << 1 + i << endl;
- cout << "Фамилия ";
- cin >> spisok[i].surname;
- cout << "Пол ";
- cin >> spisok[i].gender;
- cout << "Возраст ";
- cin >> spisok[i].age;
- cout << "Место жительства ";
- cin >> spisok[i].location;
- cout << "Специальность врача ";
- cin >> spisok[i].doctor;
- }
- cout << "+---------+-----+---------+--------------+---------------------+" << endl;
- cout << "|Фамилия |Пол |Возраст |М.жительства |Цпециальность врача |" << endl;
- cout << "+---------+-----+---------+--------------+---------------------+" << endl;
- for (int i = 0; i < n; i++)
- {
- cout << "|" << setw(9) << spisok[i].surname << "|" << setw(5) << spisok[i].gender << "|" << setw(9) << spisok[i].age << "|" << setw(14) << spisok[i].location << "|" << setw(21) << spisok[i].doctor << "|" << endl;
- cout << "+---------+-----+---------+--------------+---------------------+" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement