Advertisement
Courbe_Impliquee

struct

Apr 26th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <clocale>
  3. #include <iostream>
  4. #include <stdlib.h>
  5. #include <iomanip>
  6. #include <string>
  7.  
  8. using namespace std;
  9. struct List{
  10. CarInfo car;
  11. OwnerInfo man;
  12. JobInfo work;
  13. AddressInfo home;
  14. };
  15. int menu(){
  16. int menu_number;
  17. cout << " МЕНЮ" << endl;
  18. cout << "> 1.Формирование массива <" << endl;
  19. cout << "> 2.Добавить данные в массив <" << endl;
  20. cout << "> 3.Печать данных <" << endl;
  21. cout << "> 4.Выход <";
  22. cout << endl;
  23. cin >> menu_number;
  24. return menu_number;
  25. }
  26. int array(){
  27. int n;
  28. cout << "Введите кол-во людей: ";
  29. cin >> n;
  30.  
  31. for (int i = 0; i < n; i++){
  32. cout << "Информация об автомобиле: " << endl;
  33. cin.getline(list[i].CarInfo, 50);
  34. cout << "Информация о владельце: " << endl;
  35. cout << "Сведения о работе: " << endl;
  36. cout << "Адрес владельца: " << endl;
  37. }
  38. return 0;
  39. }
  40.  
  41. void table(int n){
  42. cout << endl;
  43. cout << " №" << " | " << "Владелец" << " | " << "Автомобиль" << " | " << "Сведения о работе" << " | " << "Адрес владельца" << endl;
  44. cout << "-----------------------------------------------------------------" << endl;
  45. for (int i = 0; i < n; i++){
  46. cout << i + 1 << " " << list[i]. << list[i].Name << " " << a[i].CarNumber << a[i].CarBrand << a[i].Color << " " << a[i].PlaceOfWork << a[i].Position << " " << a[i].City << a[i].Street << a[i].HouseNumber << a[i].Apartment;
  47.  
  48. }
  49. }
  50.  
  51. struct CarInfo{
  52. char CarNumber[6];
  53. char CarBrand[20];
  54. char Color[20];
  55. };
  56. struct OwnerInfo{
  57. char Surname[30];
  58. char Name[30];
  59. };
  60. struct JobInfo{
  61. char PlaceOfWork[30];
  62. char Position[30];
  63. };
  64. struct AddressInfo{
  65. char City[30];
  66. char Street[30];
  67. int HouseNumber;
  68. int Apartment;
  69. };
  70.  
  71.  
  72.  
  73. int _tmain(int argc, _TCHAR* argv[])
  74.  
  75. {
  76. setlocale(LC_ALL, "rus");
  77. List list[30] = {};
  78. int n;
  79. int m = menu();
  80. while (m != 4){
  81. switch (m){
  82. case 1:array(); break;
  83. //cout << "Введите кол-во людей" <<endl ;
  84. //cin >> n;
  85.  
  86. case 2:break;
  87. case 3:table(n); break;
  88. case 4: break;
  89. }
  90. m = menu();
  91. }
  92.  
  93. system("pause");
  94. return 0;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement