Advertisement
Guest User

Untitled

a guest
May 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <iomanip>
  6. using namespace std;
  7. struct patients
  8. {
  9. char surname[20];
  10. char gender[5];
  11. int age;
  12. char location[50];
  13. char doctor[30];
  14. };
  15. int main()
  16. {
  17. setlocale(LC_ALL, "Russian");
  18. int n;
  19. patients *spisok;
  20. do
  21. {
  22. cout << "Введите количество пациентов ";
  23. cin >> n;
  24. } while (n <= 0);
  25. spisok = new patients[n];
  26. cout << "Введите информацию о пациентах " << endl;
  27. cout << endl;
  28.  
  29. for (int i = 0; i < n; i++)
  30. {
  31. cout << "Пациент № ";
  32. cout << 1 + i << endl;
  33. cout << "Фамилия ";
  34. cin >> spisok[i].surname;
  35. cout << "Пол ";
  36. cin >> spisok[i].gender;
  37. cout << "Возраст ";
  38. cin >> spisok[i].age;
  39. cout << "Место жительства ";
  40. cin >> spisok[i].location;
  41. cout << "Специальность врача ";
  42. cin >> spisok[i].doctor;
  43. }
  44. cout << "+---------+-----+---------+--------------+---------------------+" << endl;
  45. cout << "|Фамилия |Пол |Возраст |М.жительства |Цпециальность врача |" << endl;
  46. cout << "+---------+-----+---------+--------------+---------------------+" << endl;
  47. for (int i = 0; i < n; i++)
  48. {
  49. 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;
  50. cout << "+---------+-----+---------+--------------+---------------------+" << endl;
  51. }
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement