Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <Windows.h>
  3. #include <stdio.h>
  4.  
  5. typedef unsigned char byte;
  6.  
  7.  
  8. typedef struct
  9. {
  10. char name[25];
  11. char form;
  12. int area, kol;
  13. } business;
  14.  
  15. int printText(const char* str)
  16. {
  17. unsigned a = GetConsoleOutputCP();
  18. SetConsoleCP(1251);
  19. SetConsoleOutputCP(1251);
  20. int count = printf("%s", str);
  21. SetConsoleCP(a);
  22. SetConsoleOutputCP(a);
  23. return count;
  24. }
  25.  
  26. void printChars(int count, char ch)
  27. {
  28. for (int i = 0; i < count; ++i) { printf("%c", ch); }
  29. }
  30.  
  31. int zapov(business *mon)
  32. {
  33. int n = 0;
  34. for (int i = 0; i < 10; i++)
  35. {
  36.  
  37. printf("%d - ", i+1);
  38. printText(" Введите назву, вид властивости, площу, кіл-ть робітників\n");
  39. scanf("%s %c %d %d", mon[i].name, &mon[i].form, &mon[i].area, &mon[i].kol);
  40. if (strcmp(mon[i].name, "***") == 0)
  41. {
  42. break;
  43. }
  44. printf("%s %c %d %d\n", mon[i].name, mon[i].form, mon[i].area, mon[i].kol);
  45. n++;
  46. }
  47. return n;
  48. }
  49. int main()
  50. {
  51. business mon[10];
  52. int n = zapov(mon);
  53. getchar();
  54. for (int i = 0; i < 69; i++)
  55. {
  56. printf("-");
  57. }
  58. printf("\n");
  59. printf("| Сільськогосподарські підприємства |");
  60. printf("\n");
  61. for (int i = 0; i < 69; i++)
  62. {
  63. printf("-");
  64. }
  65. printf("\n");
  66. printf("| Назва | Вид властивості | Площа землі (га) | Кількість робітників |");
  67. printf("\n");
  68. for (int i = 0; i < 69; i++)
  69. {
  70. printf("-");
  71. }
  72. printf("\n");
  73. printf("| Зоря | Д | 120 | 300 |");
  74. printf("\n");
  75. for (int i = 0; i < 69; i++)
  76. {
  77. printf("-");
  78. }
  79. printf("\n");
  80. printf("| Зоря | Д | 120 | 300 |");
  81.  
  82. system("pause");
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement