Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <Windows.h>
- #include <stdio.h>
- typedef unsigned char byte;
- typedef struct
- {
- char name[25];
- char form;
- int area, kol;
- } business;
- int printText(const char* str)
- {
- unsigned a = GetConsoleOutputCP();
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- int count = printf("%s", str);
- SetConsoleCP(a);
- SetConsoleOutputCP(a);
- return count;
- }
- void printChars(int count, char ch)
- {
- for (int i = 0; i < count; ++i) { printf("%c", ch); }
- }
- int zapov(business *mon)
- {
- int n = 0;
- for (int i = 0; i < 10; i++)
- {
- printf("%d - ", i+1);
- printText(" Введите назву, вид властивости, площу, кіл-ть робітників\n");
- scanf("%s %c %d %d", mon[i].name, &mon[i].form, &mon[i].area, &mon[i].kol);
- if (strcmp(mon[i].name, "***") == 0)
- {
- break;
- }
- printf("%s %c %d %d\n", mon[i].name, mon[i].form, mon[i].area, mon[i].kol);
- n++;
- }
- return n;
- }
- int main()
- {
- business mon[10];
- int n = zapov(mon);
- getchar();
- for (int i = 0; i < 69; i++)
- {
- printf("-");
- }
- printf("\n");
- printf("| Сільськогосподарські підприємства |");
- printf("\n");
- for (int i = 0; i < 69; i++)
- {
- printf("-");
- }
- printf("\n");
- printf("| Назва | Вид властивості | Площа землі (га) | Кількість робітників |");
- printf("\n");
- for (int i = 0; i < 69; i++)
- {
- printf("-");
- }
- printf("\n");
- printf("| Зоря | Д | 120 | 300 |");
- printf("\n");
- for (int i = 0; i < 69; i++)
- {
- printf("-");
- }
- printf("\n");
- printf("| Зоря | Д | 120 | 300 |");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement