Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <Windows.h>
- #include <cstdlib>
- using namespace std;
- int lenOfInt(int number)
- {
- char count = 0;
- while (number != 0)
- {
- number /= 10;
- ++count;
- }
- return count;
- }
- int main(int argc, char* argv[])
- {
- int fullt = 79;
- int part = 20;
- char main[] = "Agricultural enterprises\0";
- char main1[] = "Type of property: S - state, P - private, C -cooperative\0";
- short enterp = 0;
- 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");
- printf("Please enter length of tablet\n");
- scanf("%d", &fullt);
- --fullt;
- printf("Please enter length of block\n");
- scanf("%d", &part);
- cout << "Hint: " << main1 << "\n";
- printf("Please enter count of enterprises\n");
- scanf("%d", &enterp);
- char** directors = (char**)malloc(sizeof(char*) * enterp);
- for (int i = 0; i < 3; ++i)
- {
- directors[i] = (char*)malloc(sizeof(char) * 13);
- }
- char** type = (char**)malloc(sizeof(char*) * enterp);
- for (int i = 0; i < 3; ++i)
- {
- type[i] = (char*)malloc(sizeof(int) * 3);
- }
- int *area = (int*)malloc(sizeof(int) * enterp);
- int* workers = (int*)malloc(sizeof(int) * enterp);
- //Entering info
- for (int i = 0; i < enterp; ++i)
- {
- printf("Please enter name of director %d\n", i + 1);
- cin >> directors[i];
- printf("Please enter type of property %d\n", i + 1);
- cin >> type[i];
- printf("Please enter area of company %d\n", i + 1);
- cin >> area[i];
- printf("Please enter workers of company %d\n", i + 1);
- cin >> workers[i];
- printf("\n\n");
- }
- for (int i = 0; i < enterp; ++i)
- {
- cout << directors[i];
- printf("\n");
- cout << type[i];
- printf("\n");
- cout << area[i];
- printf("\n");
- cout << workers[i];
- printf("\n");
- }
- printf("%c", 201);
- for (int i = 0; i < fullt; ++i)
- {
- printf("%c", 205);
- }
- printf("%c\n", 187);
- printf("%c", 186);
- cout << main;
- for (int i = 0; i < fullt - strlen(main); ++i)
- {
- printf(" ");
- }
- printf("%c", 186);
- printf("\n");
- printf("%c", 199);
- for (int i = 0; i < fullt; ++i)
- {
- if (part == i % part + 1)
- {
- printf("%c", 194);
- }
- else
- {
- printf("%c", 196);
- }
- }
- printf("%c", 182);
- printf("\n");
- //DIRECTORNAME TYPE....
- char DirName[] = "Director";
- char TypeP[] = "Type of property";
- char LandArea[] = "Land Area";
- char Work[] = "Worker`s count";
- printf("%c", 186);
- cout << DirName;
- for (int i = 0; i < part-1-strlen(DirName); ++i)
- {
- printf(" ");
- }
- printf("%c", 179);// |
- cout << TypeP;
- for (int i = 0; i < part - 1 - strlen(TypeP); ++i)
- {
- printf(" ");
- }
- printf("%c", 179);
- cout << LandArea;
- for (int i = 0; i < part - 1 - strlen(LandArea); ++i)
- {
- printf(" ");
- }
- printf("%c", 179);
- cout << Work;
- for (int i = 0; i < part - 1 - strlen(Work); ++i)
- {
- printf(" ");
- }
- printf("%c", 186);
- printf("\n");
- printf("%c", 199);
- for (int i = 0; i < fullt; ++i)
- {
- if (part == i % part + 1)
- {
- printf("%c", 197);
- }
- else
- {
- printf("%c", 196);
- }
- }
- printf("%c", 182);
- printf("\n");
- //Directors
- for (int j = 0; j < enterp; ++j)
- {
- printf("%c", 186);
- cout << directors[j];
- for (int l = 0; l < part - 1 - strlen(directors[j]); ++l)
- {
- printf(" ");
- }
- printf("%c", 179);
- //Type
- cout << type[j];
- for (int l = 0; l < part - 1 - strlen(type[j]); ++l)
- {
- printf(" ");
- }
- printf("%c", 179);
- //Area
- cout << area[j];
- for (int l = 0; l < part - 1 - lenOfInt(area[j]); ++l)
- {
- printf(" ");
- }
- printf("%c", 179);
- //Workers
- cout << workers[j];
- for (int l = 0; l < part - 1 - lenOfInt(workers[j]); ++l)
- {
- printf(" ");
- }
- printf("%c", 186);
- printf("\n");
- printf("%c", 199);
- if (j != enterp - 1)
- {
- for (int i = 0; i < fullt; ++i)
- {
- if (part == i % part + 1)
- {
- printf("%c", 197);
- }
- else
- {
- printf("%c", 196);
- }
- }
- printf("%c", 182);
- printf("\n");
- }
- }
- for (int i = 0; i < fullt; ++i)
- {
- if (part == i % part + 1)
- {
- printf("%c", 193);
- }
- else
- {
- printf("%c", 196);
- }
- }
- printf("%c", 182);
- printf("\n");
- printf("%c", 186);
- cout << main1;
- for (int i = 0; i < fullt - strlen(main1); ++i)
- {
- printf(" ");
- }
- printf("%c", 186);
- printf("\n");
- printf("%c", 200);
- for (int i = 0; i < fullt; ++i)
- {
- printf("%c", 205);
- }
- printf("%c", 188);
- printf("\n");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement