Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.82 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <string>
  4. #include <fstream>
  5. #include <Windows.h>
  6. #include <cstdlib>
  7. using namespace std;
  8.  
  9. int lenOfInt(int number)
  10. {
  11. char count = 0;
  12. while (number != 0)
  13. {
  14. number /= 10;
  15. ++count;
  16. }
  17.  
  18. return count;
  19. }
  20.  
  21. int main(int argc, char* argv[])
  22. {
  23. int fullt = 79;
  24. int part = 20;
  25.  
  26. char main[] = "Agricultural enterprises\0";
  27. char main1[] = "Type of property: S - state, P - private, C -cooperative\0";
  28. short enterp = 0;
  29.  
  30.  
  31.  
  32. printf("Enter the value of the table in a ratio of 1 : 4\nFor Example 100 : 25; 200 : 50; 80 : 20\nFirst number is length of tablet, second is length of 1 block. In tablet are 4 blocks\n");
  33.  
  34. printf("Please enter length of tablet\n");
  35. scanf("%d", &fullt);
  36. --fullt;
  37. printf("Please enter length of block\n");
  38. scanf("%d", &part);
  39. cout << "Hint: " << main1 << "\n";
  40. printf("Please enter count of enterprises\n");
  41. scanf("%d", &enterp);
  42.  
  43. char** directors = (char**)malloc(sizeof(char*) * enterp);
  44. for (int i = 0; i < 3; ++i)
  45. {
  46. directors[i] = (char*)malloc(sizeof(char) * 13);
  47. }
  48.  
  49. char** type = (char**)malloc(sizeof(char*) * enterp);
  50. for (int i = 0; i < 3; ++i)
  51. {
  52. type[i] = (char*)malloc(sizeof(int) * 3);
  53. }
  54.  
  55. int *area = (int*)malloc(sizeof(int) * enterp);
  56. int* workers = (int*)malloc(sizeof(int) * enterp);
  57.  
  58. //Entering info
  59. for (int i = 0; i < enterp; ++i)
  60. {
  61. printf("Please enter name of director %d\n", i + 1);
  62. cin >> directors[i];
  63.  
  64. printf("Please enter type of property %d\n", i + 1);
  65. cin >> type[i];
  66.  
  67. printf("Please enter area of company %d\n", i + 1);
  68. cin >> area[i];
  69.  
  70. printf("Please enter workers of company %d\n", i + 1);
  71. cin >> workers[i];
  72.  
  73. printf("\n\n");
  74.  
  75. }
  76.  
  77. for (int i = 0; i < enterp; ++i)
  78. {
  79. cout << directors[i];
  80. printf("\n");
  81. cout << type[i];
  82. printf("\n");
  83. cout << area[i];
  84. printf("\n");
  85. cout << workers[i];
  86. printf("\n");
  87. }
  88.  
  89. printf("%c", 201);
  90. for (int i = 0; i < fullt; ++i)
  91. {
  92. printf("%c", 205);
  93. }
  94. printf("%c\n", 187);
  95. printf("%c", 186);
  96.  
  97. cout << main;
  98. for (int i = 0; i < fullt - strlen(main); ++i)
  99. {
  100. printf(" ");
  101. }
  102.  
  103. printf("%c", 186);
  104. printf("\n");
  105. printf("%c", 199);
  106.  
  107. for (int i = 0; i < fullt; ++i)
  108. {
  109. if (part == i % part + 1)
  110. {
  111. printf("%c", 194);
  112. }
  113. else
  114. {
  115. printf("%c", 196);
  116. }
  117. }
  118.  
  119. printf("%c", 182);
  120. printf("\n");
  121. //DIRECTORNAME TYPE....
  122. char DirName[] = "Director";
  123. char TypeP[] = "Type of property";
  124. char LandArea[] = "Land Area";
  125. char Work[] = "Worker`s count";
  126.  
  127. printf("%c", 186);
  128. cout << DirName;
  129. for (int i = 0; i < part-1-strlen(DirName); ++i)
  130. {
  131. printf(" ");
  132. }
  133. printf("%c", 179);// |
  134.  
  135. cout << TypeP;
  136. for (int i = 0; i < part - 1 - strlen(TypeP); ++i)
  137. {
  138. printf(" ");
  139. }
  140. printf("%c", 179);
  141.  
  142. cout << LandArea;
  143. for (int i = 0; i < part - 1 - strlen(LandArea); ++i)
  144. {
  145. printf(" ");
  146. }
  147. printf("%c", 179);
  148.  
  149. cout << Work;
  150. for (int i = 0; i < part - 1 - strlen(Work); ++i)
  151. {
  152. printf(" ");
  153. }
  154. printf("%c", 186);
  155.  
  156. printf("\n");
  157. printf("%c", 199);
  158.  
  159. for (int i = 0; i < fullt; ++i)
  160. {
  161.  
  162. if (part == i % part + 1)
  163. {
  164. printf("%c", 197);
  165. }
  166. else
  167. {
  168. printf("%c", 196);
  169. }
  170.  
  171.  
  172. }
  173. printf("%c", 182);
  174. printf("\n");
  175.  
  176. //Directors
  177. for (int j = 0; j < enterp; ++j)
  178. {
  179. printf("%c", 186);
  180.  
  181. cout << directors[j];
  182. for (int l = 0; l < part - 1 - strlen(directors[j]); ++l)
  183. {
  184. printf(" ");
  185.  
  186. }
  187. printf("%c", 179);
  188.  
  189.  
  190. //Type
  191. cout << type[j];
  192. for (int l = 0; l < part - 1 - strlen(type[j]); ++l)
  193. {
  194. printf(" ");
  195.  
  196. }
  197. printf("%c", 179);
  198.  
  199. //Area
  200. cout << area[j];
  201. for (int l = 0; l < part - 1 - lenOfInt(area[j]); ++l)
  202. {
  203. printf(" ");
  204.  
  205. }
  206. printf("%c", 179);
  207. //Workers
  208. cout << workers[j];
  209. for (int l = 0; l < part - 1 - lenOfInt(workers[j]); ++l)
  210. {
  211. printf(" ");
  212.  
  213. }
  214.  
  215. printf("%c", 186);
  216. printf("\n");
  217. printf("%c", 199);
  218.  
  219. if (j != enterp - 1)
  220. {
  221. for (int i = 0; i < fullt; ++i)
  222. {
  223. if (part == i % part + 1)
  224. {
  225. printf("%c", 197);
  226. }
  227. else
  228. {
  229. printf("%c", 196);
  230. }
  231. }
  232.  
  233. printf("%c", 182);
  234. printf("\n");
  235.  
  236. }
  237. }
  238.  
  239. for (int i = 0; i < fullt; ++i)
  240. {
  241. if (part == i % part + 1)
  242. {
  243. printf("%c", 193);
  244. }
  245. else
  246. {
  247. printf("%c", 196);
  248. }
  249. }
  250.  
  251. printf("%c", 182);
  252. printf("\n");
  253. printf("%c", 186);
  254.  
  255. cout << main1;
  256. for (int i = 0; i < fullt - strlen(main1); ++i)
  257. {
  258. printf(" ");
  259. }
  260. printf("%c", 186);
  261. printf("\n");
  262.  
  263. printf("%c", 200);
  264. for (int i = 0; i < fullt; ++i)
  265. {
  266. printf("%c", 205);
  267. }
  268. printf("%c", 188);
  269. printf("\n");
  270.  
  271. system("pause");
  272. return 0;
  273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement