diff --git a/lab/desktop.ini b/lab/desktop.ini new file mode 100644 index 0000000..7c48ef4 --- /dev/null +++ b/lab/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Program Files\Google\Drive File Stream\100.0.2.0\GoogleDriveFS.exe,26 diff --git a/lab/lab.vcxproj b/lab/lab.vcxproj new file mode 100644 index 0000000..65a826d --- /dev/null +++ b/lab/lab.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {84206dea-52a8-4fdc-88ae-19eab48f0d52} + lab + 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/lab/lab.vcxproj.filters b/lab/lab.vcxproj.filters new file mode 100644 index 0000000..ee3ac9b --- /dev/null +++ b/lab/lab.vcxproj.filters @@ -0,0 +1,31 @@ + + + + + {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/lab/lab1.c b/lab/lab1.c new file mode 100644 index 0000000..223a2be --- /dev/null +++ b/lab/lab1.c @@ -0,0 +1,57 @@ +#include +#include + +void aboutMe() { + printf("\n\n\n"); + printf("-12\n"); + printf("24.09.2024\n"); + printf(" \n"); + printf(" 8\n\n"); +} + +int main1() { + setlocale(LC_ALL, "RU"); + + aboutMe(); + + //printf("Hello World!\n\n\n"); + + //printf(" \n"); + //printf("-12\n"); + //printf("04.09.2024\n\n"); + + //printf("04.09.2024\n"); + //printf("-12\n"); + //printf(" \n\n\n"); + + //printf(" \n"); + //printf("-12\n"); + //printf("04.09.2024\n\n"); + + //printf("04.09.2024\n"); + //printf("-12\n"); + //printf(" \n\n\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("| |/\n"); + //printf("*-----*\n"); + //printf("\n"); + //printf("\n"); + + return 0; +} \ No newline at end of file diff --git a/lab/lab2.c b/lab/lab2.c new file mode 100644 index 0000000..49c5833 --- /dev/null +++ b/lab/lab2.c @@ -0,0 +1,104 @@ +#include +#include +#define _USE_MATH_DEFINES +#include +#define g 9.8f + +void L2Z1(), L2Z2(), L2Z3(), L2Z4(), L2Z5(), L2Z6(), L2Z7(); + +int main2() { + system("chcp 1251"); + + //L2Z1(); + //L2Z2(); + //L2Z3(); + //L2Z4(); + //L2Z5(); + //L2Z6(); + L2Z7(); + + return 0; +} + +void L2Z1() { + float h = 12, t = sqrt(2 * h / g); + printf(" %.2f \n", t); +} + +void L2Z2() { + float h, t; + printf(" : "); + scanf_s("%f", &h); + t = sqrt(2 * h / g); + printf(" %.2f ", t); +} + +void L2Z3() { + float S; + int cost_per_meter; + printf(" .: "); + scanf_s("%f%d", &S, &cost_per_meter); + float price = S * cost_per_meter; + printf("%.2f", price); +} + +void L2Z4() { + float S, percent = 0.5; + int cost_per_meter, salary; + printf(" : "); + scanf_s("%f", &S); + printf(" 1 .: "); + scanf_s("%d", &cost_per_meter); + printf(" : "); + scanf_s("%d", &salary); + printf(" %f %d . %f\n", S, cost_per_meter, S * cost_per_meter); + float t = (S * cost_per_meter) / (salary * percent); + printf(" %d %1.2f ", salary, t); +} + +void L2Z5() { + float V, R, H; + printf(" \n"); + printf(" : "); + scanf_s("%f", &R); + printf(" : "); + scanf_s("%f", &H); + if (H > 2 * R) H = 2 * R; + V = M_PI * pow(H, 2) * (R - H / 3); + printf("V = %.2f", V); +} + +void L2Z6() { + float V, a; + printf(" \n"); + printf(" : "); + scanf_s("%f", &V); + printf(" : "); + scanf_s("%f", &a); + float S = pow(V, 2) * sinf(2 * a * M_PI / 180) / g; + float H = pow(V * sinf(a * M_PI / 180), 2) / 2 / g; + printf("L = %.2f\n", S); + printf("H = %.2f\n\n", H); +} + +void L2Z7() { + float A, r; + int n; + char currency[4]; + + printf(" \n"); + + printf(" : "); + scanf_s("%f", &A); + printf(" : "); + scanf_s("%d", &n); + printf(" : "); + scanf_s("%f", &r); + printf(" : "); + scanf_s("%s", currency, 4); + + + float S = A + ((A + A / n) * r * n / 2 / 100); + + printf(" %.2f %s\n %.2f %s\n\n", S, currency, S - A, currency); +} \ No newline at end of file diff --git a/lab/lab3.c b/lab/lab3.c new file mode 100644 index 0000000..37f7bd4 --- /dev/null +++ b/lab/lab3.c @@ -0,0 +1,217 @@ +#include +#include + +void L3Z1(); +int L3Z2(); +char* L3Z3(); +int L3Z4(); +char* L3Z5(); +char* L3Z6(); +char* L3Z7(); + +int main3() { + setlocale(LC_ALL, "RU"); + + //L3Z1(); + //L3Z2(); + //L3Z3(); + //L3Z4(); + //L3Z5(); + //L3Z6(); + //L3Z7(); + + return 0; +} + +void L3Z1() { + float a, b; + printf(" : "); + scanf_s("%f", &a); + printf(" : "); + scanf_s("%f", &b); + if (a == b) { + printf(" "); + } + else { + float max, min; + + if (a > b) { + max = a; + min = b; + } + else { + max = b; + min = a; + } + printf(" = %f\n = %f", max, min); + } +} + +int L3Z2() { + int a, b, c; + printf(" 3 : "); + scanf_s("%d %d %d", &a, &b, &c); + + + int max = a; + if (b > max) { + max = b; + } + if (c > max) { + max = c; + } + + printf("max = %d", max); + return max; +} + +char* L3Z3() { + int temperature; + char* ans = ""; + printf(" : "); + scanf_s("%d", &temperature); + if (temperature >= 18 && temperature < 22) { + ans = ""; + } + else if (temperature >= 22 && temperature < 26) { + ans = ""; + } + else if (temperature >= 26) { + ans = ""; + } + + printf("%s", ans); + return ans; +} + +int L3Z4() { + int a[5]; + printf(" 5 : "); + for (int i = 0; i < 5; i++) { + scanf_s("%d", &a[i]); + } + + int max = a[0]; + for (int i = 1; i < 5; i++) { + if (a[i] > max) { + max = a[i]; + } + } + printf("%d", max); + return max; +} + +/* +tests: +input | output +1 | +2 | +3 | +4 | +*/ +char* L3Z5() { + char* ans = ""; + int season; + + printf(" \n"); + printf("1) \n"); + printf("2) \n"); + printf("3) \n"); + printf("4) \n"); + + scanf_s("%d", &season); + + while (!(1 <= season && season <= 4)) { + printf(" \n"); + printf("1) \n"); + printf("2) \n"); + printf("3) \n"); + printf("4) \n"); + scanf_s("%d", &season); + } + + if (season == 1) { + ans = ""; + } + else if (season == 2) { + ans = ""; + } + else if (season == 3) { + ans = ""; + } + else { + ans = ""; + } + + printf("%s", ans); + + return ans; + +} + +/* +tests: +input | output +1 | +264000 | +3567904 | +*/ +char* L3Z6() { + float price; + char* ans = ""; + printf(" = "); + scanf_s("%f", &price); + if (price <= 250000) { + ans = ""; + } + else if (price > 250000 && price <= 700000) { + ans = ""; + } + else if (price > 700000 && price <= 1000000) { + ans = ""; + } + else if (price > 1000000 && price <= 100000000) { + ans = " "; + } + printf("%s", ans); + + return ans; +} + +/* +tests: +input | output +1 | +123 | +735 | +9090 | +*/ +char* L3Z7() { + float ms; + char* ans = ""; + + printf(" = "); + scanf_s("%f", &ms); + + if (ms <= 1) { + ans = ""; + } + else if (ms > 1 && ms <= 2) { + ans = " "; + } + else if (ms > 2 && ms <= 100) { + ans = ""; + } + else if (ms > 100 && ms <= 1000) { + ans = ""; + } + else if (ms > 1000 && ms <= 5000) { + ans = ""; + } + else if (ms > 5000 && ms <= 10000) { + ans = " "; + } + printf("%s", ans); + + return ans; +} \ No newline at end of file diff --git a/lab/lab4.c b/lab/lab4.c new file mode 100644 index 0000000..75d023a --- /dev/null +++ b/lab/lab4.c @@ -0,0 +1,130 @@ +#include +#include +#include +#include + +void L4Z1(), L4Z2(), L4Z3(), L4Z4(), L4Z5(), L4Z6(), L4Z7(); + +int main4() { + setlocale(LC_ALL, "RU"); + + //L4Z1(); + //L4Z2(); + //L4Z3(); + //L4Z4(); + //L4Z4(); + //L4Z5(); + //L4Z6(); + //L4Z7(); + + + return 0; +} + +void L4Z1() { + int n, i = 1; + + printf("n = "); + scanf_s("%d", &n); + + do { + printf("%d ", i); + i++; + } while (i <= n); +} + +void L4Z2() { + int n, stepen = 1, i = 0; + printf("n = "); + scanf_s("%d", &n); + + do { + printf("%d^%d = %d\n", n, i, stepen); + stepen *= n; + i++; + } while (i <= 5); +} + +void L4Z3() { + float summa, percent; + int i = 0; + + printf("summa = "); + scanf_s("%f", &summa); + + printf("percent = "); + scanf_s("%f", &percent); + + do { + printf("%2d year summa = %10.0f\n", i, summa); + summa *= (percent / 100 + 1); + i++; + } while (i <= 10); +} + +void L4Z4() { + int n, i = 1; + scanf_s("%d", &n); + + do { + printf("%d ", 2 * i); + i++; + } while (i <= n); +} + +void L4Z5() { + int n, a, i = 1; + scanf_s("%d", &n); + scanf_s("%d", &a); + + do { + printf("%d ", a * i); + i++; + } while (i <= n); +} + +void L4Z6() { + int i = 2; + int n; + scanf_s("%d", &n); + + do { + bool ok = true; + int del = 2; + + while (del < ((int)sqrt(i)) + 1) { + if ((i % del) == 0) { + ok = false; + break; + } + del++; + } + + /*for (int del = 2; del < ((int)sqrt(i)) + 1; del++) { + if ((i % del) == 0) { + ok = false; + break; + } + }*/ + + if (ok) { + printf("%d ", i); + n--; + } + i++; + } while (n > 0); +} + +void L4Z7() { + int summ, transh, n; + float percent; + summ = 1000000, transh = 1000000, n = 3, percent = 18; + printf("summ, transh, n, percent"); + scanf_s("%d%d%d%f", &summ, &transh, &n, &percent); + do { + summ = summ * (percent / 100 + 1) - transh; + n--; + } while (n > 0); + + printf("%d", summ); +} \ No newline at end of file