diff --git a/.gitignore b/.gitignore index ca1c7a3..c3438d4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,11 @@ ## ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore +# my filter +Лекции/ +array test/ +Helloworld/ + # User-specific files *.rsuser *.suo diff --git a/Arrays/Arrays.sln b/Arrays/Arrays.sln new file mode 100644 index 0000000..86003b0 --- /dev/null +++ b/Arrays/Arrays.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Arrays", "Arrays\Arrays.vcxproj", "{32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Debug|x64.ActiveCfg = Debug|x64 + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Debug|x64.Build.0 = Debug|x64 + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Debug|x86.ActiveCfg = Debug|Win32 + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Debug|x86.Build.0 = Debug|Win32 + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Release|x64.ActiveCfg = Release|x64 + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Release|x64.Build.0 = Release|x64 + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Release|x86.ActiveCfg = Release|Win32 + {32E273E0-92B2-4A96-AA6B-1C20B4A8CF6F}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2CC826F5-18F9-4372-8E53-07CDC0F26658} + EndGlobalSection +EndGlobal diff --git a/Arrays/Arrays/Arrays.vcxproj b/Arrays/Arrays/Arrays.vcxproj new file mode 100644 index 0000000..00a0a3e --- /dev/null +++ b/Arrays/Arrays/Arrays.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {32e273e0-92b2-4a96-aa6b-1c20b4a8cf6f} + Arrays + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/Arrays/Arrays/Arrays.vcxproj.filters b/Arrays/Arrays/Arrays.vcxproj.filters new file mode 100644 index 0000000..a5d4be4 --- /dev/null +++ b/Arrays/Arrays/Arrays.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/Arrays/Arrays/hello.c b/Arrays/Arrays/hello.c new file mode 100644 index 0000000..11c90a5 --- /dev/null +++ b/Arrays/Arrays/hello.c @@ -0,0 +1,8 @@ +#include + +void hello() { + for (int i = 0; i < 10; i++) { + printf("%d bruh its C language\n", i); + } + puts("lolo"); +} \ No newline at end of file diff --git a/Arrays/Arrays/main.c b/Arrays/Arrays/main.c new file mode 100644 index 0000000..cb95807 --- /dev/null +++ b/Arrays/Arrays/main.c @@ -0,0 +1,16 @@ +#include + +#define M 3 +#define N 3 + +int main() { + int arr[M][N] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; + for (int i = 0; i < M; i++) { + for (int j = 0; j < N; j++) { + printf("%d", arr[i][j]); + } + printf("\n"); + } + hello(); + return 0; +} \ No newline at end of file diff --git a/geany/arrays.c b/geany/arrays.c new file mode 100644 index 0000000..eb68f28 --- /dev/null +++ b/geany/arrays.c @@ -0,0 +1,86 @@ +#include + +#define M 3 +#define N 3 + +void printarr(int m, int n, int a[M][N]) { + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + printf("%2d ", a[i][j]); + } + printf("\n"); + } +} + +void intmulti(int m, int n, int a[M][N], int x) { + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + a[i][j] = a[i][j] * x; + } + } +} + +void addmx(int m, int n, int A[M][N], int B[M][N], int C[M][N]) { + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + C[i][j] = A[i][j] + B[i][j]; + } + } +} + +void mulmx(int m, int n, int A[M][N], int B[M][N], int C[M][N]) { + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + for (int p = 0; p < n; p++) + C[i][j] += + A[i][p] * B[p][j]; + } + } +} + +void transpone(int m, int n, int A[M][N], int At[M][N]) { + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + At[i][j] = A[j][i]; + } + } +} + +int main() { + /* + int A[2][2] = {{3, -2}, {5, -4}}; + int B[2][2] = {{3, 4}, {2, 5}}; + int C[2][2] = {{0, 0}, {0, 0}}; + mulmx(2, 2, A, B, C); + printarr(2, 2, C); + */ + int A[M][N] = { {5, 8, -4}, {6, 9, -5}, {4, 7, -3} }; + int B[M][N] = { {3, 2, 5}, {4, -1, 3}, {9, 6, 5} }; + int C[M][N] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }; + /*int D[M][N] = { + {1, 1, 1}, + {1, 1, 1}, + {1, 1, 1}, + };*/ + printarr(M, N, A); + puts(""); + printarr(M, N, B); + puts(""); + mulmx(M, N, A, B, C); + printarr(M, N, C); + puts(""); + //printarr(M, N, D); + //puts(""); + + //addmx(M, N, A, B, C); + //printarr(M, N, C); + + //intmulti(M, N, A, 2); + //printarr(M, N, A); + + return 0; +} + +/* +int A[M][N] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; +int B[M][N] = { {1, 1, 1}, {1, 1, 1}, {1, 1, 1} }; +int C[M][N] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };*/ diff --git a/geany/helloworld.c b/geany/helloworld.c new file mode 100644 index 0000000..a34a635 --- /dev/null +++ b/geany/helloworld.c @@ -0,0 +1,22 @@ +#include +#include +#include + +int main() { + printf("default cp = %d\n", GetConsoleCP()); + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + printf("new cp = %d\n", GetConsoleCP()); + //printf("%s\n", setlocale(LC_ALL, "Russian_Russia.866")); + //printf("%s\n", setlocale(LC_CTYPE, "")); + printf("Hello world! !\n"); + printf("%f\n", 1234567.89); + char str[200]; + printf(" input text: "); + fgets(str, sizeof(str), stdin); + //scanf("%5[^\n]", str); + printf("output text: %s", str); + printf("lolol"); + return 0; +} + diff --git a/geany/lab2.c b/geany/lab2.c new file mode 100644 index 0000000..d907b96 --- /dev/null +++ b/geany/lab2.c @@ -0,0 +1,74 @@ +#include +#include +#include +#include + +#define PI 3.14159265358979323846 + +void vector_angle() { + float x1, y1, x2, y2; + printf(" \n"); + printf("x1 = "); + scanf_s("%f", &x1); + printf("y1 = "); + scanf_s("%f", &y1); + printf("x2 = "); + scanf_s("%f", &x2); + printf("y2 = "); + scanf_s("%f", &y2); + printf("%.2f ", 57.3 * acos((x1 * x2 + y1 * y2) / (sqrt(x1 * x1 + y1 * y1) * sqrt(x2 * x2 + y2 * y2)))); +} + +void lc_freq() { + float L, C; + printf("L = "); + scanf_s("%f", &L); + printf("C = "); + scanf_s("%f", &C); + printf("%.2f ", 1 / (2 * PI * sqrt(L * C))); +} + +void deposit() { + int money, days; + float rate, eff, result; + printf(" %% = "); + scanf_s("%f", &rate); + printf(" = "); + scanf_s("%d", &money); + printf(" = "); + scanf_s("%d", &days); + result = money * pow((1 + (rate / 100) / days), days); + eff = (result - money) / money * 100; + printf(" = %.2f%% = %.2f", eff, result - money); +} + +int main() { + //setlocale(LC_ALL, "Russian"); + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int num; + printf("1. .\n"); + printf("2. LC-.\n"); + printf("3. .\n"); + + printf(" : "); + scanf_s("%d", &num); + + switch (num) + { + case 1: + vector_angle(); + break; + case 2: + lc_freq(); + break; + case 3: + deposit(); + break; + default: + printf(" !"); + break; + } + return 0; +} diff --git a/geany/lab3-2.c b/geany/lab3-2.c new file mode 100644 index 0000000..8703211 --- /dev/null +++ b/geany/lab3-2.c @@ -0,0 +1,26 @@ +#include +#include + +int main() { + int max, v1, v2, v3; + + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + printf(" 3 : "); + scanf_s("%d%d%d", &v1, &v2, &v3); + max = v1; + + if (v2 > max) { + max = v2; + } + + if (v3 > max) { + max = v3; + } + + printf("max = %d", max); + + return 0; +} + diff --git a/geany/lab3-3.c b/geany/lab3-3.c new file mode 100644 index 0000000..e064b57 --- /dev/null +++ b/geany/lab3-3.c @@ -0,0 +1,20 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int t; + printf(" = "); + scanf_s("%d", &t); + + if (t < 18) printf(""); + else if (t < 22) printf(""); + else if (t < 26) printf(""); + else printf(""); + + return 0; +} + diff --git a/geany/lab3-4.c b/geany/lab3-4.c new file mode 100644 index 0000000..68e6a56 --- /dev/null +++ b/geany/lab3-4.c @@ -0,0 +1,23 @@ +#include +#include + +int main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int nums[5]; + int max; + + printf(" 5 : "); + scanf_s("%d%d%d%d%d", &nums[0], &nums[1], &nums[2], &nums[3], &nums[4]); + + max = nums[0]; + + for (int i = 1; i < 5; i++) { + if (nums[i] > max) max = nums[i]; + } + + printf("max = %d", max); + + return 0; +} diff --git a/geany/lab3-7.c b/geany/lab3-7.c new file mode 100644 index 0000000..6ff0d7c --- /dev/null +++ b/geany/lab3-7.c @@ -0,0 +1,22 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int v; + printf(" / = "); + scanf("%d", &v); + + if (v > 3000) puts(""); + else if (v > 1200) puts(" "); + else if (v > 800) puts(""); + else if (v > 500) puts(""); + else if (v > 200) puts(""); + else puts(" "); + + return 0; +} + diff --git a/geany/lab4-1.c b/geany/lab4-1.c new file mode 100644 index 0000000..ed4cf2e --- /dev/null +++ b/geany/lab4-1.c @@ -0,0 +1,21 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int n; + printf("n = "); + scanf("%d", &n); + + int i = 1; + do { + printf("%d ", i); + i += 1; + } while (i <= n); + + return 0; +} + diff --git a/geany/lab4-2.c b/geany/lab4-2.c new file mode 100644 index 0000000..ed4b868 --- /dev/null +++ b/geany/lab4-2.c @@ -0,0 +1,22 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int n; + printf("n = "); + scanf("%d", &n); + + int i = 1; + int step = 0; + do { + printf("2^%d = %d\n", step, i); + i = i * 2; + step += 1; + } while (step <= n); + + return 0; +} diff --git a/geany/lab4-3.c b/geany/lab4-3.c new file mode 100644 index 0000000..f9e2894 --- /dev/null +++ b/geany/lab4-3.c @@ -0,0 +1,24 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int sum, year; + float percent; + printf("sum = "); + scanf("%d", &sum); + printf("percent = "); + scanf("%f", &percent); + + year = 0; + do { + printf("%d RUB in %d year\n", sum, year); + sum = (sum * (100 + percent)) / 100; + year += 1; + } while (year <= 10); + + return 0; +} diff --git a/geany/lab4-6.c b/geany/lab4-6.c new file mode 100644 index 0000000..4eb236b --- /dev/null +++ b/geany/lab4-6.c @@ -0,0 +1,36 @@ +#include +#include + +int main() { + int n; + printf("num of fibonacchi numbers = "); + scanf("%d", &n); + + double a = 0.0; + double b = 1.0; + double c; + + printf("0\n1\n"); + n = n - 2; + do { + c = a + b; + a = b; + if (b > c) { + printf("overflow, remaining n = %d", n); + break; + } + b = c; + printf("%lf\n", c); + n = n - 1; + } while (n > 0); + + puts("\n------------"); + + if (pow(2, 64) > 12200160415121876738.0) { + printf("%f is bigger than %f", pow(2, 64), 12200160415121876738.0); + } else { + puts("12200160415121876738 is bigger"); + } + //printf("%u", sizeof(12200160415121876738)); + return 0; +} diff --git a/lab1/diagram.png b/lab1/diagram.png new file mode 100644 index 0000000..d1ed9bf Binary files /dev/null and b/lab1/diagram.png differ diff --git a/lab1/lab1.sln b/lab1/lab1.sln new file mode 100644 index 0000000..76bb92a --- /dev/null +++ b/lab1/lab1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab1", "lab1\lab1.vcxproj", "{DA39C008-B93D-44F0-8A3D-F658DFC530B9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Debug|x64.ActiveCfg = Debug|x64 + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Debug|x64.Build.0 = Debug|x64 + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Debug|x86.ActiveCfg = Debug|Win32 + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Debug|x86.Build.0 = Debug|Win32 + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Release|x64.ActiveCfg = Release|x64 + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Release|x64.Build.0 = Release|x64 + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Release|x86.ActiveCfg = Release|Win32 + {DA39C008-B93D-44F0-8A3D-F658DFC530B9}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {450B6B2F-D003-49CA-951E-B5873A662743} + EndGlobalSection +EndGlobal diff --git a/lab1/lab1/lab1.vcxproj b/lab1/lab1/lab1.vcxproj new file mode 100644 index 0000000..1394375 --- /dev/null +++ b/lab1/lab1/lab1.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {da39c008-b93d-44f0-8a3d-f658dfc530b9} + lab1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lab1/lab1/lab1.vcxproj.filters b/lab1/lab1/lab1.vcxproj.filters new file mode 100644 index 0000000..669bc4e --- /dev/null +++ b/lab1/lab1/lab1.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab1/lab1/main.c b/lab1/lab1/main.c new file mode 100644 index 0000000..4ae725b --- /dev/null +++ b/lab1/lab1/main.c @@ -0,0 +1,44 @@ +#include + +void drawShip() { + printf(" ____\n"); + printf(" ---|\n"); + printf(" \\/ /| \\/\n"); + printf(" / |\\\n"); + printf(" / | \\ \\/\n"); + printf(" / || \\\n"); + printf(" / | | \\\n"); + printf(" / | | \\\n"); + printf(" / | | \\\n"); + printf(" / || \\\n"); + printf(" / / \\\n"); + printf(" /________/ \\\n"); + printf(" ________/__________--/\n"); + printf(" ~~~ \\___________________/\n"); + printf(" ~~~~~~~~~~ ~~~~~~~~\n"); + printf("~~~~~~~~~~~~~ ~~~~~~~~~\n"); + printf(" ~~~~~~~~~"); +} + +int main() { + drawShip(); + return 0; +} + +// ____ +// ---| +// \/ /| \/ +// / |\ +// / | \ \/ +// / || \ +// / | | \ +// / | | \ +// / | | \ +// / || \ +// / / \ +// /________/ \ +// ________/__________--/ +// ~~~ \___________________/ +// ~~~~~~~~~~ ~~~~~~~~ +//~~~~~~~~~~~~~ ~~~~~~~~~ +// ~~~~~~~~~ \ No newline at end of file diff --git a/lab10/lab10.sln b/lab10/lab10.sln new file mode 100644 index 0000000..f7f6836 --- /dev/null +++ b/lab10/lab10.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab10", "lab10\lab10.vcxproj", "{656A5C2B-24D5-40ED-A852-3E38EDE307B0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Debug|x64.ActiveCfg = Debug|x64 + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Debug|x64.Build.0 = Debug|x64 + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Debug|x86.ActiveCfg = Debug|Win32 + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Debug|x86.Build.0 = Debug|Win32 + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Release|x64.ActiveCfg = Release|x64 + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Release|x64.Build.0 = Release|x64 + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Release|x86.ActiveCfg = Release|Win32 + {656A5C2B-24D5-40ED-A852-3E38EDE307B0}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FE0BD7A7-5DE3-4E9A-8CE7-60E8F5FCA1D0} + EndGlobalSection +EndGlobal diff --git a/lab10/lab10/lab10.vcxproj b/lab10/lab10/lab10.vcxproj new file mode 100644 index 0000000..31929a1 --- /dev/null +++ b/lab10/lab10/lab10.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {656a5c2b-24d5-40ed-a852-3e38ede307b0} + lab10 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/lab10/lab10/lab10.vcxproj.filters b/lab10/lab10/lab10.vcxproj.filters new file mode 100644 index 0000000..91883cd --- /dev/null +++ b/lab10/lab10/lab10.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab10/lab10/main.c b/lab10/lab10/main.c new file mode 100644 index 0000000..cb4e839 --- /dev/null +++ b/lab10/lab10/main.c @@ -0,0 +1,127 @@ +#include + + +void printTable() { + int i = 1; + while (i <= 9) { + int j = 1; + while (j <= 9) { + printf("%d%d ", i, j); + j++; + } + i++; + puts(""); + } +} + +void pithagoreanTable() { + int i = 1; + while (i <= 10) { + int j = 1; + while (j <= 10) { + printf("%3d ", i * j); + j++; + } + i++; + puts(""); + } +} + +void numTriagle() { + int n = 0; + printf("N = "); + scanf_s("%d", &n); + int i = 0; + while (i < n) { + int j = i; + while (j >= 0) { + printf("%d ", n - j); + j--; + } + puts(""); + i++; + } + +} + +void hardNumTriagle() { + int n = 0; + printf("N = "); + scanf_s("%d", &n); + int i = 0; + while (i < n) { + int space = n - i - 1; + while (space > 0) { + printf(" "); + space--; + } + int j = i; + while (j >= 0) { + printf("%2d ", n - j); + j--; + } + puts(""); + i++; + } + i--; + while (i > 0) { + int space = 0; + while (space < n - i) { + printf(" "); + space++; + } + int j = i - 1; + while (j >= 0) { + printf("%2d ", n - j); + j--; + } + puts(""); + i--; + } + +} + +int main() { + int n = -1; + int r = 0; + do { + puts("\n"); + puts("choose program"); + puts("1) print ij matrix"); + puts("2) print pithagorean table"); + puts("3) print number triangle"); + puts("4) print hard number triangle"); + puts(""); + puts("0) exit program"); + + while (scanf_s(" %d", &n) != 1) { + scanf_s("%*[^\n]"); + scanf_s("%*c"); + } + puts(""); + + switch (n) + { + case 1: + printTable(); + break; + case 2: + pithagoreanTable(); + break; + case 3: + numTriagle(); + break; + case 4: + hardNumTriagle(); + break; + case 0: + puts("goodbye :3"); + break; + default: + puts("error: wrong N"); + break; + } + + } while (n != 0); + return 0; +} \ No newline at end of file diff --git a/lab10/numTriangle.json b/lab10/numTriangle.json new file mode 100644 index 0000000..a07a4cf --- /dev/null +++ b/lab10/numTriangle.json @@ -0,0 +1 @@ +{"blocks":[{"x":555,"y":130,"text":"numTriangle","width":130,"height":20,"type":"Текст / комментарий","isMenuBlock":false,"fontSize":19,"textHeight":19,"isBold":true,"isItalic":false,"textAlign":"left","labelsPosition":1},{"x":550,"y":200,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":270,"text":"ввод n","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":430,"text":"i < n","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":640,"text":"вывод n - j","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":550,"text":"j ≥ 0","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":720,"text":"j = j - 1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":340,"text":"i = 0","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":470,"text":"j = i","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":550,"text":"вывод '\\n'","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":630,"text":"i = i + 1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":390,"y":430,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1}],"arrows":[{"startIndex":2,"endIndex":7,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":290},{"x":550,"y":300},{"x":550,"y":320}],"counts":[1,1,1]},{"startIndex":1,"endIndex":2,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":215},{"x":550,"y":230},{"x":550,"y":250}],"counts":[1,1,1]},{"startIndex":7,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":360},{"x":550,"y":390},{"x":550,"y":410}],"counts":[1,1,1]},{"startIndex":3,"endIndex":8,"startConnectorIndex":1,"endConnectorIndex":0,"nodes":[{"x":600,"y":430},{"x":700,"y":430},{"x":700,"y":450}],"counts":[1,1,1]},{"startIndex":5,"endIndex":4,"startConnectorIndex":1,"endConnectorIndex":0,"nodes":[{"x":750,"y":550},{"x":770,"y":550},{"x":770,"y":600},{"x":700,"y":600},{"x":700,"y":620}],"counts":[1,1,1,1,1]},{"startIndex":4,"endIndex":6,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":700,"y":660},{"x":700,"y":680},{"x":700,"y":700}],"counts":[1,1,1]},{"startIndex":8,"endIndex":5,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":700,"y":490},{"x":700,"y":510},{"x":700,"y":530}],"counts":[1,1,1]},{"startIndex":6,"endIndex":5,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":700,"y":740},{"x":700,"y":760},{"x":800,"y":760},{"x":800,"y":510},{"x":700,"y":510},{"x":700,"y":530}],"counts":[1,1,1,1,1,1]},{"startIndex":5,"endIndex":9,"startConnectorIndex":3,"endConnectorIndex":1,"nodes":[{"x":650,"y":550},{"x":630,"y":550},{"x":610,"y":550}],"counts":[1,1,1]},{"startIndex":9,"endIndex":10,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":570},{"x":550,"y":590},{"x":550,"y":610}],"counts":[1,1,1]},{"startIndex":10,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":650},{"x":550,"y":790},{"x":850,"y":790},{"x":850,"y":390},{"x":550,"y":390},{"x":550,"y":410}],"counts":[1,1,1,1,1,1]},{"startIndex":3,"endIndex":11,"startConnectorIndex":3,"endConnectorIndex":1,"nodes":[{"x":500,"y":430},{"x":460,"y":430},{"x":440,"y":430}],"counts":[1,1,1]}],"x0":-1129,"y0":-863} \ No newline at end of file diff --git a/lab10/numTriangle.png b/lab10/numTriangle.png new file mode 100644 index 0000000..de00d0c Binary files /dev/null and b/lab10/numTriangle.png differ diff --git a/lab12/lab12.sln b/lab12/lab12.sln new file mode 100644 index 0000000..12f025f --- /dev/null +++ b/lab12/lab12.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab12", "lab12\lab12.vcxproj", "{45C15208-08C4-4B71-A4D6-B58EDC8DA968}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Debug|x64.ActiveCfg = Debug|x64 + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Debug|x64.Build.0 = Debug|x64 + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Debug|x86.ActiveCfg = Debug|Win32 + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Debug|x86.Build.0 = Debug|Win32 + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Release|x64.ActiveCfg = Release|x64 + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Release|x64.Build.0 = Release|x64 + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Release|x86.ActiveCfg = Release|Win32 + {45C15208-08C4-4B71-A4D6-B58EDC8DA968}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {14D2C521-5CAB-4F8D-ABBD-F284772C1B2C} + EndGlobalSection +EndGlobal diff --git a/lab12/lab12/Resource.h b/lab12/lab12/Resource.h new file mode 100644 index 0000000..3f964d9 --- /dev/null +++ b/lab12/lab12/Resource.h @@ -0,0 +1,30 @@ +//{{NO_DEPENDENCIES}} +// Включаемый файл, созданный в Microsoft Visual C++. +// Используется lab12.rc + +#define IDS_APP_TITLE 103 + +#define IDR_MAINFRAME 128 +#define IDD_LAB12_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_LAB12 107 +#define IDI_SMALL 108 +#define IDC_LAB12 109 +#define IDC_MYICON 2 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif +// Следующие стандартные значения для новых объектов +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/lab12/lab12/framework.h b/lab12/lab12/framework.h new file mode 100644 index 0000000..a8f6dc8 --- /dev/null +++ b/lab12/lab12/framework.h @@ -0,0 +1,15 @@ +// header.h: включаемый файл для стандартных системных включаемых файлов +// или включаемые файлы для конкретного проекта +// + +#pragma once + +#include "targetver.h" +#define WIN32_LEAN_AND_MEAN // Исключите редко используемые компоненты из заголовков Windows +// Файлы заголовков Windows +#include +// Файлы заголовков среды выполнения C +#include +#include +#include +#include diff --git a/lab12/lab12/lab12.cpp b/lab12/lab12/lab12.cpp new file mode 100644 index 0000000..2aa3888 --- /dev/null +++ b/lab12/lab12/lab12.cpp @@ -0,0 +1,331 @@ +// lab12.cpp : Определяет точку входа для приложения. +// + +#include "framework.h" +#include "lab12.h" + +#define MAX_LOADSTRING 100 + +// Глобальные переменные: +HINSTANCE hInst; // текущий экземпляр +WCHAR szTitle[MAX_LOADSTRING]; // Текст строки заголовка +WCHAR szWindowClass[MAX_LOADSTRING]; // имя класса главного окна + +// Отправить объявления функций, включенных в этот модуль кода: +ATOM MyRegisterClass(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +int APIENTRY wWinMain(_In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPWSTR lpCmdLine, + _In_ int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // TODO: Разместите код здесь. + + // Инициализация глобальных строк + LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadStringW(hInstance, IDC_LAB12, szWindowClass, MAX_LOADSTRING); + MyRegisterClass(hInstance); + + // Выполнить инициализацию приложения: + if (!InitInstance (hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_LAB12)); + + MSG msg; + + // Цикл основного сообщения: + while (GetMessage(&msg, nullptr, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + + + +// +// ФУНКЦИЯ: MyRegisterClass() +// +// ЦЕЛЬ: Регистрирует класс окна. +// +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEXW wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_LAB12)); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_LAB12); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + return RegisterClassExW(&wcex); +} + +// +// ФУНКЦИЯ: InitInstance(HINSTANCE, int) +// +// ЦЕЛЬ: Сохраняет маркер экземпляра и создает главное окно +// +// КОММЕНТАРИИ: +// +// В этой функции маркер экземпляра сохраняется в глобальной переменной, а также +// создается и выводится главное окно программы. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + hInst = hInstance; // Сохранить маркер экземпляра в глобальной переменной + + HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +void drawNet(HDC hdc, int width, int height, int step) { + for (int i = 0; i <= width; i = i + step) { + MoveToEx(hdc, i, 0, NULL); + LineTo(hdc, i, height); + } + + for (int i = 0; i <= height; i = i + step) { + MoveToEx(hdc, 0, i, NULL); + LineTo(hdc, width, i); + } +} + +void drawImage1(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 4, color); + SelectObject(hdc, hPen); + + POINT p[4] = { + cx, cy - 20, + cx + 20, cy + 20, + cx - 20, cy + 20, + cx, cy - 20 + }; + Polyline(hdc, p, 4); + + DeleteObject(hPen); +} + +void drawImage2(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 4, color); + SelectObject(hdc, hPen); + + POINT p[5] = { + cx, cy - 20, + cx + 20, cy, + cx, cy + 20, + cx - 20, cy, + cx, cy - 20 + }; + Polyline(hdc, p, 5); + + DeleteObject(hPen); +} + +void drawImage3(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 1, color); + SelectObject(hdc, hPen); + + POINT p[5] = { + cx, cy, + cx + 20, cy - 20, + cx, cy + 20, + cx - 20, cy - 20, + cx, cy + }; + Polyline(hdc, p, 5); + + DeleteObject(hPen); +} + +struct Image { + int x; + int y; + int vx; + int vy; + COLORREF color; +}; +struct Image im1 = { 100, 100, 10, 10, RGB(200, 100, 128) }; +struct Image im2 = { 400, 100, -10, -10, RGB(100, 200, 128) }; + +#define IMG3NUM 8 +struct Image im3[IMG3NUM] = { + { 300, 100, 8, 10, RGB(150, 150, 220) }, + { 300, 100, -4, 7, RGB(150, 150, 220) }, + { 300, 100, -4, -11, RGB(150, 150, 220) }, + { 300, 100, 3, 15, RGB(150, 150, 220) }, + { 300, 100, 14, 7, RGB(150, 150, 220) }, + { 300, 100, -10, 10, RGB(150, 150, 220) }, + { 300, 100, 5, -10, RGB(150, 150, 220) }, + { 300, 100, -10, -7, RGB(150, 150, 220) }, +}; + +void bounce(RECT rect, struct Image* pim) { + if ((*pim).y >= rect.bottom and (*pim).vy > 0) { + (*pim).vy = -(*pim).vy; + (*pim).y = rect.bottom; + } + if ((*pim).y < rect.top + 1) { + (*pim).vy = -(*pim).vy; + (*pim).y = rect.top; + } + if ((*pim).x > rect.right - 1) { + (*pim).vx = -(*pim).vx; + (*pim).x = rect.right; + } + if ((*pim).x < rect.left + 1) { + (*pim).vx = -(*pim).vx; + (*pim).x = rect.left; + } +} + +//void bounce(RECT rect, struct Image* pim) { +// if ((*pim).y > rect.bottom - 1) { +// (*pim).vy = -(*pim).vy; +// (*pim).y = rect.bottom; +// } +// if ((*pim).y < rect.top + 1) { +// (*pim).vy = -(*pim).vy; +// (*pim).y = rect.top; +// } +// if ((*pim).x > rect.right - 1) { +// (*pim).vx = -(*pim).vx; +// (*pim).x = rect.right; +// } +// if ((*pim).x < rect.left + 1) { +// (*pim).vx = -(*pim).vx; +// (*pim).x = rect.left; +// } +//} + +// +// ФУНКЦИЯ: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// ЦЕЛЬ: Обрабатывает сообщения в главном окне. +// +// WM_COMMAND - обработать меню приложения +// WM_PAINT - Отрисовка главного окна +// WM_DESTROY - отправить сообщение о выходе и вернуться +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_COMMAND: + { + int wmId = LOWORD(wParam); + // Разобрать выбор в меню: + switch (wmId) + { + case IDM_ABOUT: + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + break; + case IDM_EXIT: + DestroyWindow(hWnd); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + } + break; + case WM_CREATE: + { + SetTimer(hWnd, 1, 100, 0); + } + break; + case WM_TIMER: + { + im1.x += im1.vx; im1.y += im1.vy; + im2.x += im2.vx; im2.y += im2.vy; + for (int i = 0; i < IMG3NUM; i++) { + im3[i].x += im3[i].vx; im3[i].y += im3[i].vy; + } + InvalidateRect(hWnd, NULL, TRUE); + } + break; + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hWnd, &ps); + // TODO: Добавьте сюда любой код прорисовки, использующий HDC... + + RECT rect; + GetClientRect(hWnd, &rect); + drawNet(hdc, rect.right, rect.bottom, 50); + + bounce(rect, &im1); + bounce(rect, &im2); + for (int i = 0; i < IMG3NUM; i++) { + bounce(rect, &im3[i]); + } + + drawImage1(hdc, im1.x, im1.y, im1.color); + drawImage2(hdc, im2.x, im2.y, im2.color); + for (int i = 0; i < IMG3NUM; i++) { + drawImage3(hdc, im3[i].x, im3[i].y, im3[i].color); + } + + EndPaint(hWnd, &ps); + } + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Обработчик сообщений для окна "О программе". +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + switch (message) + { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + return (INT_PTR)FALSE; +} diff --git a/lab12/lab12/lab12.h b/lab12/lab12/lab12.h new file mode 100644 index 0000000..d00d47e --- /dev/null +++ b/lab12/lab12/lab12.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/lab12/lab12/lab12.ico b/lab12/lab12/lab12.ico new file mode 100644 index 0000000..b3ec03b Binary files /dev/null and b/lab12/lab12/lab12.ico differ diff --git a/lab12/lab12/lab12.rc b/lab12/lab12/lab12.rc new file mode 100644 index 0000000..c7a2d4f Binary files /dev/null and b/lab12/lab12/lab12.rc differ diff --git a/lab12/lab12/lab12.vcxproj b/lab12/lab12/lab12.vcxproj new file mode 100644 index 0000000..6e47a26 --- /dev/null +++ b/lab12/lab12/lab12.vcxproj @@ -0,0 +1,148 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {45c15208-08c4-4b71-a4d6-b58edc8da968} + lab12 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level3 + true + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lab12/lab12/lab12.vcxproj.filters b/lab12/lab12/lab12.vcxproj.filters new file mode 100644 index 0000000..c9b0400 --- /dev/null +++ b/lab12/lab12/lab12.vcxproj.filters @@ -0,0 +1,49 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Файлы заголовков + + + Файлы заголовков + + + Файлы заголовков + + + Файлы заголовков + + + + + Исходные файлы + + + + + Файлы ресурсов + + + + + Файлы ресурсов + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab12/lab12/small.ico b/lab12/lab12/small.ico new file mode 100644 index 0000000..b3ec03b Binary files /dev/null and b/lab12/lab12/small.ico differ diff --git a/lab12/lab12/targetver.h b/lab12/lab12/targetver.h new file mode 100644 index 0000000..d90003d --- /dev/null +++ b/lab12/lab12/targetver.h @@ -0,0 +1,6 @@ +#pragma once + +// // При включении SDKDDKVer.h будет задана самая новая из доступных платформ Windows. +// Если вы планируете сборку приложения для предыдущей версии платформы Windows, включите WinSDKVer.h и +// задайте желаемую платформу в макросе _WIN32_WINNT, прежде чем включать SDKDDKVer.h. +#include diff --git a/lab13/diagram (1).png b/lab13/diagram (1).png new file mode 100644 index 0000000..21788ee Binary files /dev/null and b/lab13/diagram (1).png differ diff --git a/lab13/lab13.sln b/lab13/lab13.sln new file mode 100644 index 0000000..a5fc60f --- /dev/null +++ b/lab13/lab13.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34616.47 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab13", "lab13\lab13.vcxproj", "{20A86935-1CE2-4A60-8957-361F97CB04AA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Debug|x64.ActiveCfg = Debug|x64 + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Debug|x64.Build.0 = Debug|x64 + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Debug|x86.ActiveCfg = Debug|Win32 + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Debug|x86.Build.0 = Debug|Win32 + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Release|x64.ActiveCfg = Release|x64 + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Release|x64.Build.0 = Release|x64 + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Release|x86.ActiveCfg = Release|Win32 + {20A86935-1CE2-4A60-8957-361F97CB04AA}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DFB6070D-DF56-4483-A5CE-F17539C2A338} + EndGlobalSection +EndGlobal diff --git a/lab13/lab13/lab13.vcxproj b/lab13/lab13/lab13.vcxproj new file mode 100644 index 0000000..db7ce25 --- /dev/null +++ b/lab13/lab13/lab13.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {20a86935-1ce2-4a60-8957-361f97cb04aa} + lab13 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lab13/lab13/lab13.vcxproj.filters b/lab13/lab13/lab13.vcxproj.filters new file mode 100644 index 0000000..669bc4e --- /dev/null +++ b/lab13/lab13/lab13.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab13/lab13/main.c b/lab13/lab13/main.c new file mode 100644 index 0000000..2c552cf --- /dev/null +++ b/lab13/lab13/main.c @@ -0,0 +1,187 @@ +#include +#include + +void arrayinput(int arr[], int len) { + printf(" %d \n", len); + for (int i = 0; i < len; i++) { + scanf_s(" %d", &arr[i]); + } +} + +void printarr(int arr[], int len) { + printf(" : ["); + for (int i = 0; i < len; i++) { + printf("%d, ", arr[i]); + } + printf("\b\b]\n"); +} + +void odds10x(int arr[], int len) { + for (int i = 0; i < len; i++) { + if (arr[i] % 2 != 0) arr[i] *= 10; + } +} + +void lasteven2x(int arr[], int len) { + for (int i = len - 1; i > 0; i--) { + if (arr[i] % 2 == 0) { + arr[i] *= 2; + break; + } + } +} + +int index(int num, int arr[], int len) { + for (int i = 0; i < len; i++) { + if (arr[i] == num) return i; + } + return -1; +} + +int arrmax(int arr[], int len) { + int max = arr[0]; + for (int i = 1; i < len; i++) { + if (arr[i] > max) max = arr[i]; + } + return max; +} + +int arrmin(int arr[], int len) { + int min = arr[0]; + for (int i = 1; i < len; i++) { + if (arr[i] < min) min = arr[i]; + } + return min; +} + +void switchmaxmin(int arr[], int len) { + int tmpmax = arrmax(arr, len); + int tmpmin = arrmin(arr, len); + int maxi = index(tmpmax, arr, len); + int mini = index(tmpmin, arr, len); + arr[maxi] = tmpmin; + arr[mini] = tmpmax; +} + +void evenleftmin(int arr[], int len) { + int id = index(arrmin(arr, len), arr, len); + int count = 0; + for (int i = 0; i < id; i++) { + if (arr[i] % 2 == 0) count++; + } + printf(" = %d\n", count); +} + +void negeven(int arr[], int len) { + for (int i = 0; i < len; i++) { + if (arr[i] % 2 == 0) arr[i] *= -1; + } +} + +void replace4(int arr[], int len) { + for (int i = 0; i < len; i++) { + if (arr[i] < 4) arr[i] = 4; + } +} + +void replacemax0(int arr[], int len) { + int maxi = index(arrmax(arr, len), arr, len); + for (int i = maxi; i < len; i++) { + if (arr[i] % 2 != 0) arr[i] = 0; + } +} + +void muleveneven(int arr[], int len) { + int even1 = 0; + int even2 = len - 1; + for (int i = 0; i < len; i++) { + if (arr[i] % 2 == 0) { + even1 = i + 1; + break; + } + } + for (int i = len - 1; i > 0; i--) { + if (arr[i] % 2 == 0) { + even2 = i; + break; + } + } + for (int i = even1; i < even2; i++) { + arr[i] *= 100; + } +} + +#define ARRNUM 10 + +int main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int arr[ARRNUM] = {5, 7, 12, 3, 4, 8, -1, 6, 1, 7}; + /*for (int i = 0; i < ARRNUM; i++) { + arr[i] = 0; + }*/ + + int n = -1; + do { + puts("\n"); + printarr(arr, ARRNUM); + puts(" "); + puts("1) "); + puts("2) 10"); + puts("3) 2"); + puts("4) "); + puts("6) "); + puts("7) -1"); + puts("8) 4 4"); + puts("9) , , 0"); + puts("11) 100 "); + puts(""); + puts("0) exit program"); + + while (scanf_s(" %d", &n) != 1) { + scanf_s("%*[^\n]"); + scanf_s("%*c"); + } + puts(""); + + switch (n) + { + case 1: + arrayinput(arr, ARRNUM); + break; + case 2: + odds10x(arr, ARRNUM); + break; + case 3: + lasteven2x(arr, ARRNUM); + break; + case 4: + evenleftmin(arr, ARRNUM); + break; + case 6: + switchmaxmin(arr, ARRNUM); + break; + case 7: + negeven(arr, ARRNUM); + break; + case 8: + replace4(arr, ARRNUM); + break; + case 9: + replacemax0(arr, ARRNUM); + break; + case 11: + muleveneven(arr, ARRNUM); + break; + case 0: + puts("goodbye :3"); + break; + default: + puts("error: wrong N"); + break; + } + + } while (n != 0); + return 0; +} \ No newline at end of file diff --git a/lab14/diagram.json b/lab14/diagram.json new file mode 100644 index 0000000..5f35281 --- /dev/null +++ b/lab14/diagram.json @@ -0,0 +1 @@ +{"blocks":[{"x":550,"y":280,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":360,"text":"int i = *len","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":555,"y":230,"text":"insert(int num, int index, int arr[], int* len)","width":270,"height":20,"type":"Текст / комментарий","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"left","labelsPosition":1},{"x":550,"y":450,"text":"i > index","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":530,"text":"arr[i] = arr[i-1]","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":620,"text":"*len += 1\narr[index] = num","width":120,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":710,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1}],"arrows":[{"startIndex":0,"endIndex":1,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":295},{"x":550,"y":320},{"x":550,"y":340}],"counts":[1,1,1]},{"startIndex":1,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":380},{"x":550,"y":410},{"x":550,"y":430}],"counts":[1,1,1]},{"startIndex":3,"endIndex":4,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":470},{"x":550,"y":490},{"x":550,"y":510}],"counts":[1,1,1]},{"startIndex":4,"endIndex":3,"startConnectorIndex":1,"endConnectorIndex":0,"nodes":[{"x":600,"y":530},{"x":630,"y":530},{"x":630,"y":410},{"x":550,"y":410},{"x":550,"y":430}],"counts":[1,1,1,1,1]},{"startIndex":3,"endIndex":5,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":450},{"x":480,"y":450},{"x":480,"y":580},{"x":550,"y":580},{"x":550,"y":600}],"counts":[1,1,1,1,1]},{"startIndex":5,"endIndex":6,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":640},{"x":550,"y":680},{"x":550,"y":695}],"counts":[1,1,1]}],"x0":-1046.0499999999997,"y0":-1083.4740506757412} \ No newline at end of file diff --git a/lab14/diagram.png b/lab14/diagram.png new file mode 100644 index 0000000..0579542 Binary files /dev/null and b/lab14/diagram.png differ diff --git a/lab14/lab14.sln b/lab14/lab14.sln new file mode 100644 index 0000000..2ee367a --- /dev/null +++ b/lab14/lab14.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab14", "lab14\lab14.vcxproj", "{976C8B3E-9653-472C-94F9-13C7C59A4371}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Debug|x64.ActiveCfg = Debug|x64 + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Debug|x64.Build.0 = Debug|x64 + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Debug|x86.ActiveCfg = Debug|Win32 + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Debug|x86.Build.0 = Debug|Win32 + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Release|x64.ActiveCfg = Release|x64 + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Release|x64.Build.0 = Release|x64 + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Release|x86.ActiveCfg = Release|Win32 + {976C8B3E-9653-472C-94F9-13C7C59A4371}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A3E1F839-2D3D-4D5A-A443-E711427189C6} + EndGlobalSection +EndGlobal diff --git a/lab14/lab14/lab14.vcxproj b/lab14/lab14/lab14.vcxproj new file mode 100644 index 0000000..ccf1c7d --- /dev/null +++ b/lab14/lab14/lab14.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {976c8b3e-9653-472c-94f9-13c7c59a4371} + lab14 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lab14/lab14/lab14.vcxproj.filters b/lab14/lab14/lab14.vcxproj.filters new file mode 100644 index 0000000..669bc4e --- /dev/null +++ b/lab14/lab14/lab14.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab14/lab14/main.c b/lab14/lab14/main.c new file mode 100644 index 0000000..58fd7ef --- /dev/null +++ b/lab14/lab14/main.c @@ -0,0 +1,214 @@ +#include +#include + + +int index(int num, int arr[], int len) { + for (int i = 0; i < len; i++) { + if (arr[i] == num) return i; + } + return -1; +} + +int count(int num, int arr[], int len) { + int count = 0; + for (int i = 0; i < len; i++) { + if (arr[i] == num) count += 1; + } + return count; +} + +int arrmax(int arr[], int len) { + int max = arr[0]; + for (int i = 1; i < len; i++) { + if (arr[i] > max) max = arr[i]; + } + return max; +} + +int arrmin(int arr[], int len) { + int min = arr[0]; + for (int i = 1; i < len; i++) { + if (arr[i] < min) min = arr[i]; + } + return min; +} + +void printarr(int arr[], int len) { + printf("["); + for (int i = 0; i < len; i++) { + printf("%d, ", arr[i]); + } + printf("\b\b]\n"); +} + +void deleteindex(int index, int arr[], int* len) { + arr[index] = 0; + for (int i = index; i < *len - 1; i++) { + arr[i] = arr[i + 1]; + } + *len -= 1; +} + +void insert(int num, int index, int arr[], int* len) { + for (int i = *len; i > index; i--) { + arr[i] = arr[i - 1]; + } + *len += 1; + arr[index] = num; +} + +void deletemax3(int arr[], int* len) { + int max = arr[0]; + int maxi = 0; + for (int i = 1; i < *len; i++) { + if (arr[i] > max && arr[i] % 3 == 0) { + max = arr[i]; + maxi = i; + } + } + deleteindex(maxi, arr, len); +} + +exchange_max_chains(int A[], int B[], int* sA, int* sB) { + int a = A[0], sa = 1, ai = 0; + int b = B[0], sb = 1, bi = 0; + int ts = 1; + for (int i = 0; i < *sA - 1; i++) { + if (A[i] == A[i + 1]) { + ts += 1; + } + else if (ts > sa) { + sa = ts; + ai = i + 1 - sa; + ts = 1; + a = A[i]; + } + } + ts = 1; + for (int i = 0; i < *sB - 1; i++) { + if (B[i] == B[i + 1]) { + ts += 1; + } + else if (ts > sb) { + sb = ts; + bi = i + 1 - sb; + ts = 1; + b = B[i]; + } + } + for (int i = 0; i < sa; i++) { + deleteindex(ai, A, sA); + } + for (int i = 0; i < sb; i++) { + insert(b, ai, A, sA); + } + for (int i = 0; i < sb; i++) { + deleteindex(bi, B, sB); + } + for (int i = 0; i < sa; i++) { + insert(a, bi, B, sB); + } + printf("A: %d %d %d\n", a, sa, ai); + printf("B: %d %d %d\n", b, sb, bi); + printf("A = "); + printarr(A, *sA); + printf("B = "); + printarr(B, *sB); +} + +//#define ARRLEN 10 + +int main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int arr[20] = { 3, 7, 12, 3, 4, 8, -1, 6, 1, 7 }; + int size = 10; + int A[20] = {3, 2, 2, 5, 2, 1, 1, 1, 3, 9}; + int sA = 10; + int B[20] = {1, 2, 5, 5, 4, 8, 3, 3}; + int sB = 8; + int id, val; + + int n = 0; + do { + puts("\n"); + printf(" : "); + printarr(arr, size); + puts(" "); + puts("1) "); + puts("2) "); + puts("3) "); + puts("4) 0"); + puts("5) "); + puts("6) "); + puts("99) "); + puts("10) , "); + puts("11) A B "); + puts(""); + puts("0) exit program"); + + while (scanf_s(" %d", &n) != 1) { + scanf_s("%*[^\n]"); + scanf_s("%*c"); + } + puts(""); + + switch (n) + { + case 1: + printf("delete index = "); + scanf_s("%d", &id); + deleteindex(id, arr, &size); + break; + case 2: + printf("value = "); + scanf_s("%d", &val); + printf("index = "); + scanf_s("%d", &id); + insert(val, id, arr, &size); + break; + case 3: + deleteindex(index(arrmin(arr, size), arr, size), arr, &size); + break; + case 4: + insert(0, index(arrmin(arr, size), arr, size), arr, &size); + break; + case 5: + for (int i = 0; i < size; i++) { + if (arr[i] % 2 == 0) deleteindex(i, arr, &size); + } + break; + case 6: + for (int i = 0; i < size; i++) { + if (arr[i] % 2 == 0) { + insert(arr[i], i, arr, &size); + i += 2; + } + } + break; + case 99: + deletemax3(arr, &size); + break; + case 10: + for (int i = 0; i < size; i++) { + if (count(arr[i], arr, size) == 1) { + deleteindex(index(arr[i], arr, size), arr, &size); + i -= 1; + } + } + break; + case 11: + exchange_max_chains(A, B, &sA, &sB); + break; + case 0: + puts("goodbye :3"); + break; + default: + puts("error: wrong N"); + break; + } + + } while (n != 0); + return 0; +} \ No newline at end of file diff --git a/lab2/lab2.sln b/lab2/lab2.sln new file mode 100644 index 0000000..eaaee49 --- /dev/null +++ b/lab2/lab2.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab2", "lab2\lab2.vcxproj", "{C3B50AE8-C4ED-4032-9919-A738A69F3D48}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x64.ActiveCfg = Debug|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x64.Build.0 = Debug|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x86.ActiveCfg = Debug|Win32 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Debug|x86.Build.0 = Debug|Win32 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x64.ActiveCfg = Release|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x64.Build.0 = Release|x64 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x86.ActiveCfg = Release|Win32 + {C3B50AE8-C4ED-4032-9919-A738A69F3D48}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E8F9B036-CAEF-4037-A891-A507AB3EE22A} + EndGlobalSection +EndGlobal diff --git a/lab2/lab2/lab2.vcxproj b/lab2/lab2/lab2.vcxproj new file mode 100644 index 0000000..73bb48c --- /dev/null +++ b/lab2/lab2/lab2.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {c3b50ae8-c4ed-4032-9919-a738a69f3d48} + lab2 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lab2/lab2/lab2.vcxproj.filters b/lab2/lab2/lab2.vcxproj.filters new file mode 100644 index 0000000..669bc4e --- /dev/null +++ b/lab2/lab2/lab2.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab2/lab2/main.c b/lab2/lab2/main.c new file mode 100644 index 0000000..b185146 --- /dev/null +++ b/lab2/lab2/main.c @@ -0,0 +1,73 @@ +#include +#include +#include + +#define PI 3.14159265358979323846 + +void vector_angle() { + float x1, y1, x2, y2; + printf(" \n"); + printf("x1 = "); + scanf_s("%f", &x1); + printf("y1 = "); + scanf_s("%f", &y1); + printf("x2 = "); + scanf_s("%f", &x2); + printf("y2 = "); + scanf_s("%f", &y2); + printf("%.2f ", 57.3 * acos((x1 * x2 + y1 * y2) / (sqrt(x1 * x1 + y1 * y1) * sqrt(x2 * x2 + y2 * y2)))); +} + +void lc_freq() { + float L, C; + printf("L = "); + scanf_s("%f", &L); + printf("C = "); + scanf_s("%f", &C); + printf("%.2f ", 1 / (2 * PI * sqrt(L * C))); +} + +void deposit() { + int money, days; + float rate, eff, result; + printf(" %% = "); + scanf_s("%f", &rate); + printf(" = "); + scanf_s("%d", &money); + printf(" = "); + scanf_s("%d", &days); + result = money * pow((1 + (rate / 100) / days), days); + eff = (result - money) / money * 100; + printf(" = %.2f%% = %.2f", eff, result - money); +} + +int main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int num; + printf("1. .\n"); + printf("2. LC-.\n"); + printf("3. .\n"); + + printf(" : "); + scanf_s("%d", &num); + + switch (num) + { + case 1: + vector_angle(); + break; + case 2: + lc_freq(); + break; + case 3: + deposit(); + break; + default: + printf(" !"); + break; + } + + return 0; +} \ No newline at end of file diff --git a/lab3/diagram.zip b/lab3/diagram.zip new file mode 100644 index 0000000..47c4859 Binary files /dev/null and b/lab3/diagram.zip differ diff --git a/lab3/lab3-3/lab3-3.c b/lab3/lab3-3/lab3-3.c new file mode 100644 index 0000000..e064b57 --- /dev/null +++ b/lab3/lab3-3/lab3-3.c @@ -0,0 +1,20 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int t; + printf(" = "); + scanf_s("%d", &t); + + if (t < 18) printf(""); + else if (t < 22) printf(""); + else if (t < 26) printf(""); + else printf(""); + + return 0; +} + diff --git a/lab3/lab3-3/lab3-3.vcxproj b/lab3/lab3-3/lab3-3.vcxproj new file mode 100644 index 0000000..a65c1fe --- /dev/null +++ b/lab3/lab3-3/lab3-3.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + 17.0 + Win32Proj + {6b79783f-be5a-40d9-9f98-f94a6b5b3c28} + lab33 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/lab3/lab3-3/lab3-3.vcxproj.filters b/lab3/lab3-3/lab3-3.vcxproj.filters new file mode 100644 index 0000000..4046330 --- /dev/null +++ b/lab3/lab3-3/lab3-3.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab3/lab3-4/lab3-4.c b/lab3/lab3-4/lab3-4.c new file mode 100644 index 0000000..68e6a56 --- /dev/null +++ b/lab3/lab3-4/lab3-4.c @@ -0,0 +1,23 @@ +#include +#include + +int main() { + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int nums[5]; + int max; + + printf(" 5 : "); + scanf_s("%d%d%d%d%d", &nums[0], &nums[1], &nums[2], &nums[3], &nums[4]); + + max = nums[0]; + + for (int i = 1; i < 5; i++) { + if (nums[i] > max) max = nums[i]; + } + + printf("max = %d", max); + + return 0; +} diff --git a/lab3/lab3-4/lab3-4.vcxproj b/lab3/lab3-4/lab3-4.vcxproj new file mode 100644 index 0000000..d8b9b2a --- /dev/null +++ b/lab3/lab3-4/lab3-4.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + 17.0 + Win32Proj + {d6687108-4ab6-4fe0-ac6a-53b3f086b122} + lab34 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/lab3/lab3-4/lab3-4.vcxproj.filters b/lab3/lab3-4/lab3-4.vcxproj.filters new file mode 100644 index 0000000..6b92697 --- /dev/null +++ b/lab3/lab3-4/lab3-4.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab3/lab3-7/lab3-7.c b/lab3/lab3-7/lab3-7.c new file mode 100644 index 0000000..b0d541c --- /dev/null +++ b/lab3/lab3-7/lab3-7.c @@ -0,0 +1,22 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int v; + printf(" / = "); + scanf_s("%d", &v); + + if (v > 3000) puts(""); + else if (v > 1200) puts(" "); + else if (v > 800) puts(""); + else if (v > 500) puts(""); + else if (v > 200) puts(""); + else puts(" "); + + return 0; +} + diff --git a/lab3/lab3-7/lab3-7.json b/lab3/lab3-7/lab3-7.json new file mode 100644 index 0000000..c7aaf8d --- /dev/null +++ b/lab3/lab3-7/lab3-7.json @@ -0,0 +1 @@ +{"blocks":[{"x":550,"y":30,"text":"max = v1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":120,"text":"v2 > max","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":240,"text":"max = v3","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":340,"text":"вывод max","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-60,"text":"ввод v1, v2, v3","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-150,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":440,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":555,"y":-190,"text":"lab3-2","width":70,"height":40,"type":"Текст / комментарий","isMenuBlock":false,"fontSize":22,"textHeight":22,"isBold":true,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":120,"text":"max = v2","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":240,"text":"max = v3","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":-100,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":-140,"text":"lab3-7","width":80,"height":40,"type":"Текст / комментарий","isMenuBlock":false,"fontSize":22,"textHeight":22,"isBold":true,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":-20,"text":"ввод скорости \nсамолёта v","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":60,"text":"v > 3000","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":150,"text":"v > 1200","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":230,"text":"v > 800","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":320,"text":"v > 500","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1250,"y":410,"text":"v > 200","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1420,"y":500,"text":"\"очень медленно\"","width":140,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1420,"y":410,"text":"\"медленно\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1420,"y":320,"text":"\"нормально\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1420,"y":230,"text":"\"быстро\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1420,"y":150,"text":"\"очень быстро\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1420,"y":60,"text":"\"мгновенно\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":1660,"y":280,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1}],"arrows":[{"startIndex":5,"endIndex":4,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":-135},{"x":550,"y":-100},{"x":550,"y":-80}],"counts":[1,1,1]},{"startIndex":4,"endIndex":0,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":-40},{"x":550,"y":-10},{"x":550,"y":10}],"counts":[1,1,1]},{"startIndex":1,"endIndex":8,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":600,"y":120},{"x":630,"y":120},{"x":650,"y":120}],"counts":[1,1,1]},{"startIndex":2,"endIndex":9,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":600,"y":240},{"x":630,"y":240},{"x":650,"y":240}],"counts":[1,1,1]},{"startIndex":0,"endIndex":1,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":50},{"x":550,"y":80},{"x":550,"y":100}],"counts":[1,1,1]},{"startIndex":3,"endIndex":6,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":360},{"x":550,"y":410},{"x":550,"y":425}],"counts":[1,1,1]},{"startIndex":1,"endIndex":2,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":120},{"x":480,"y":120},{"x":480,"y":180},{"x":550,"y":180},{"x":550,"y":220}],"counts":[1,1,1,1,1]},{"startIndex":2,"endIndex":3,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":240},{"x":480,"y":240},{"x":480,"y":280},{"x":550,"y":280},{"x":550,"y":320}],"counts":[1,1,1,1,1]},{"startIndex":9,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":700,"y":260},{"x":700,"y":280},{"x":550,"y":280},{"x":550,"y":320}],"counts":[1,1,1,1]},{"startIndex":8,"endIndex":2,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":700,"y":140},{"x":700,"y":180},{"x":550,"y":180},{"x":550,"y":220}],"counts":[1,1,1,1]},{"startIndex":10,"endIndex":12,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":1250,"y":-85},{"x":1250,"y":-60},{"x":1250,"y":-40}],"counts":[1,1,1]},{"startIndex":12,"endIndex":13,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":1250,"y":0},{"x":1250,"y":20},{"x":1250,"y":40}],"counts":[1,1,1]},{"startIndex":13,"endIndex":23,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1300,"y":60},{"x":1340,"y":60},{"x":1360,"y":60}],"counts":[1,1,1]},{"startIndex":14,"endIndex":22,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1300,"y":150},{"x":1340,"y":150},{"x":1360,"y":150}],"counts":[1,1,1]},{"startIndex":13,"endIndex":14,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":1200,"y":60},{"x":1180,"y":60},{"x":1180,"y":110},{"x":1250,"y":110},{"x":1250,"y":130}],"counts":[1,1,1,1,1]},{"startIndex":15,"endIndex":16,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":1200,"y":230},{"x":1180,"y":230},{"x":1180,"y":280},{"x":1250,"y":280},{"x":1250,"y":300}],"counts":[1,1,1,1,1]},{"startIndex":16,"endIndex":20,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1300,"y":320},{"x":1340,"y":320},{"x":1360,"y":320}],"counts":[1,1,1]},{"startIndex":15,"endIndex":21,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1300,"y":230},{"x":1340,"y":230},{"x":1360,"y":230}],"counts":[1,1,1]},{"startIndex":17,"endIndex":19,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1300,"y":410},{"x":1340,"y":410},{"x":1360,"y":410}],"counts":[1,1,1]},{"startIndex":14,"endIndex":15,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":1200,"y":150},{"x":1180,"y":150},{"x":1180,"y":190},{"x":1250,"y":190},{"x":1250,"y":210}],"counts":[1,1,1,1,1]},{"startIndex":16,"endIndex":17,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":1200,"y":320},{"x":1180,"y":320},{"x":1180,"y":370},{"x":1250,"y":370},{"x":1250,"y":390}],"counts":[1,1,1,1,1]},{"startIndex":17,"endIndex":18,"startConnectorIndex":3,"endConnectorIndex":3,"nodes":[{"x":1200,"y":410},{"x":1170,"y":410},{"x":1170,"y":500},{"x":1330,"y":500},{"x":1350,"y":500}],"counts":[1,1,1,1,1]},{"startIndex":23,"endIndex":24,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1480,"y":60},{"x":1590,"y":60},{"x":1590,"y":280},{"x":1610,"y":280}],"counts":[1,1,1,1]},{"startIndex":22,"endIndex":24,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1480,"y":150},{"x":1590,"y":150},{"x":1590,"y":280},{"x":1610,"y":280}],"counts":[1,1,1,1]},{"startIndex":21,"endIndex":24,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1480,"y":230},{"x":1590,"y":230},{"x":1590,"y":280},{"x":1610,"y":280}],"counts":[1,1,1,1]},{"startIndex":20,"endIndex":24,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1480,"y":320},{"x":1590,"y":320},{"x":1590,"y":280},{"x":1610,"y":280}],"counts":[1,1,1,1]},{"startIndex":19,"endIndex":24,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1480,"y":410},{"x":1590,"y":410},{"x":1590,"y":280},{"x":1610,"y":280}],"counts":[1,1,1,1]},{"startIndex":18,"endIndex":24,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":1490,"y":500},{"x":1590,"y":500},{"x":1590,"y":280},{"x":1610,"y":280}],"counts":[1,1,1,1]}],"x0":-3286.125,"y0":-533.1999999999998} \ No newline at end of file diff --git a/lab3/lab3-7/lab3-7.png b/lab3/lab3-7/lab3-7.png new file mode 100644 index 0000000..4994807 Binary files /dev/null and b/lab3/lab3-7/lab3-7.png differ diff --git a/lab3/lab3-7/lab3-7.vcxproj b/lab3/lab3-7/lab3-7.vcxproj new file mode 100644 index 0000000..747e81b --- /dev/null +++ b/lab3/lab3-7/lab3-7.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + 17.0 + Win32Proj + {48ffe418-4e2d-41c5-b633-dca05192633f} + lab37 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/lab3/lab3-7/lab3-7.vcxproj.filters b/lab3/lab3-7/lab3-7.vcxproj.filters new file mode 100644 index 0000000..4291822 --- /dev/null +++ b/lab3/lab3-7/lab3-7.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab3/lab3.sln b/lab3/lab3.sln new file mode 100644 index 0000000..bc11ebf --- /dev/null +++ b/lab3/lab3.sln @@ -0,0 +1,61 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab3-2", "lab3\lab3.vcxproj", "{56F44A0E-5D48-4515-957B-D1AB4761983D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab3-3", "lab3-3\lab3-3.vcxproj", "{6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab3-4", "lab3-4\lab3-4.vcxproj", "{D6687108-4AB6-4FE0-AC6A-53B3F086B122}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab3-7", "lab3-7\lab3-7.vcxproj", "{48FFE418-4E2D-41C5-B633-DCA05192633F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Debug|x64.ActiveCfg = Debug|x64 + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Debug|x64.Build.0 = Debug|x64 + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Debug|x86.ActiveCfg = Debug|Win32 + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Debug|x86.Build.0 = Debug|Win32 + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Release|x64.ActiveCfg = Release|x64 + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Release|x64.Build.0 = Release|x64 + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Release|x86.ActiveCfg = Release|Win32 + {56F44A0E-5D48-4515-957B-D1AB4761983D}.Release|x86.Build.0 = Release|Win32 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Debug|x64.ActiveCfg = Debug|x64 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Debug|x64.Build.0 = Debug|x64 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Debug|x86.ActiveCfg = Debug|Win32 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Debug|x86.Build.0 = Debug|Win32 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Release|x64.ActiveCfg = Release|x64 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Release|x64.Build.0 = Release|x64 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Release|x86.ActiveCfg = Release|Win32 + {6B79783F-BE5A-40D9-9F98-F94A6B5B3C28}.Release|x86.Build.0 = Release|Win32 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Debug|x64.ActiveCfg = Debug|x64 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Debug|x64.Build.0 = Debug|x64 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Debug|x86.ActiveCfg = Debug|Win32 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Debug|x86.Build.0 = Debug|Win32 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Release|x64.ActiveCfg = Release|x64 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Release|x64.Build.0 = Release|x64 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Release|x86.ActiveCfg = Release|Win32 + {D6687108-4AB6-4FE0-AC6A-53B3F086B122}.Release|x86.Build.0 = Release|Win32 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Debug|x64.ActiveCfg = Debug|x64 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Debug|x64.Build.0 = Debug|x64 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Debug|x86.ActiveCfg = Debug|Win32 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Debug|x86.Build.0 = Debug|Win32 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Release|x64.ActiveCfg = Release|x64 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Release|x64.Build.0 = Release|x64 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Release|x86.ActiveCfg = Release|Win32 + {48FFE418-4E2D-41C5-B633-DCA05192633F}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C95E619B-76BD-488C-B621-C5B0A2A59300} + EndGlobalSection +EndGlobal diff --git a/lab3/lab3/lab3-2.c b/lab3/lab3/lab3-2.c new file mode 100644 index 0000000..8703211 --- /dev/null +++ b/lab3/lab3/lab3-2.c @@ -0,0 +1,26 @@ +#include +#include + +int main() { + int max, v1, v2, v3; + + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + printf(" 3 : "); + scanf_s("%d%d%d", &v1, &v2, &v3); + max = v1; + + if (v2 > max) { + max = v2; + } + + if (v3 > max) { + max = v3; + } + + printf("max = %d", max); + + return 0; +} + diff --git a/lab3/lab3/lab3-2.json b/lab3/lab3/lab3-2.json new file mode 100644 index 0000000..a83f7f4 --- /dev/null +++ b/lab3/lab3/lab3-2.json @@ -0,0 +1 @@ +{"blocks":[{"x":550,"y":30,"text":"max = v1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":120,"text":"v2 > max","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":240,"text":"max = v3","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":340,"text":"вывод max","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-60,"text":"ввод v1, v2, v3","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-150,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":440,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":555,"y":-190,"text":"lab3-2","width":70,"height":40,"type":"Текст / комментарий","isMenuBlock":false,"fontSize":22,"textHeight":22,"isBold":true,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":120,"text":"max = v2","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":700,"y":240,"text":"max = v3","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1}],"arrows":[{"startIndex":5,"endIndex":4,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":-135},{"x":550,"y":-100},{"x":550,"y":-80}],"counts":[1,1,1]},{"startIndex":4,"endIndex":0,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":-40},{"x":550,"y":-10},{"x":550,"y":10}],"counts":[1,1,1]},{"startIndex":1,"endIndex":8,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":600,"y":120},{"x":630,"y":120},{"x":650,"y":120}],"counts":[1,1,1]},{"startIndex":2,"endIndex":9,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":600,"y":240},{"x":630,"y":240},{"x":650,"y":240}],"counts":[1,1,1]},{"startIndex":0,"endIndex":1,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":50},{"x":550,"y":80},{"x":550,"y":100}],"counts":[1,1,1]},{"startIndex":3,"endIndex":6,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":360},{"x":550,"y":410},{"x":550,"y":425}],"counts":[1,1,1]},{"startIndex":1,"endIndex":2,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":120},{"x":480,"y":120},{"x":480,"y":180},{"x":550,"y":180},{"x":550,"y":220}],"counts":[1,1,1,1,1]},{"startIndex":2,"endIndex":3,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":240},{"x":480,"y":240},{"x":480,"y":280},{"x":550,"y":280},{"x":550,"y":320}],"counts":[1,1,1,1,1]},{"startIndex":9,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":700,"y":260},{"x":700,"y":280},{"x":550,"y":280},{"x":550,"y":320}],"counts":[1,1,1,1]},{"startIndex":8,"endIndex":2,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":700,"y":140},{"x":700,"y":180},{"x":550,"y":180},{"x":550,"y":220}],"counts":[1,1,1,1]}],"x0":-150.80208333333348,"y0":298.41666666666674} \ No newline at end of file diff --git a/lab3/lab3/lab3-2.png b/lab3/lab3/lab3-2.png new file mode 100644 index 0000000..aa3fd03 Binary files /dev/null and b/lab3/lab3/lab3-2.png differ diff --git a/lab3/lab3/lab3.vcxproj b/lab3/lab3/lab3.vcxproj new file mode 100644 index 0000000..3a511bf --- /dev/null +++ b/lab3/lab3/lab3.vcxproj @@ -0,0 +1,139 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + 17.0 + Win32Proj + {56f44a0e-5d48-4515-957b-d1ab4761983d} + lab3 + 10.0 + lab3-2 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + \ No newline at end of file diff --git a/lab3/lab3/lab3.vcxproj.filters b/lab3/lab3/lab3.vcxproj.filters new file mode 100644 index 0000000..c959626 --- /dev/null +++ b/lab3/lab3/lab3.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab4/lab4-1/diagram.json b/lab4/lab4-1/diagram.json new file mode 100644 index 0000000..7a19c66 --- /dev/null +++ b/lab4/lab4-1/diagram.json @@ -0,0 +1 @@ +{"blocks":[{"x":550,"y":20,"text":"ввод n","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":100,"text":"i = 1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":200,"text":"вывод i","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":290,"text":"i = i +1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":380,"text":"i ≤ n","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":490,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-50,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1}],"arrows":[{"startIndex":1,"endIndex":2,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":120},{"x":550,"y":160},{"x":550,"y":180}],"counts":[1,1,1]},{"startIndex":2,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":220},{"x":550,"y":250},{"x":550,"y":270}],"counts":[1,1,1]},{"startIndex":3,"endIndex":4,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":310},{"x":550,"y":340},{"x":550,"y":360}],"counts":[1,1,1]},{"startIndex":4,"endIndex":2,"startConnectorIndex":1,"endConnectorIndex":0,"nodes":[{"x":600,"y":380},{"x":650,"y":380},{"x":650,"y":160},{"x":550,"y":160},{"x":550,"y":180}],"counts":[1,1,1,1,1]},{"startIndex":6,"endIndex":0,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":-35},{"x":550,"y":-20},{"x":550,"y":0}],"counts":[1,1,1]},{"startIndex":0,"endIndex":1,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":40},{"x":550,"y":60},{"x":550,"y":80}],"counts":[1,1,1]},{"startIndex":4,"endIndex":5,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":380},{"x":480,"y":380},{"x":480,"y":440},{"x":550,"y":440},{"x":550,"y":475}],"counts":[1,1,1,1,1]}],"x0":-942.924999999999,"y0":-318.39999999999884} \ No newline at end of file diff --git a/lab4/lab4-1/diagram.png b/lab4/lab4-1/diagram.png new file mode 100644 index 0000000..e45ef7b Binary files /dev/null and b/lab4/lab4-1/diagram.png differ diff --git a/lab4/lab4-1/lab4-1.c b/lab4/lab4-1/lab4-1.c new file mode 100644 index 0000000..f486b42 --- /dev/null +++ b/lab4/lab4-1/lab4-1.c @@ -0,0 +1,21 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int n; + printf("n = "); + scanf_s("%d", &n); + + int i = 1; + do { + printf("%d ", i); + i += 1; + } while (i <= n); + + return 0; +} + diff --git a/lab4/lab4-1/lab4-1.vcxproj b/lab4/lab4-1/lab4-1.vcxproj new file mode 100644 index 0000000..12be4db --- /dev/null +++ b/lab4/lab4-1/lab4-1.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {d70249db-8680-4d0a-83c4-d7fa9ae642d3} + lab41 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/lab4/lab4-1/lab4-1.vcxproj.filters b/lab4/lab4-1/lab4-1.vcxproj.filters new file mode 100644 index 0000000..faba2cc --- /dev/null +++ b/lab4/lab4-1/lab4-1.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab4/lab4-2/diagram.json b/lab4/lab4-2/diagram.json new file mode 100644 index 0000000..aba36b3 --- /dev/null +++ b/lab4/lab4-2/diagram.json @@ -0,0 +1 @@ +{"blocks":[{"x":550,"y":20,"text":"ввод n","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":490,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-50,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":110,"text":"i = 1\nstep = 0","width":100,"height":60,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":200,"text":"вывод\n\"2^{step} = {i}\\n\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":290,"text":"i = i * 2\nstep += 1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":380,"text":"step ≤ n","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1}],"arrows":[{"startIndex":3,"endIndex":4,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":140},{"x":550,"y":160},{"x":550,"y":180}],"counts":[1,1,1]},{"startIndex":4,"endIndex":5,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":220},{"x":550,"y":250},{"x":550,"y":270}],"counts":[1,1,1]},{"startIndex":5,"endIndex":6,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":310},{"x":550,"y":340},{"x":550,"y":360}],"counts":[1,1,1]},{"startIndex":6,"endIndex":4,"startConnectorIndex":1,"endConnectorIndex":0,"nodes":[{"x":600,"y":380},{"x":650,"y":380},{"x":650,"y":160},{"x":550,"y":160},{"x":550,"y":180}],"counts":[1,1,1,1,1]},{"startIndex":2,"endIndex":0,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":-35},{"x":550,"y":-20},{"x":550,"y":0}],"counts":[1,1,1]},{"startIndex":0,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":40},{"x":550,"y":60},{"x":550,"y":80}],"counts":[1,1,1]},{"startIndex":6,"endIndex":1,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":380},{"x":480,"y":380},{"x":480,"y":440},{"x":550,"y":440},{"x":550,"y":460},{"x":550,"y":475}],"counts":[1,1,1,1,1,1]}],"x0":-313.5,"y0":147.5} \ No newline at end of file diff --git a/lab4/lab4-2/diagram.png b/lab4/lab4-2/diagram.png new file mode 100644 index 0000000..9bf8746 Binary files /dev/null and b/lab4/lab4-2/diagram.png differ diff --git a/lab4/lab4-2/lab4-2.c b/lab4/lab4-2/lab4-2.c new file mode 100644 index 0000000..8efd999 --- /dev/null +++ b/lab4/lab4-2/lab4-2.c @@ -0,0 +1,22 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int n; + printf("n = "); + scanf_s("%d", &n); + + int i = 1; + int step = 0; + do { + printf("2^%d = %d\n", step, i); + i = i * 2; + step += 1; + } while (step <= n); + + return 0; +} diff --git a/lab4/lab4-2/lab4-2.vcxproj b/lab4/lab4-2/lab4-2.vcxproj new file mode 100644 index 0000000..ad4bcef --- /dev/null +++ b/lab4/lab4-2/lab4-2.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {62419a3d-92ea-49c4-ac3c-beec2b81f7ed} + lab42 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/lab4/lab4-2/lab4-2.vcxproj.filters b/lab4/lab4-2/lab4-2.vcxproj.filters new file mode 100644 index 0000000..a0bf8b8 --- /dev/null +++ b/lab4/lab4-2/lab4-2.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab4/lab4-3/lab4-3.c b/lab4/lab4-3/lab4-3.c new file mode 100644 index 0000000..b31801b --- /dev/null +++ b/lab4/lab4-3/lab4-3.c @@ -0,0 +1,24 @@ +#include +#include + +int main() +{ + SetConsoleCP(1251); + SetConsoleOutputCP(1251); + + int sum, year; + float percent; + printf("sum = "); + scanf_s("%d", &sum); + printf("percent = "); + scanf_s("%f", &percent); + + year = 0; + do { + printf("%d RUB in %d year\n", sum, year); + sum = (sum * (100 + percent)) / 100; + year += 1; + } while (year <= 10); + + return 0; +} diff --git a/lab4/lab4-3/lab4-3.vcxproj b/lab4/lab4-3/lab4-3.vcxproj new file mode 100644 index 0000000..3e09ca6 --- /dev/null +++ b/lab4/lab4-3/lab4-3.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {128509a7-4949-4dfa-990a-9e2d828dd1d1} + lab43 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lab4/lab4-3/lab4-3.vcxproj.filters b/lab4/lab4-3/lab4-3.vcxproj.filters new file mode 100644 index 0000000..f6b691e --- /dev/null +++ b/lab4/lab4-3/lab4-3.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab4/lab4-6/diagram.json b/lab4/lab4-6/diagram.json new file mode 100644 index 0000000..2ba99d2 --- /dev/null +++ b/lab4/lab4-6/diagram.json @@ -0,0 +1 @@ +{"blocks":[{"x":550,"y":700,"text":"конец","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-20,"text":"ввод n","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":-100,"text":"начало","width":100,"height":30,"type":"Начало / конец","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":80,"text":"a = 0.0\nb = 1.0\nn = n - 2","width":100,"height":60,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":170,"text":"n ≤ 0","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":720,"y":170,"text":"вывод\n\"wrong number\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":260,"text":"вывод \"0\\n1\\n\"","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":370,"text":"с = a + b\na = b\nb = c","width":100,"height":60,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":460,"text":"вывод c","width":120,"height":40,"type":"Ввод / вывод","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":540,"text":"n = n -1","width":100,"height":40,"type":"Блок","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1},{"x":550,"y":620,"text":"n > 0","width":100,"height":40,"type":"Условие","isMenuBlock":false,"fontSize":14,"textHeight":14,"isBold":false,"isItalic":false,"textAlign":"center","labelsPosition":1}],"arrows":[{"startIndex":2,"endIndex":1,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":-85},{"x":550,"y":-60},{"x":550,"y":-40}],"counts":[1,1,1]},{"startIndex":1,"endIndex":3,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":0},{"x":550,"y":30},{"x":550,"y":50}],"counts":[1,1,1]},{"startIndex":4,"endIndex":5,"startConnectorIndex":1,"endConnectorIndex":3,"nodes":[{"x":600,"y":170},{"x":640,"y":170},{"x":660,"y":170}],"counts":[1,1,1]},{"startIndex":4,"endIndex":6,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":170},{"x":480,"y":170},{"x":480,"y":220},{"x":550,"y":220},{"x":550,"y":240}],"counts":[1,1,1,1,1]},{"startIndex":6,"endIndex":7,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":280},{"x":550,"y":320},{"x":550,"y":340}],"counts":[1,1,1]},{"startIndex":7,"endIndex":8,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":400},{"x":550,"y":420},{"x":550,"y":440}],"counts":[1,1,1]},{"startIndex":8,"endIndex":9,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":480},{"x":550,"y":500},{"x":550,"y":520}],"counts":[1,1,1]},{"startIndex":9,"endIndex":10,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":560},{"x":550,"y":580},{"x":550,"y":600}],"counts":[1,1,1]},{"startIndex":10,"endIndex":7,"startConnectorIndex":1,"endConnectorIndex":0,"nodes":[{"x":600,"y":620},{"x":670,"y":620},{"x":670,"y":320},{"x":550,"y":320},{"x":550,"y":340}],"counts":[1,1,1,1,1]},{"startIndex":10,"endIndex":0,"startConnectorIndex":3,"endConnectorIndex":0,"nodes":[{"x":500,"y":620},{"x":480,"y":620},{"x":480,"y":660},{"x":550,"y":660},{"x":550,"y":685}],"counts":[1,1,1,1,1]},{"startIndex":5,"endIndex":0,"startConnectorIndex":2,"endConnectorIndex":1,"nodes":[{"x":720,"y":190},{"x":720,"y":700},{"x":620,"y":700},{"x":600,"y":700}],"counts":[1,1,1,1]},{"startIndex":3,"endIndex":4,"startConnectorIndex":2,"endConnectorIndex":0,"nodes":[{"x":550,"y":110},{"x":550,"y":130},{"x":550,"y":150}],"counts":[1,1,1]}],"x0":-388.5,"y0":163} \ No newline at end of file diff --git a/lab4/lab4-6/diagram.png b/lab4/lab4-6/diagram.png new file mode 100644 index 0000000..57d1da8 Binary files /dev/null and b/lab4/lab4-6/diagram.png differ diff --git a/lab4/lab4-6/lab4-6.c b/lab4/lab4-6/lab4-6.c new file mode 100644 index 0000000..f9fde1f --- /dev/null +++ b/lab4/lab4-6/lab4-6.c @@ -0,0 +1,42 @@ +#include +#include + +int main() { + int n; + printf("num of fibonacchi numbers = "); + scanf_s("%d", &n); + + double a = 0.0; + double b = 1.0; + double c; + n = n - 2; + + if (n <= 0) { + puts("wrong number"); + return 0; + } + + printf("0\n1\n"); + + do { + c = a + b; + a = b; + /*if (b > c) { + printf("overflow, remaining n = %d", n); + break; + }*/ + b = c; + printf("%.0f\n", c); + n = n - 1; + } while (n > 0); + + /*puts("\n------------"); + + if (pow(2, 64) > 12200160415121876738.0) { + printf("%f is bigger than %f", pow(2, 64), 12200160415121876738.0); + } else { + puts("12200160415121876738 is bigger"); + }*/ + //printf("%u", sizeof(12200160415121876738)); + return 0; +} diff --git a/lab4/lab4-6/lab4-6.vcxproj b/lab4/lab4-6/lab4-6.vcxproj new file mode 100644 index 0000000..0085f30 --- /dev/null +++ b/lab4/lab4-6/lab4-6.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {24b5ae7c-9d69-4852-a0a4-97785eb8e097} + lab46 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/lab4/lab4-6/lab4-6.vcxproj.filters b/lab4/lab4-6/lab4-6.vcxproj.filters new file mode 100644 index 0000000..616a83a --- /dev/null +++ b/lab4/lab4-6/lab4-6.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab4/lab4.sln b/lab4/lab4.sln new file mode 100644 index 0000000..7a433c2 --- /dev/null +++ b/lab4/lab4.sln @@ -0,0 +1,61 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab4-1", "lab4-1\lab4-1.vcxproj", "{D70249DB-8680-4D0A-83C4-D7FA9AE642D3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab4-2", "lab4-2\lab4-2.vcxproj", "{62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab4-3", "lab4-3\lab4-3.vcxproj", "{128509A7-4949-4DFA-990A-9E2D828DD1D1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab4-6", "lab4-6\lab4-6.vcxproj", "{24B5AE7C-9D69-4852-A0A4-97785EB8E097}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Debug|x64.ActiveCfg = Debug|x64 + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Debug|x64.Build.0 = Debug|x64 + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Debug|x86.ActiveCfg = Debug|Win32 + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Debug|x86.Build.0 = Debug|Win32 + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Release|x64.ActiveCfg = Release|x64 + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Release|x64.Build.0 = Release|x64 + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Release|x86.ActiveCfg = Release|Win32 + {D70249DB-8680-4D0A-83C4-D7FA9AE642D3}.Release|x86.Build.0 = Release|Win32 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Debug|x64.ActiveCfg = Debug|x64 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Debug|x64.Build.0 = Debug|x64 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Debug|x86.ActiveCfg = Debug|Win32 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Debug|x86.Build.0 = Debug|Win32 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Release|x64.ActiveCfg = Release|x64 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Release|x64.Build.0 = Release|x64 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Release|x86.ActiveCfg = Release|Win32 + {62419A3D-92EA-49C4-AC3C-BEEC2B81F7ED}.Release|x86.Build.0 = Release|Win32 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Debug|x64.ActiveCfg = Debug|x64 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Debug|x64.Build.0 = Debug|x64 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Debug|x86.ActiveCfg = Debug|Win32 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Debug|x86.Build.0 = Debug|Win32 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Release|x64.ActiveCfg = Release|x64 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Release|x64.Build.0 = Release|x64 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Release|x86.ActiveCfg = Release|Win32 + {128509A7-4949-4DFA-990A-9E2D828DD1D1}.Release|x86.Build.0 = Release|Win32 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Debug|x64.ActiveCfg = Debug|x64 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Debug|x64.Build.0 = Debug|x64 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Debug|x86.ActiveCfg = Debug|Win32 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Debug|x86.Build.0 = Debug|Win32 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Release|x64.ActiveCfg = Release|x64 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Release|x64.Build.0 = Release|x64 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Release|x86.ActiveCfg = Release|Win32 + {24B5AE7C-9D69-4852-A0A4-97785EB8E097}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {38372524-E44F-4A45-A8AC-2F2CE6B490E5} + EndGlobalSection +EndGlobal diff --git a/lab5-6-7-8-11/1.png b/lab5-6-7-8-11/1.png new file mode 100644 index 0000000..3153e71 Binary files /dev/null and b/lab5-6-7-8-11/1.png differ diff --git a/lab5-6-7-8-11/chevrolet.jpg b/lab5-6-7-8-11/chevrolet.jpg new file mode 100644 index 0000000..2dc1e61 Binary files /dev/null and b/lab5-6-7-8-11/chevrolet.jpg differ diff --git a/lab5-6-7-8-11/diagLogo.png b/lab5-6-7-8-11/diagLogo.png new file mode 100644 index 0000000..ef976f8 Binary files /dev/null and b/lab5-6-7-8-11/diagLogo.png differ diff --git a/lab5-6-7-8-11/lab5-6-7-8.sln b/lab5-6-7-8-11/lab5-6-7-8.sln new file mode 100644 index 0000000..f2f8400 --- /dev/null +++ b/lab5-6-7-8-11/lab5-6-7-8.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35312.102 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab5-6", "lab5-6\lab5-6.vcxproj", "{338A83EB-228F-46AE-BB48-647AA29D24F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Debug|x64.ActiveCfg = Debug|x64 + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Debug|x64.Build.0 = Debug|x64 + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Debug|x86.ActiveCfg = Debug|Win32 + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Debug|x86.Build.0 = Debug|Win32 + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Release|x64.ActiveCfg = Release|x64 + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Release|x64.Build.0 = Release|x64 + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Release|x86.ActiveCfg = Release|Win32 + {338A83EB-228F-46AE-BB48-647AA29D24F9}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {880FA844-6AB5-4C5E-9A0F-6D683EECA3EA} + EndGlobalSection +EndGlobal diff --git a/lab5-6-7-8-11/lab5-6/framework.h b/lab5-6-7-8-11/lab5-6/framework.h new file mode 100644 index 0000000..a8f6dc8 --- /dev/null +++ b/lab5-6-7-8-11/lab5-6/framework.h @@ -0,0 +1,15 @@ +// header.h: включаемый файл для стандартных системных включаемых файлов +// или включаемые файлы для конкретного проекта +// + +#pragma once + +#include "targetver.h" +#define WIN32_LEAN_AND_MEAN // Исключите редко используемые компоненты из заголовков Windows +// Файлы заголовков Windows +#include +// Файлы заголовков среды выполнения C +#include +#include +#include +#include diff --git a/lab5-6-7-8-11/lab5-6/lab5-6-7-8.cpp b/lab5-6-7-8-11/lab5-6/lab5-6-7-8.cpp new file mode 100644 index 0000000..6a13a0d --- /dev/null +++ b/lab5-6-7-8-11/lab5-6/lab5-6-7-8.cpp @@ -0,0 +1,642 @@ +// lab5-6.cpp : Определяет точку входа для приложения. +// + +#include "framework.h" +#include "lab5-6.h" +#include "stdio.h" + + +#define MAX_LOADSTRING 100 + +// Глобальные переменные: +HINSTANCE hInst; // текущий экземпляр +WCHAR szTitle[MAX_LOADSTRING]; // Текст строки заголовка +WCHAR szWindowClass[MAX_LOADSTRING]; // имя класса главного окна + +// Отправить объявления функций, включенных в этот модуль кода: +ATOM MyRegisterClass(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +int APIENTRY wWinMain(_In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPWSTR lpCmdLine, + _In_ int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // TODO: Разместите код здесь. + + // Инициализация глобальных строк + LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadStringW(hInstance, IDC_LAB56, szWindowClass, MAX_LOADSTRING); + MyRegisterClass(hInstance); + + // Выполнить инициализацию приложения: + if (!InitInstance (hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_LAB56)); + + MSG msg; + + // Цикл основного сообщения: + while (GetMessage(&msg, nullptr, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + + + +// +// ФУНКЦИЯ: MyRegisterClass() +// +// ЦЕЛЬ: Регистрирует класс окна. +// +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEXW wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_LAB56)); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_LAB56); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + return RegisterClassExW(&wcex); +} + +// +// ФУНКЦИЯ: InitInstance(HINSTANCE, int) +// +// ЦЕЛЬ: Сохраняет маркер экземпляра и создает главное окно +// +// КОММЕНТАРИИ: +// +// В этой функции маркер экземпляра сохраняется в глобальной переменной, а также +// создается и выводится главное окно программы. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + hInst = hInstance; // Сохранить маркер экземпляра в глобальной переменной + + HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +//Рисует квадратную сетку с шагом в 50 пикселей от нуля до указанных координат +void drawNet(HDC hdc, int width, int height) { + for (int i = 0; i <= width; i = i + 50) { + MoveToEx(hdc, i, 0, NULL); + LineTo(hdc, i, height); + } + + for (int i = 0; i <= height; i = i + 50) { + MoveToEx(hdc, 0, i, NULL); + LineTo(hdc, width, i); + } +} + +void drawTractor(HDC hdc, int cx, int cy) { + HBRUSH hBrush; + HPEN hPen; + hBrush = CreateSolidBrush(RGB(0, 0, 150)); + SelectObject(hdc, hBrush); + hPen = CreatePen(PS_SOLID, 5, RGB(0, 0, 100)); + SelectObject(hdc, hPen); + Rectangle(hdc, cx-150, cy-50, cx+150, cy+50); + MoveToEx(hdc, cx + 150, cy - 50, NULL); + LineTo(hdc, cx + 150, cy - 150); + LineTo(hdc, cx + 50, cy - 150); + hPen = CreatePen(PS_SOLID, 5, RGB(153, 217, 234)); + SelectObject(hdc, hPen); + LineTo(hdc, cx, cy - 50); + hPen = CreatePen(PS_SOLID, 5, RGB(0, 0, 0)); + SelectObject(hdc, hPen); + hBrush = CreateHatchBrush(HS_DIAGCROSS, RGB(20, 20, 20)); + SelectObject(hdc, hBrush); + Ellipse(hdc, cx-175, cy+25, cx-75, cy+125); + Ellipse(hdc, cx + 25, cy - 25, cx + 175, cy + 125); + DeleteObject(hPen); + DeleteObject(hBrush); +} + +void drawHouse(HDC hdc){ + HPEN hPen; + hPen = CreatePen(PS_SOLID, 5, RGB(255, 0, 0)); + SelectObject(hdc, hPen); + + //крыша и стены + MoveToEx(hdc, 150, 250, NULL); + LineTo(hdc, 300, 50); + LineTo(hdc, 450, 250); + LineTo(hdc, 150, 250); + LineTo(hdc, 150, 500); + LineTo(hdc, 450, 500); + LineTo(hdc, 450, 250); + //окно + MoveToEx(hdc, 200, 300, NULL); + LineTo(hdc, 200, 400); + LineTo(hdc, 300, 400); + LineTo(hdc, 300, 300); + LineTo(hdc, 200, 300); + MoveToEx(hdc, 250, 300, NULL); + LineTo(hdc, 250, 400); + DeleteObject(hPen); +} + +void drawSpruce(HDC hdc) { + HPEN hPen; + hPen = CreatePen(PS_SOLID, 5, RGB(30, 200, 80)); + SelectObject(hdc, hPen); + //ёлка + MoveToEx(hdc, 0, 600, NULL); + LineTo(hdc, 150, 600); + LineTo(hdc, 75, 500); + LineTo(hdc, 0, 600); + MoveToEx(hdc, 25, 500, NULL); + LineTo(hdc, 125, 500); + LineTo(hdc, 75, 400); + LineTo(hdc, 25, 500); + MoveToEx(hdc, 50, 400, NULL); + LineTo(hdc, 100, 400); + LineTo(hdc, 75, 300); + LineTo(hdc, 50, 400); + DeleteObject(hPen); +} + +void drawCar(HDC hdc) { + HPEN hPen; + HBRUSH hBrush; + //корпус авто + hBrush = CreateSolidBrush(RGB(100, 100, 100)); + SelectObject(hdc, hBrush); + hPen = CreatePen(PS_SOLID, 5, RGB(50, 50, 50)); + SelectObject(hdc, hPen); + Rectangle(hdc, 550, 350, 850, 450); + //крыша авто + hPen = CreatePen(PS_SOLID, 5, RGB(0, 162, 232)); + SelectObject(hdc, hPen); + MoveToEx(hdc, 550, 350, NULL); + LineTo(hdc, 650, 250); + LineTo(hdc, 800, 250); + LineTo(hdc, 850, 350); + //колёса + hPen = CreatePen(PS_SOLID, 5, RGB(0, 0, 0)); + SelectObject(hdc, hPen); + hBrush = CreateHatchBrush(HS_DIAGCROSS, RGB(20, 20, 20)); + SelectObject(hdc, hBrush); + Ellipse(hdc, 560, 410, 640, 490); + Ellipse(hdc, 560 + 200, 410, 640 + 200, 490); + DeleteObject(hPen); + DeleteObject(hBrush); +} + +void drawTree(HDC hdc) { + HPEN hPen; + HBRUSH hBrush; + //ствол дерева + hPen = CreatePen(PS_SOLID, 25, RGB(114, 78, 54)); + SelectObject(hdc, hPen); + MoveToEx(hdc, 950, 500, NULL); + LineTo(hdc, 950, 200); + //листва дерева + hPen = CreatePen(PS_SOLID, 5, RGB(30, 150, 80)); + SelectObject(hdc, hPen); + hBrush = CreateHatchBrush(HS_DIAGCROSS, RGB(30, 210, 80)); + SelectObject(hdc, hBrush); + Ellipse(hdc, 850, 50, 1050, 350); + DeleteObject(hPen); + DeleteObject(hBrush); +} + +//Рисует логотип Шевроле +void drawLogo(HDC hdc, int cx, int cy) { + POINT pt[12]; + pt[0].x = cx + 50; pt[0].y = cy + 50; + pt[1].x = cx - 50; pt[1].y = cy + 50; + pt[2].x = cx - 50; pt[2].y = cy + 25; + pt[3].x = cx - 150; pt[3].y = cy + 25; + pt[4].x = cx - 125; pt[4].y = cy - 25; + pt[5].x = cx - 50; pt[5].y = cy - 25; + pt[6].x = cx - 50; pt[6].y = cy - 50; + pt[7].x = cx + 50; pt[7].y = cy - 50; + pt[8].x = cx + 50; pt[8].y = cy - 25; + pt[9].x = cx + 150; pt[9].y = cy - 25; + pt[10].x = cx + 125; pt[10].y = cy + 25; + pt[11].x = cx + 50; pt[11].y = cy + 25; + + HPEN hPen; + HBRUSH hBrush; + hPen = CreatePen(PS_SOLID, 10, RGB(180, 180, 180)); + hBrush = CreateHatchBrush(HS_CROSS, RGB(255, 215, 104)); + SelectObject(hdc, hPen); + SelectObject(hdc, hBrush); + + Polygon(hdc, pt, 12); + + DeleteObject(hPen); + DeleteObject(hBrush); +} + +void lab5(HDC hdc) { + drawHouse(hdc); + drawSpruce(hdc); + drawCar(hdc); + drawTree(hdc); + drawTractor(hdc, 1200, 450); +} + +void lab6(HDC hdc) { + HPEN hPen = CreatePen(PS_SOLID, 1, RGB(255, 0, 0)); + SelectObject(hdc, hPen); + int x1 = 100; + do { + MoveToEx(hdc, 400, 300, NULL); + LineTo(hdc, x1, 100); + x1 += 25; + } while (x1 <= 700); + + int x2 = 600, y2 = 400; + do { + MoveToEx(hdc, 800, 400, NULL); + LineTo(hdc, x2, y2); + x2 += 10; + y2 -= 16; + } while (x2 < 800); + do { + MoveToEx(hdc, 800, 400, NULL); + LineTo(hdc, x2, y2); + x2 += 10; + y2 += 16; + } while (x2 <= 1000); + + int x3 = 1100; + do { + MoveToEx(hdc, x3, 50, NULL); + LineTo(hdc, x3, 300); + x3 += 5; + } while (x3 <= 1400); + + int x4 = 100, y4 = 350; + int x5 = 400, y5 = 350; + int i = 0; + do { + MoveToEx(hdc, x4, y4, NULL); + LineTo(hdc, x5, y5); + y4 += 10; + x5 -= 10; + i++; + } while (i <= 30); + + int x6 = 600, y6 = 600; + int dy = 10; + i = 0; + + do { + MoveToEx(hdc, x6, y6 - dy, NULL); + LineTo(hdc, x6, y6 + dy); + x6 += 10; + dy += 10; + i++; + } while (i < 15); +} + +void lab8(HDC hdc) { + /*drawLogo(hdc, 155, 55); + drawLogo(hdc, 155+300, 55); + drawLogo(hdc, 155, 55+300); + drawLogo(hdc, 155+300, 55+300); + drawLogo(hdc, 155 + 150, 55 + 150);*/ + + int x1 = 0, y1 = 0; + int i = 0; + do { + drawLogo(hdc, 155 + x1, 55 + y1); + x1 += 125; + y1 += 125; + i++; + } while (i < 5); +} + +int imageNum = 1; +bool netToggle = true; + +//Рисует картинки по нажатию цифры на клавиатуре +void drawImageSequence1(HDC hdc) { + switch (imageNum) + { + case 0: + lab5(hdc); + break; + case 1: + drawSpruce(hdc); + break; + case 2: + drawHouse(hdc); + break; + case 3: + drawLogo(hdc, 500, 300); + break; + case 4: + drawCar(hdc); + break; + case 5: + drawTree(hdc); + break; + case 6: + drawTractor(hdc, 1200, 450); + break; + } +} + +void draw5logos(HDC hdc, RECT rect) { + drawLogo(hdc, rect.right - 200, rect.bottom - 100); + drawLogo(hdc, rect.right - 200, rect.top + 100); + drawLogo(hdc, rect.left + 200, rect.bottom - 100); + drawLogo(hdc, rect.right / 2, rect.bottom / 2); +} + +void drawImage1(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 4, color); + SelectObject(hdc, hPen); + + POINT p[4] = { + cx, cy - 20, + cx + 20, cy + 20, + cx - 20, cy + 20, + cx, cy - 20 + }; + Polyline(hdc, p, 4); + + DeleteObject(hPen); +} + +void drawImage2(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 4, color); + SelectObject(hdc, hPen); + + POINT p[5] = { + cx, cy - 20, + cx + 20, cy, + cx, cy + 20, + cx - 20, cy, + cx, cy - 20 + }; + Polyline(hdc, p, 5); + + DeleteObject(hPen); +} + +void drawImage3(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 4, color); + SelectObject(hdc, hPen); + + POINT p[5] = { + cx, cy, + cx + 20, cy - 20, + cx, cy + 20, + cx - 20, cy - 20, + cx, cy + }; + Polyline(hdc, p, 5); + + DeleteObject(hPen); +} + +void drawImage4(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 4, color); + SelectObject(hdc, hPen); + + POINT p[6] = { + cx - 20, cy + 20, + cx - 20, cy - 20, + cx + 20, cy - 20, + cx, cy - 10, + cx + 20, cy, + cx - 20, cy + }; + Polyline(hdc, p, 6); + + DeleteObject(hPen); +} + +void drawImage5(HDC hdc, int cx, int cy, COLORREF color) { + HPEN hPen = CreatePen(PS_SOLID, 4, color); + SelectObject(hdc, hPen); + + POINT p[6] = { + cx, cy , + cx + 20, cy - 20, + cx + 20, cy + 20, + cx - 20, cy + 20, + cx - 20, cy - 20, + cx, cy + }; + Polyline(hdc, p, 6); + + DeleteObject(hPen); +} + +void drawImageNet(HDC hdc, int cx, int cy, int width, int height, int step, void (*image)(HDC hdc, int cx, int cy, COLORREF color)) { + int r, g, b, fb; + r = 255; + g = 40; + b = 0; + int dr, dg, db; + dr = r / width; + dg = (255 - g) / width; + db = (255 - b) / height; + for (int i = cx; i <= width * step; i += step) { + fb = b; + for (int j = cy; j <= height * step; j += step) { + image(hdc, i, j, RGB(r, g, fb)); + fb += db; + } + //r -= dr; + g += dg; + } +} + +enum Modes { + image1, + image2, + image3, + image4, + image5 +} mode; + +void drawImageSequence2(HDC hdc, int cx, int cy, int width, int height, int step) { + switch (mode) + { + case image1: + drawImageNet(hdc, cx, cy, width, height, step, drawImage1); + break; + case image2: + drawImageNet(hdc, cx, cy, width, height, step, drawImage2); + break; + case image3: + drawImageNet(hdc, cx, cy, width, height, step, drawImage3); + break; + case image4: + drawImageNet(hdc, cx, cy, width, height, step, drawImage4); + break; + case image5: + drawImageNet(hdc, cx, cy, width, height, step, drawImage5); + break; + } +} + +// +// ФУНКЦИЯ: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// ЦЕЛЬ: Обрабатывает сообщения в главном окне. +// +// WM_COMMAND - обработать меню приложения +// WM_PAINT - Отрисовка главного окна +// WM_DESTROY - отправить сообщение о выходе и вернуться +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_COMMAND: + { + int wmId = LOWORD(wParam); + // Разобрать выбор в меню: + switch (wmId) + { + case IDM_ABOUT: + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + break; + case IDM_EXIT: + DestroyWindow(hWnd); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + } + break; + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hWnd, &ps); + // TODO: Добавьте сюда любой код прорисовки, использующий HDC... + + RECT rect; + GetClientRect(hWnd, &rect); + + if (netToggle) drawNet(hdc, rect.right, rect.bottom); //drawNet(hdc, 1400, 650); + + //drawImageSequence1(hdc); + + //lab5(hdc); + + //lab6(hdc); + + //lab8(hdc); + + //draw5logos(hdc, rect); + + //drawImageNet(hdc, 50, 50, 8, 8, 100, drawImage4); + + //drawImageSequence2(hdc, 50, 50, 12, 8, 100); + + EndPaint(hWnd, &ps); + } + break; + case WM_KEYDOWN: + { + switch (wParam) + { + case VK_SPACE: + netToggle = !netToggle; + break; + case 0x30: + imageNum = 0; + break; + case 0x31: + imageNum = 1; + mode = image1; + break; + case 0x32: + imageNum = 2; + mode = image2; + break; + case 0x33: + imageNum = 3; + mode = image3; + break; + case 0x34: + imageNum = 4; + mode = image4; + break; + case 0x35: + imageNum = 5; + mode = image5; + break; + case 0x36: + imageNum = 6; + break; + } + InvalidateRect(hWnd, NULL, TRUE); + } + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Обработчик сообщений для окна "О программе". +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + switch (message) + { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + return (INT_PTR)FALSE; +} diff --git a/lab5-6-7-8-11/lab5-6/lab5-6.h b/lab5-6-7-8-11/lab5-6/lab5-6.h new file mode 100644 index 0000000..b798bf5 --- /dev/null +++ b/lab5-6-7-8-11/lab5-6/lab5-6.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/lab5-6-7-8-11/lab5-6/lab5-6.ico b/lab5-6-7-8-11/lab5-6/lab5-6.ico new file mode 100644 index 0000000..b3ec03b Binary files /dev/null and b/lab5-6-7-8-11/lab5-6/lab5-6.ico differ diff --git a/lab5-6-7-8-11/lab5-6/lab5-6.rc b/lab5-6-7-8-11/lab5-6/lab5-6.rc new file mode 100644 index 0000000..995a963 Binary files /dev/null and b/lab5-6-7-8-11/lab5-6/lab5-6.rc differ diff --git a/lab5-6-7-8-11/lab5-6/lab5-6.vcxproj b/lab5-6-7-8-11/lab5-6/lab5-6.vcxproj new file mode 100644 index 0000000..33bd7de --- /dev/null +++ b/lab5-6-7-8-11/lab5-6/lab5-6.vcxproj @@ -0,0 +1,149 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {338a83eb-228f-46ae-bb48-647aa29d24f9} + lab56 + 10.0 + lab5-6-7-8 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level3 + true + _DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lab5-6-7-8-11/lab5-6/lab5-6.vcxproj.filters b/lab5-6-7-8-11/lab5-6/lab5-6.vcxproj.filters new file mode 100644 index 0000000..a926504 --- /dev/null +++ b/lab5-6-7-8-11/lab5-6/lab5-6.vcxproj.filters @@ -0,0 +1,49 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Файлы заголовков + + + Файлы заголовков + + + Файлы заголовков + + + Файлы заголовков + + + + + Исходные файлы + + + + + Файлы ресурсов + + + + + Файлы ресурсов + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab5-6-7-8-11/lab5-6/resource.h b/lab5-6-7-8-11/lab5-6/resource.h new file mode 100644 index 0000000..b71b54a --- /dev/null +++ b/lab5-6-7-8-11/lab5-6/resource.h @@ -0,0 +1,28 @@ +//{{NO_DEPENDENCIES}} +// Включаемый файл, созданный в Microsoft Visual C++. +// Используется lab5-6.rc +// +#define IDC_MYICON 2 +#define IDD_LAB56_DIALOG 102 +#define IDS_APP_TITLE 103 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_LAB56 107 +#define IDI_SMALL 108 +#define IDC_LAB56 109 +#define IDR_MAINFRAME 128 +#define ID_32771 32771 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32772 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/lab5-6-7-8-11/lab5-6/small.ico b/lab5-6-7-8-11/lab5-6/small.ico new file mode 100644 index 0000000..b3ec03b Binary files /dev/null and b/lab5-6-7-8-11/lab5-6/small.ico differ diff --git a/lab5-6-7-8-11/lab5-6/targetver.h b/lab5-6-7-8-11/lab5-6/targetver.h new file mode 100644 index 0000000..d90003d --- /dev/null +++ b/lab5-6-7-8-11/lab5-6/targetver.h @@ -0,0 +1,6 @@ +#pragma once + +// // При включении SDKDDKVer.h будет задана самая новая из доступных платформ Windows. +// Если вы планируете сборку приложения для предыдущей версии платформы Windows, включите WinSDKVer.h и +// задайте желаемую платформу в макросе _WIN32_WINNT, прежде чем включать SDKDDKVer.h. +#include diff --git a/lab5-6-7-8-11/камаз.png b/lab5-6-7-8-11/камаз.png new file mode 100644 index 0000000..7a9bec7 Binary files /dev/null and b/lab5-6-7-8-11/камаз.png differ diff --git a/lab5-6-7-8-11/лого.png b/lab5-6-7-8-11/лого.png new file mode 100644 index 0000000..fb883db Binary files /dev/null and b/lab5-6-7-8-11/лого.png differ diff --git a/lab5-6-7-8-11/трактор.png b/lab5-6-7-8-11/трактор.png new file mode 100644 index 0000000..53a22e3 Binary files /dev/null and b/lab5-6-7-8-11/трактор.png differ diff --git a/lab5-6-7-8-11/шаблон сетки.png b/lab5-6-7-8-11/шаблон сетки.png new file mode 100644 index 0000000..cc25dcc Binary files /dev/null and b/lab5-6-7-8-11/шаблон сетки.png differ diff --git a/lab9/lab9.sln b/lab9/lab9.sln new file mode 100644 index 0000000..6aa7e46 --- /dev/null +++ b/lab9/lab9.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab9", "lab9.vcxproj", "{C66F814A-1555-414A-96F3-876CB15A97E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C66F814A-1555-414A-96F3-876CB15A97E5}.Debug|x64.ActiveCfg = Debug|x64 + {C66F814A-1555-414A-96F3-876CB15A97E5}.Debug|x64.Build.0 = Debug|x64 + {C66F814A-1555-414A-96F3-876CB15A97E5}.Debug|x86.ActiveCfg = Debug|Win32 + {C66F814A-1555-414A-96F3-876CB15A97E5}.Debug|x86.Build.0 = Debug|Win32 + {C66F814A-1555-414A-96F3-876CB15A97E5}.Release|x64.ActiveCfg = Release|x64 + {C66F814A-1555-414A-96F3-876CB15A97E5}.Release|x64.Build.0 = Release|x64 + {C66F814A-1555-414A-96F3-876CB15A97E5}.Release|x86.ActiveCfg = Release|Win32 + {C66F814A-1555-414A-96F3-876CB15A97E5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {00E25241-B7C1-4BDE-838D-4767E42EBF7D} + EndGlobalSection +EndGlobal diff --git a/lab9/lab9.vcxproj b/lab9/lab9.vcxproj new file mode 100644 index 0000000..b7aa474 --- /dev/null +++ b/lab9/lab9.vcxproj @@ -0,0 +1,139 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {c66f814a-1555-414a-96f3-876cb15a97e5} + lab9 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/lab9/lab9.vcxproj.filters b/lab9/lab9.vcxproj.filters new file mode 100644 index 0000000..7aaecb7 --- /dev/null +++ b/lab9/lab9.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Файлы ресурсов + + + Файлы ресурсов + + + \ No newline at end of file diff --git a/lab9/main.c b/lab9/main.c new file mode 100644 index 0000000..508ef35 --- /dev/null +++ b/lab9/main.c @@ -0,0 +1,151 @@ +#include + + +void print1_10() { + int i = 1; + do { + printf("%d ", i); + i++; + } while (i <= 10); + puts("\n"); +} + +void print10_1() { + int i = 10; + do { + printf("%d ", i); + i--; + } while (i >= 0); + puts("\n"); +} + +void print5odd() { + int i = 1; + int n = 1; + do { + printf("%d", n); + n += 2; + i++; + } while (i <= 5); + puts("\n"); +} + +void print100_10() { + int n = 100; + while (n >= 10) { + printf_s("%d ", n); + n = n - 10; + } + puts("\n"); +} + +void print1000_100() { + int n = 1000; + while (n >= 100) { + printf_s("%d ", n); + n = n - 100; + } + puts("\n"); +} + +void printNfacts(int n) { + int a = 1; + int count = 1; + while (n >= count) { + printf("%d ", a); + count++; + a = a * count; + } + puts("\n"); +} + +void fibonacci() { + int n; + printf("num of fibonacchi numbers = "); + scanf_s("%d", &n); + + long double a = 0.0; + long double b = 1.0; + long double c; + n = n - 2; + + if (n <= 0) { + puts("wrong number"); + return 0; + } + + printf("0\n1\n"); + + do { + c = a + b; + a = b; + b = c; + printf("%.0Lf\n", c); + n = n - 1; + } while (n > 0); + puts("\n"); +} + +void prime_of_n() { + int n; + printf("N = "); + scanf_s("%d", &n); + + int d = 2; + while (n > 1) { + if (n % d == 0) { + printf("%d ", d); + n = n / d; + } else d++; + } + puts("\n"); +} + +int main() { + int n, num; + do { + puts("choose program"); + puts("1) print 1 -> 10"); + puts("2) print 10 -> 1"); + puts("3) print first five odd numbers"); + puts("11) print 100 90 ... 10"); + puts("12) print 1000 900 ... 100"); + puts("21) print first N factorials"); + puts("55) print fibonacci numbers"); + puts("4) prime factorization of N"); + puts(""); + puts("0) exit program"); + + scanf_s("%d", &n); + puts(""); + switch (n) + { + case 1: + print1_10(); + break; + case 2: + print10_1(); + break; + case 3: + print5odd(); + break; + case 11: + print100_10(); + break; + case 12: + print1000_100(); + break; + case 21: + printf("N = "); + scanf_s("%d", &num); + printNfacts(num); + case 55: + fibonacci(); + break; + case 4: + prime_of_n(); + } + + } while (n != 0); + return 0; +} \ No newline at end of file diff --git a/lab9/prime_of_n.png b/lab9/prime_of_n.png new file mode 100644 index 0000000..0811f4d Binary files /dev/null and b/lab9/prime_of_n.png differ diff --git a/lab9/printNfacts.png b/lab9/printNfacts.png new file mode 100644 index 0000000..a2358bb Binary files /dev/null and b/lab9/printNfacts.png differ diff --git a/test pointers/test pointers.sln b/test pointers/test pointers.sln new file mode 100644 index 0000000..7203b13 --- /dev/null +++ b/test pointers/test pointers.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test pointers", "test pointers\test pointers.vcxproj", "{A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Debug|x64.ActiveCfg = Debug|x64 + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Debug|x64.Build.0 = Debug|x64 + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Debug|x86.ActiveCfg = Debug|Win32 + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Debug|x86.Build.0 = Debug|Win32 + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Release|x64.ActiveCfg = Release|x64 + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Release|x64.Build.0 = Release|x64 + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Release|x86.ActiveCfg = Release|Win32 + {A4E08DB1-62C0-4D0A-8934-16DA5FE45ED6}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AA7C0FB4-16BC-4ED3-9A15-4442B764B5B4} + EndGlobalSection +EndGlobal diff --git a/test pointers/test pointers/main.c b/test pointers/test pointers/main.c new file mode 100644 index 0000000..b1d8fff --- /dev/null +++ b/test pointers/test pointers/main.c @@ -0,0 +1,23 @@ +#include + +int x = 222; + +void foo(int func()) { + printf("%d\n", func()); +} + +int bar() { + return 12345; +} + +int bq() { + return x; +} + +int main() { + + foo(bar); + foo(bq); + + return 0; +} \ No newline at end of file diff --git a/test pointers/test pointers/test pointers.vcxproj b/test pointers/test pointers/test pointers.vcxproj new file mode 100644 index 0000000..7d9af17 --- /dev/null +++ b/test pointers/test pointers/test pointers.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {a4e08db1-62c0-4d0a-8934-16da5fe45ed6} + testpointers + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/test pointers/test pointers/test pointers.vcxproj.filters b/test pointers/test pointers/test pointers.vcxproj.filters new file mode 100644 index 0000000..669bc4e --- /dev/null +++ b/test pointers/test pointers/test pointers.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file