diff --git a/lab1/CellularAutomaton.cpp b/lab1/CellularAutomaton.cpp new file mode 100644 index 0000000..79241b8 --- /dev/null +++ b/lab1/CellularAutomaton.cpp @@ -0,0 +1,5 @@ +#include "CellularAutomaton.h" + +CellularAutomaton::CellularAutomaton(int width, int height) : m_fieldWidth(width), m_fieldHeight(height) +{ +} diff --git a/lab1/CellularAutomaton.h b/lab1/CellularAutomaton.h new file mode 100644 index 0000000..7f2ece5 --- /dev/null +++ b/lab1/CellularAutomaton.h @@ -0,0 +1,8 @@ +#pragma once +class CellularAutomaton +{ + int m_fieldWidth, m_fieldHeight; +public: + CellularAutomaton(int width, int height); +}; + diff --git a/lab1/lab1.cpp b/lab1/lab1.cpp index 5e2b48a..e5d56bf 100644 --- a/lab1/lab1.cpp +++ b/lab1/lab1.cpp @@ -1,9 +1,45 @@ #include #include "io.h" +#include "CellularAutomaton.h" using namespace std; +void clear() { + system("cls"); +} + + int main() { - std::cout << "Hello World!\n"; + setlocale(LC_ALL, "Russian"); + + while (true) { + skipIter: + clear(); + + cout << "Выберите способ вычисления функции:\n" + "Запустить клеточный автомат (0)\n" + "Завершить работу (1)\n\n"; + + int actionId = inputNumber(0, 1); + + clear(); + + if (actionId == 1) { + cout << "Выйти из программы? (yes/no)\n"; + if (userApprove()) return 0; + goto skipIter; + } + + cout << "Укажите ширину поля (min 1): "; + int fieldWidth = inputNumber(1); + + cout << "Укажите высоту поля (min 1): "; + int fieldHeight = inputNumber(1); + + cout << "Укажите количество итераций (min 1): "; + int iterationsCount = inputNumber(1); + + CellularAutomaton(fieldWidth, fieldHeight); + } } \ No newline at end of file diff --git a/lab1/lab1.vcxproj b/lab1/lab1.vcxproj index 9d1e4c2..eb42dd4 100644 --- a/lab1/lab1.vcxproj +++ b/lab1/lab1.vcxproj @@ -127,10 +127,12 @@ + + diff --git a/lab1/lab1.vcxproj.filters b/lab1/lab1.vcxproj.filters index 19526f6..ec17398 100644 --- a/lab1/lab1.vcxproj.filters +++ b/lab1/lab1.vcxproj.filters @@ -21,10 +21,16 @@ Исходные файлы + + Исходные файлы + Файлы заголовков + + Файлы заголовков + \ No newline at end of file