From 13915a6ddbcc8fef1b2d7f72e77072c702ca0fee Mon Sep 17 00:00:00 2001 From: Dasha Date: Mon, 5 Oct 2020 23:54:08 +0300 Subject: [PATCH 1/8] Initial --- d1.cpp | 18 ++++++++++++++++++ d2-1.cpp | 16 ++++++++++++++++ d2.cpp | 11 +++++++++++ d3.cpp | 15 +++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 d1.cpp create mode 100644 d2-1.cpp create mode 100644 d2.cpp create mode 100644 d3.cpp diff --git a/d1.cpp b/d1.cpp new file mode 100644 index 0000000..831807a --- /dev/null +++ b/d1.cpp @@ -0,0 +1,18 @@ +"Домашняя работа 1.exe" (Win32). Загружено "C:\Users\123\source\repos\Домашняя работа 1\Debug\Домашняя работа 1.exe". Символы загружены. +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\ntdll.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\kernel32.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\KernelBase.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\msvcp140d.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\vcruntime140d.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\ucrtbased.dll". +Поток 0x42f8 завершился с кодом 0 (0x0). +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\kernel.appcore.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\msvcrt.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\rpcrt4.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\sspicli.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\cryptbase.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\bcryptprimitives.dll". +"Домашняя работа 1.exe" (Win32). Загружено "C:\Windows\SysWOW64\sechost.dll". +Поток 0x14f8 завершился с кодом 0 (0x0). +Поток 0x19d4 завершился с кодом 0 (0x0). +Программа "[16348] Домашняя работа 1.exe" завершилась с кодом 0 (0x0). diff --git a/d2-1.cpp b/d2-1.cpp new file mode 100644 index 0000000..ac5b42e --- /dev/null +++ b/d2-1.cpp @@ -0,0 +1,16 @@ +#include + +int main() +{ + int i = 1; + int j = 1; + do { + do { + std::cout << i << " * " << j << " = " << i * j << std::endl; + j++; + } while (j < 10); + i++; + j = 1; + } while (i < 10); + return 0; +} \ No newline at end of file diff --git a/d2.cpp b/d2.cpp new file mode 100644 index 0000000..0fbb969 --- /dev/null +++ b/d2.cpp @@ -0,0 +1,11 @@ +#include + +int main() +{ + for (int i = 1; i < 10; i++) { + for (int j = 1; j < 10; j++) { + std::cout << i<< " * " << j << " = " << i * j << std::endl; + } + } + return 0; +} \ No newline at end of file diff --git a/d3.cpp b/d3.cpp new file mode 100644 index 0000000..10bc8d4 --- /dev/null +++ b/d3.cpp @@ -0,0 +1,15 @@ +#include + +void table() { + for (int i = 1; i < 10; i++) { + for (int j = 1; j < 10; j++) { + std::cout << i << " * " << j << " = " << i * j << std::endl; + } + } +} + +int main() +{ + table(); + return 0; +} From d369f3b27e5b6427cfbdb8e6a2010b5e8382d156 Mon Sep 17 00:00:00 2001 From: Dasha Date: Fri, 9 Oct 2020 09:35:31 +0300 Subject: [PATCH 2/8] Dasha2111 --- homework1.cpp | 21 +++++++++++++++++++++ homework2.cpp | 19 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 homework1.cpp create mode 100644 homework2.cpp diff --git a/homework1.cpp b/homework1.cpp new file mode 100644 index 0000000..f73bc6a --- /dev/null +++ b/homework1.cpp @@ -0,0 +1,21 @@ +#include + +int main() +{ + int side; + + std::cout << "Enter the size of the parties: "; + std::cin >> side; + std::cout << std::endl; + + for (int i = 0; i < side; i++) + { + for (int j = 0; j < side; j++) + { + std::cout << "* "; + } + std::cout << std::endl; + } + system("pause"); + return 0; +} diff --git a/homework2.cpp b/homework2.cpp new file mode 100644 index 0000000..c940663 --- /dev/null +++ b/homework2.cpp @@ -0,0 +1,19 @@ +#include + +int main() +{ + int n = 0; + std::cin >> n; + for (int i = 1; i < n; i++) { + for (int j = 1; j < n; j++) { + if (i == j || i + j == n) { + std::cout << "*"; + } + else { + std::cout << " "; + } + } + std::cout << std::endl; + } + return 0; +} \ No newline at end of file From 2c7bbba31e618271fd664f79f4d03484dcf7eb5e Mon Sep 17 00:00:00 2001 From: Dasha Date: Tue, 13 Oct 2020 23:44:40 +0300 Subject: [PATCH 3/8] Dasha2002 --- ...260\321\202\320\270\320\272\320\260 3.cpp" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "\320\230\320\275\321\204\320\276\321\200\320\274\320\260\321\202\320\270\320\272\320\260 3.cpp" diff --git "a/\320\230\320\275\321\204\320\276\321\200\320\274\320\260\321\202\320\270\320\272\320\260 3.cpp" "b/\320\230\320\275\321\204\320\276\321\200\320\274\320\260\321\202\320\270\320\272\320\260 3.cpp" new file mode 100644 index 0000000..e84825f --- /dev/null +++ "b/\320\230\320\275\321\204\320\276\321\200\320\274\320\260\321\202\320\270\320\272\320\260 3.cpp" @@ -0,0 +1,22 @@ +#include + + +int main() +{ + int x = 0; + int y = 0; + std::printf("Введите ширину: "); + std::cin >> x; + std::printf("Введите длину: "); + std::cin >> y; + + for (int i = 1; i < x + 1; i++) + { + for (int j = 1; j < y + 1; j++) + { + std::cout << "*"; + } + std::cout << std::endl; + } + return 0; +} \ No newline at end of file From 86f982d42123e0bb36a2f637496d0c8b0f4ab081 Mon Sep 17 00:00:00 2001 From: Dasha Date: Tue, 3 Nov 2020 12:44:28 +0300 Subject: [PATCH 4/8] DashaTE --- ...0\276\321\200\320\275\320\260\321\217.cpp" | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 "\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217.cpp" diff --git "a/\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217.cpp" "b/\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217.cpp" new file mode 100644 index 0000000..855a8a1 --- /dev/null +++ "b/\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217.cpp" @@ -0,0 +1,71 @@ +#include + +#include + +#include + +using namespace std; + +int main() + +{ + + setlocale(LC_ALL, "ru"); + + double y, a, b, Xn, aX, Xk; + + system("color 02"); + + cout << "Эта программа решает эту функцию y = (asin(x)^2+acos(x)^4)^3 \n"; + + printf("\nЗадание A:\n"); + + cout << "Введите коэффициенты: \n"; + + cout << "Коэффициент Xn: "; cin >> Xn; // Xn = 0.26; + + cout << "Коэффициент Xk: "; cin >> Xk; // Xk = 0.66; + + cout << "Коэффициент aX: "; cin >> aX; // aX = 0.08; + + for (double i = Xn; i <= Xk;) { + + if (abs(i) > 1) { printf("Error: |x| > 1"); return 0; } + + y = pow(asin(i) * asin(i) + pow(acos(i), 4), 3); + + cout << "Результат функции при x=" << i << " равен " << y << endl; + + i = i + aX; + + } + + system("pause"); + + system("cls"); + + system("color 04"); + + printf("Задание B :\n"); + + double x = 0.1; + + for (int i = 1; i <= 5; ++i) { + + if (i == 2) x += 0.25; + + if (i == 3) x += 0.05; + + if (i == 4) x += 0.15; + + if (i == 5) x += 0.05; + + if (abs(x) > 1) { printf("Error: |x| > 1"); return 0; } + + y = pow(asin(x) * asin(x) + pow(acos(x), 4), 3); + + cout << "Результат функции при x=" << x << " равен " << y << endl; + + } + +} \ No newline at end of file From a84e7b8a8f1d88924b63f50dd016d516f37d52a9 Mon Sep 17 00:00:00 2001 From: Dasha Date: Tue, 17 Nov 2020 11:55:23 +0300 Subject: [PATCH 5/8] Dashaaa --- Homework.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Homework.cpp diff --git a/Homework.cpp b/Homework.cpp new file mode 100644 index 0000000..4a7ab6f --- /dev/null +++ b/Homework.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; +void hanoi_towers(int n, int f, int t, int b); //n-количество колец, f-начальное положение колец(1-3), t - конечное положение колец (1-3), b-промежуточный колышек (1-3) +int main() { + int n, f, t, b; + cin >> n >> f >> t >> b; + hanoi_towers(n, f, t, b); + return 0; +} +void hanoi_towers(int n, int f, int t, int b) { + if (n != 0) { + hanoi_towers(n - 1, f, b, t); + cout << "{0}->{1}" << f << " " << t; + hanoi_towers(n - 1, b, t, f); + } +} \ No newline at end of file From 14336bcbe1a68b0c887e823700226ddfeff37551 Mon Sep 17 00:00:00 2001 From: Dasha Date: Fri, 20 Nov 2020 15:24:22 +0300 Subject: [PATCH 6/8] Laboratory --- ...00\320\270\320\260\320\275\321\202 15.cpp" | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 "\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217 \321\200\320\260\320\261\320\276\321\202\320\2605,\320\222\320\260\321\200\320\270\320\260\320\275\321\202 15.cpp" diff --git "a/\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217 \321\200\320\260\320\261\320\276\321\202\320\2605,\320\222\320\260\321\200\320\270\320\260\320\275\321\202 15.cpp" "b/\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217 \321\200\320\260\320\261\320\276\321\202\320\2605,\320\222\320\260\321\200\320\270\320\260\320\275\321\202 15.cpp" new file mode 100644 index 0000000..94c5958 --- /dev/null +++ "b/\320\233\320\260\320\261\320\276\321\200\320\260\321\202\320\276\321\200\320\275\320\260\321\217 \321\200\320\260\320\261\320\276\321\202\320\2605,\320\222\320\260\321\200\320\270\320\260\320\275\321\202 15.cpp" @@ -0,0 +1,24 @@ +#include +#include "math.h" + +using namespace std; + +int main() +{ + double array[2][21]; + int j = 0; + double y = 0; + for (double x = 0; x <= 1.05; x += 0.05) + { + y = ((tan(pow(x, 2)) + pow(x + 3, 0.5) + pow(exp(x), -1)) / (pow(x, 4) + 3 * pow(x, 2) - 2 * x - 3)); + array[0][j] = x; + array[1][j] = y; + j++; + } + for (int i = 0; i < 21; i++) + { + cout << "x = " << array[0][i] << " | " << "y = " << array[1][i] << endl; + + } + return 0; +} From 1853cf127f70d714ca9992e175e895ad129f8291 Mon Sep 17 00:00:00 2001 From: Dasha Date: Fri, 27 Nov 2020 00:48:11 +0300 Subject: [PATCH 7/8] Dasha.1 --- Homework.11.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Homework.11.cpp diff --git a/Homework.11.cpp b/Homework.11.cpp new file mode 100644 index 0000000..77d8b37 --- /dev/null +++ b/Homework.11.cpp @@ -0,0 +1,44 @@ +// Игровой персонаж (классы, уровень) +#include +#include +using namespace std; + +class Position +{ +public: + string NameHero; + string GameClass; + int level; + + Position(string NameHero, string GameClass, int level) { + this->NameHero = NameHero; + this->GameClass = GameClass; + this->level = level; + } + + void Display() { + cout << NameHero << " " << GameClass << " " << level << endl; + } + + ~Position() { + cout << "Destruction position" << endl; + } + + void SetPopulation(int level) { + if (level >= 0 && level <= 99) { + this->level = level; + } + + } + +}; + + +int main() +{ + Position my_loc("Stiv", "magician", 69); + my_loc.Display(); + Position my_had("Reiden", "archer", 38); + my_had.Display(); + return 0; +} \ No newline at end of file From a8a3e7bede810e1e3a9b0cd678e0f7fd631e6c1a Mon Sep 17 00:00:00 2001 From: Dasha Date: Mon, 7 Dec 2020 01:15:48 +0300 Subject: [PATCH 8/8] dashaat --- Homework.Dasha.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++ LaboratoryWork15.2.cpp | 83 +++++++++++++++++++++++++++++++++++++++ LaboratoryWork15.cpp | 9 +++++ 3 files changed, 180 insertions(+) create mode 100644 Homework.Dasha.cpp create mode 100644 LaboratoryWork15.2.cpp create mode 100644 LaboratoryWork15.cpp diff --git a/Homework.Dasha.cpp b/Homework.Dasha.cpp new file mode 100644 index 0000000..5626bbf --- /dev/null +++ b/Homework.Dasha.cpp @@ -0,0 +1,88 @@ +#include +using namespace std; + +class child { +private: + bool pl = 0; + bool sl = 0; + bool ea = 0; + bool err = 0; +public: + void what_want() { + if (pl) cout << "Ребенок хочет играть!\n"; + if (sl) cout << "Ребенок хочет спать!\n"; + if (ea) cout << "Ребенок хочет есть!\n"; + if (!ea & !sl & !pl) cout << "Ребенок ничего не хочет!\n"; + } + void play() { + if (!pl) cout << "\x1b[31mРебенок не хочет играть, мы не можете поиграть с ним!\x1b[0m\n"; + else { + pl = false; + cout << "\x1b[32mВы поиграли с ребенком!\x1b[0m\n"; + } + } + void sleep() { + if (!sl) cout << "\x1b[31mРебенок не хочет спать, мы не можете уложить его!\x1b[0m\n"; + else { + sl = false; + cout << "\x1b[33mВы уложили ребенка!\x1b[0m\n"; + } + } + void eat() { + if (!ea) cout << "\x1b[31mРебенок не хочет есть, мы не можете накормить его!\x1b[0m\n"; + else { + ea = false; + cout << "\x1b[35mВы накормили ребенка!\x1b[0m\n"; + } + } + void wanna_eat() { + if (pl && sl) { + cout << "У ребенка уже есть 2 состояния вы не можете добавить ему 3\n"; + } + else ea = true; + } + void wanna_sleep() { + if (pl && ea) { + cout << "У ребенка уже есть 2 состояния вы не можете добавить ему 3\n"; + } + else sl = true; + } + void wanna_play() { + if (ea && sl) { + cout << "У ребенка уже есть 2 состояния вы не можете добавить ему 3\n"; + } + else pl = true; + } +}; + +int main() { + setlocale(LC_ALL, "RU"); + child Dasha; + // тесты + Dasha.wanna_play(); + Dasha.what_want(); + Dasha.play(); + Dasha.what_want(); + cout << endl; + Dasha.wanna_eat(); + Dasha.what_want(); + Dasha.eat(); + Dasha.what_want(); + cout << endl; + Dasha.wanna_sleep(); + Dasha.what_want(); + Dasha.sleep(); + Dasha.what_want(); + cout << endl; + Dasha.wanna_eat(); + Dasha.wanna_sleep(); + Dasha.what_want(); + Dasha.eat(); + Dasha.sleep(); + Dasha.what_want(); + cout << endl; + Dasha.wanna_play(); + Dasha.wanna_eat(); + Dasha.wanna_sleep(); + Dasha.what_want(); +} diff --git a/LaboratoryWork15.2.cpp b/LaboratoryWork15.2.cpp new file mode 100644 index 0000000..8c65ba9 --- /dev/null +++ b/LaboratoryWork15.2.cpp @@ -0,0 +1,83 @@ +#include +#include +#include +using namespace std; + +int s_n_el(int* a, int n) { + int result = 0; + for (int i = 0; i < n; i++) if (a[i] < 0) result += a[i]; + return result; +} + +int c_n_el(int* a, int n) { + int result = 0; + for (int i = 0; i < n; i++) if (a[i] < 0) result++; + return result; +} + +void randomize_array_C(int a[][6]) { + cout << "\nМассив С успешно сгенерирован! :)\n\n"; + for (int i = 0; i < 6; i++) { + for (int j = 0; j < 6; j++) { + a[i][j] = rand() % 21 - 10; + cout << a[i][j] << "\t"; + } + cout << endl << endl; + } +} + +void randomize_array_D(int a[][8]) { + + cout << "\nМассив D успешно сгенерирован! :)\n\n"; + + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 8; j++) { + a[i][j] = rand() % 21 - 10; + cout << a[i][j] << "\t"; + } + cout << endl << endl; + } +} + +int main() { + + setlocale(LC_ALL, "ru"); + srand(time(0)); + + int C[6][6]{}, D[8][8]{}, s_c_c[2][6], s_c_d[2][8]; + + randomize_array_C(C); + randomize_array_D(D); + + cout << endl; + for (int i = 0; i < 6; i++) { + s_c_c[0][i] = s_n_el(C[i], 6); + s_c_c[1][i] = c_n_el(C[i], 6); + } + + + for (int i = 0; i < 2; i++) { + if (i == 0) cout << "Суммы отрицательных чисел в каждой строке C: \n"; + if (i == 1) cout << "Количество отрицательных чисел в каждой строке C: \n"; + for (int j = 0; j < 6; j++) { + cout << s_c_c[i][j] << "\t"; + } + cout << endl; + } + + for (int i = 0; i < 8; i++) { + s_c_d[0][i] = s_n_el(D[i], 8); + s_c_d[1][i] = c_n_el(D[i], 8); + } + + for (int i = 0; i < 2; i++) { + if (i == 0) cout << "Суммы отрицательных чисел в каждой строке D: \n"; + if (i == 1) cout << "Количество отрицательных чисел в каждой строке D: \n"; + for (int j = 0; j < 8; j++) { + cout << s_c_d[i][j] << "\t"; + } + cout << endl; + } + +} + diff --git a/LaboratoryWork15.cpp b/LaboratoryWork15.cpp new file mode 100644 index 0000000..733abe2 --- /dev/null +++ b/LaboratoryWork15.cpp @@ -0,0 +1,9 @@ +#include +#include +using namespace std; +int main() { + setlocale(LC_ALL, "ru"); + double summ = 0; + for (int i = 1; i <= 15; i++) summ += exp(-1 * i) * sin(i); + cout << "Ответ: " << summ; +}