From 94ae06e9757f9ba6b74334304a521fac479743e1 Mon Sep 17 00:00:00 2001 From: Stanislav Mykhailenko Date: Tue, 4 Jun 2024 11:40:07 +0300 Subject: [PATCH] Add Lesson 1 --- .gitignore | 56 +++++++++++++++++++++++++++++ Lesson_1/Task_1/.gitignore | 74 ++++++++++++++++++++++++++++++++++++++ Lesson_1/Task_1/Task_1.pro | 7 ++++ Lesson_1/Task_1/main.cpp | 7 ++++ Lesson_1/Task_2/.gitignore | 74 ++++++++++++++++++++++++++++++++++++++ Lesson_1/Task_2/Task_2.pro | 7 ++++ Lesson_1/Task_2/main.cpp | 17 +++++++++ Lesson_1/Task_3/.gitignore | 74 ++++++++++++++++++++++++++++++++++++++ Lesson_1/Task_3/Task_3.pro | 7 ++++ Lesson_1/Task_3/main.cpp | 21 +++++++++++ Lesson_1/Task_4/.gitignore | 74 ++++++++++++++++++++++++++++++++++++++ Lesson_1/Task_4/Task_4.pro | 7 ++++ Lesson_1/Task_4/main.cpp | 45 +++++++++++++++++++++++ Lesson_1/Task_5/.gitignore | 74 ++++++++++++++++++++++++++++++++++++++ Lesson_1/Task_5/Task_5.pro | 7 ++++ Lesson_1/Task_5/main.cpp | 32 +++++++++++++++++ Lesson_1/Task_6/.gitignore | 74 ++++++++++++++++++++++++++++++++++++++ Lesson_1/Task_6/Task_6.pro | 7 ++++ Lesson_1/Task_6/main.cpp | 25 +++++++++++++ Lesson_1/Task_7/.gitignore | 74 ++++++++++++++++++++++++++++++++++++++ Lesson_1/Task_7/Task_7.pro | 7 ++++ Lesson_1/Task_7/main.cpp | 30 ++++++++++++++++ README.md | 19 ++++++++++ UNLICENSE | 24 +++++++++++++ 24 files changed, 843 insertions(+) create mode 100644 .gitignore create mode 100644 Lesson_1/Task_1/.gitignore create mode 100644 Lesson_1/Task_1/Task_1.pro create mode 100644 Lesson_1/Task_1/main.cpp create mode 100644 Lesson_1/Task_2/.gitignore create mode 100644 Lesson_1/Task_2/Task_2.pro create mode 100644 Lesson_1/Task_2/main.cpp create mode 100644 Lesson_1/Task_3/.gitignore create mode 100644 Lesson_1/Task_3/Task_3.pro create mode 100644 Lesson_1/Task_3/main.cpp create mode 100644 Lesson_1/Task_4/.gitignore create mode 100644 Lesson_1/Task_4/Task_4.pro create mode 100644 Lesson_1/Task_4/main.cpp create mode 100644 Lesson_1/Task_5/.gitignore create mode 100644 Lesson_1/Task_5/Task_5.pro create mode 100644 Lesson_1/Task_5/main.cpp create mode 100644 Lesson_1/Task_6/.gitignore create mode 100644 Lesson_1/Task_6/Task_6.pro create mode 100644 Lesson_1/Task_6/main.cpp create mode 100644 Lesson_1/Task_7/.gitignore create mode 100644 Lesson_1/Task_7/Task_7.pro create mode 100644 Lesson_1/Task_7/main.cpp create mode 100644 README.md create mode 100644 UNLICENSE diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf9d0db --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +# C++ objects and libs +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.so.* +*.dll +*.dylib + +# Qt-es +object_script.*.Release +object_script.*.Debug +*_plugin_import.cpp +/.qmake.cache +/.qmake.stash +*.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +moc_*.h +qrc_*.cpp +ui_*.h +*.qmlc +*.jsc +Makefile* +*build-* +*.qm +*.prl + +# Qt unit tests +target_wrapper.* + +# QtCreator +*.autosave + +# QtCreator Qml +*.qmlproject.user +*.qmlproject.user.* + +# QtCreator CMake +CMakeLists.txt.user* + +# QtCreator 4.8< compilation database +compile_commands.json + +# QtCreator local machine specific files for imported projects +*creator.user* + +*_qmlcache.qrc + +build diff --git a/Lesson_1/Task_1/.gitignore b/Lesson_1/Task_1/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/Lesson_1/Task_1/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Lesson_1/Task_1/Task_1.pro b/Lesson_1/Task_1/Task_1.pro new file mode 100644 index 0000000..595bdaa --- /dev/null +++ b/Lesson_1/Task_1/Task_1.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += console c++17 +CONFIG -= app_bundle +CONFIG -= qt + +SOURCES += \ + main.cpp diff --git a/Lesson_1/Task_1/main.cpp b/Lesson_1/Task_1/main.cpp new file mode 100644 index 0000000..b851994 --- /dev/null +++ b/Lesson_1/Task_1/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + std::cout << "Stanislav" << std::endl << "Mykhailenko" << std::endl; + return 0; +} diff --git a/Lesson_1/Task_2/.gitignore b/Lesson_1/Task_2/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/Lesson_1/Task_2/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Lesson_1/Task_2/Task_2.pro b/Lesson_1/Task_2/Task_2.pro new file mode 100644 index 0000000..595bdaa --- /dev/null +++ b/Lesson_1/Task_2/Task_2.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += console c++17 +CONFIG -= app_bundle +CONFIG -= qt + +SOURCES += \ + main.cpp diff --git a/Lesson_1/Task_2/main.cpp b/Lesson_1/Task_2/main.cpp new file mode 100644 index 0000000..7b353ca --- /dev/null +++ b/Lesson_1/Task_2/main.cpp @@ -0,0 +1,17 @@ +#include + +int main() +{ + float firstNumber = 0; + float secondNumber = 0; + + std::cout << "Enter the first number: "; + std::cin >> firstNumber; + + std::cout << "Enter the second number: "; + std::cin >> secondNumber; + + std::cout << firstNumber + secondNumber << std::endl; + + return 0; +} diff --git a/Lesson_1/Task_3/.gitignore b/Lesson_1/Task_3/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/Lesson_1/Task_3/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Lesson_1/Task_3/Task_3.pro b/Lesson_1/Task_3/Task_3.pro new file mode 100644 index 0000000..595bdaa --- /dev/null +++ b/Lesson_1/Task_3/Task_3.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += console c++17 +CONFIG -= app_bundle +CONFIG -= qt + +SOURCES += \ + main.cpp diff --git a/Lesson_1/Task_3/main.cpp b/Lesson_1/Task_3/main.cpp new file mode 100644 index 0000000..1ee6afb --- /dev/null +++ b/Lesson_1/Task_3/main.cpp @@ -0,0 +1,21 @@ +#include + +int main() +{ + int money = 0; + std::cout << "How much money do you earn? "; + std::cin >> money; + + if (money < 1000) + std::cout << "Work more. "; + if (money > 1000) { + if (money > 1000000) + std::cout << "You are a millionaire. "; + if (money < 1000000) + std::cout << "You work great. "; + } + + std::cout << "You are doing great!" << std::endl; + + return 0; +} diff --git a/Lesson_1/Task_4/.gitignore b/Lesson_1/Task_4/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/Lesson_1/Task_4/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Lesson_1/Task_4/Task_4.pro b/Lesson_1/Task_4/Task_4.pro new file mode 100644 index 0000000..595bdaa --- /dev/null +++ b/Lesson_1/Task_4/Task_4.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += console c++17 +CONFIG -= app_bundle +CONFIG -= qt + +SOURCES += \ + main.cpp diff --git a/Lesson_1/Task_4/main.cpp b/Lesson_1/Task_4/main.cpp new file mode 100644 index 0000000..6da8c35 --- /dev/null +++ b/Lesson_1/Task_4/main.cpp @@ -0,0 +1,45 @@ +#include + +int main() +{ + float firstNumber = 0; + float secondNumber = 0; + float result = 0; + char operation; + + std::cout << "Enter the first number: "; + std::cin >> firstNumber; + + std::cout << "Enter the second number: "; + std::cin >> secondNumber; + + std::cout << "Enter operation: "; + std::cin >> operation; + + switch (operation) { + case '+': + result = firstNumber + secondNumber; + break; + case '-': + result = firstNumber - secondNumber; + break; + case '*': + result = firstNumber * secondNumber; + break; + case '/': + if (secondNumber == 0) { + std::cout << "Division by zero" << std::endl; + return 1; + } + result = firstNumber / secondNumber; + break; + default: + std::cout << "Unknown operation." << std::endl; + return 2; + break; + } + + std::cout << result << std::endl; + + return 0; +} diff --git a/Lesson_1/Task_5/.gitignore b/Lesson_1/Task_5/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/Lesson_1/Task_5/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Lesson_1/Task_5/Task_5.pro b/Lesson_1/Task_5/Task_5.pro new file mode 100644 index 0000000..595bdaa --- /dev/null +++ b/Lesson_1/Task_5/Task_5.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += console c++17 +CONFIG -= app_bundle +CONFIG -= qt + +SOURCES += \ + main.cpp diff --git a/Lesson_1/Task_5/main.cpp b/Lesson_1/Task_5/main.cpp new file mode 100644 index 0000000..56e981f --- /dev/null +++ b/Lesson_1/Task_5/main.cpp @@ -0,0 +1,32 @@ +#include +#include +#include + +int main() +{ + float a = 0; + float b = 0; + float c = 0; + float D = 0; + + std::cout << "Enter a: "; + std::cin >> a; + + std::cout << "Enter b: "; + std::cin >> b; + + std::cout << "Enter c: "; + std::cin >> c; + + D = pow(b, 2) - 4 * a * c; + + std::complex root = std::sqrt(std::complex(D)); + + std::complex x1 = (-b + root) / (2 * a); + std::complex x2 = (-b - root) / (2 * a); + + std::cout << "x1 = " << x1 << std::endl; + std::cout << "x2 = " << x2 << std::endl; + + return 0; +} diff --git a/Lesson_1/Task_6/.gitignore b/Lesson_1/Task_6/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/Lesson_1/Task_6/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Lesson_1/Task_6/Task_6.pro b/Lesson_1/Task_6/Task_6.pro new file mode 100644 index 0000000..595bdaa --- /dev/null +++ b/Lesson_1/Task_6/Task_6.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += console c++17 +CONFIG -= app_bundle +CONFIG -= qt + +SOURCES += \ + main.cpp diff --git a/Lesson_1/Task_6/main.cpp b/Lesson_1/Task_6/main.cpp new file mode 100644 index 0000000..c8c30c1 --- /dev/null +++ b/Lesson_1/Task_6/main.cpp @@ -0,0 +1,25 @@ +#include + +int main() +{ + int size = 0; + + std::cout << "Enter size: "; + std::cin >> size; + + for (int iteration = 0; iteration < size; ++iteration) { + int spaces = size - iteration - 1; + int asterisks = 1 + iteration * 2; + for (int space = 0; space < spaces; ++space) + std::cout << " "; + for (int asterisk = 0; asterisk < asterisks; ++asterisk) + std::cout << "*"; + std::cout << std::endl; + } + + for (int space = 0; space < size - 1; ++space) + std::cout << " "; + std::cout << "*" << std::endl; + + return 0; +} diff --git a/Lesson_1/Task_7/.gitignore b/Lesson_1/Task_7/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/Lesson_1/Task_7/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Lesson_1/Task_7/Task_7.pro b/Lesson_1/Task_7/Task_7.pro new file mode 100644 index 0000000..595bdaa --- /dev/null +++ b/Lesson_1/Task_7/Task_7.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += console c++17 +CONFIG -= app_bundle +CONFIG -= qt + +SOURCES += \ + main.cpp diff --git a/Lesson_1/Task_7/main.cpp b/Lesson_1/Task_7/main.cpp new file mode 100644 index 0000000..6a4ec3a --- /dev/null +++ b/Lesson_1/Task_7/main.cpp @@ -0,0 +1,30 @@ +#include +#include + +int main() +{ + float x = 0; + float y = 0; + float N = 0; + float distance = 0; + + std::cout << "x = "; + std::cin >> x; + + std::cout << "y = "; + std::cin >> y; + + std::cout << "N = "; + std::cin >> N; + + if (x > N || y > N) { + std::cout << "Beyond radius." << std::endl; + return 1; + } + + distance = sqrt(pow(x, 2) + pow(y, 2)); + + std::cout << distance << std::endl; + + return 0; +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..369eddc --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# New Generation 2024 Stanislav Mykhailenko + +Stanislav Mykhailenko's code for New Generation (started studying in 2024). + +All code in this repository is Unlicensed, see UNLICENSE. + +## Task list + +Checked means the task is Done. + +### Lesson 1 + +- [ ] Task 1 +- [ ] Task 2 +- [ ] Task 3 +- [ ] Task 4 +- [ ] Task 5 +- [ ] Task 6 +- [ ] Task 7 diff --git a/UNLICENSE b/UNLICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to