diff --git a/LevNemtsev/2MiniHW/2MiniHWtask1.cpp b/LevNemtsev/2MiniHW/2MiniHWtask1.cpp deleted file mode 100644 index 4d010657..00000000 --- a/LevNemtsev/2MiniHW/2MiniHWtask1.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; -using std::oct; -using std::hex; - -void printHexadecimal(int number) -{ - cout << "Шестнадцатеричное представление: " << hex << number << endl; -} - -void printOctal(int number) -{ - cout << "Восьмеричное представление: " << oct << number << endl; -} - -int main() -{ - int number; - cout << "Введите число: "; - cin >> number; - - printHexadecimal(number); - printOctal(number); - - return 0; -} diff --git a/LevNemtsev/2MiniHW/2MiniHWtask2.cpp b/LevNemtsev/2MiniHW/2MiniHWtask2.cpp deleted file mode 100644 index 33873723..00000000 --- a/LevNemtsev/2MiniHW/2MiniHWtask2.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -void hypothesis(int number) -{ - cout << "Последовательность для числа " << number << ": "; - while (number != 1) - { - cout << number << " "; - - if (number % 2 == 0) - { - number /= 2; - } - - else - { - number = (number * 3 + 1) / 2; - } - } - cout << number << endl; -} - -int main() { - int number; - cout << "Введите натуральное число: "; - cin >> number; - - hypothesis(number); - - return 0; -} diff --git a/Task1.cpp b/Task1.cpp deleted file mode 100644 index 95c51210..00000000 --- a/Task1.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Task1.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// -using std::cin; -using std::cout; - -#include - -void SquareArea() { - int input = 0; - - cin >> input; - cout << "Square area:"; - cout << input * input; - return; -} -int main() -{ - cout << "Enter the length of the square"; - SquareArea(); -} - - - -// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/Task2.cpp b/Task2.cpp deleted file mode 100644 index 755f86a9..00000000 --- a/Task2.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Task2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// -#include -using std::cin; -using std::cout; - -void TrapezoidArea() { - int base1 = 0; - int base2 = 0; - int height = 0; - cin >> base1; - cout << "Enter the length of the second base of the trapezoid"; - cin >> base2; - cout << "Enter the length of the trapezoid height"; - cin >> height; - cout << "Trapezoid area:"; - cout << (((base1 + base2)/2) * height); - return; - -} -int main() -{ - cout << "Enter the length of the first base of the trapezoid"; - TrapezoidArea(); -} - -// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/Task3.cpp b/Task3.cpp deleted file mode 100644 index 4a2b81d3..00000000 --- a/Task3.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Task3.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// - -#include -using std::cin; -using std::cout; -using std::endl; - - -void FibonacciGenerator() { - int NumberOfDigits; - cin >> NumberOfDigits; - int k = 0; - int n1 = 0; - int n2 = 1; - int n3 = n1 + n2; - while (k < NumberOfDigits){ - cout << n1 << endl; - n1 = n2; - n2 = n3; - n3 = n1 + n2; - k += 1; - } -} -int main() -{ - cout << "Enter the number of digits"< "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/Task4.cpp b/Task4.cpp deleted file mode 100644 index 5d4c639c..00000000 --- a/Task4.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -#include -using std::cout; -using std::cin; -using std::endl; - -void Converter() { - int n1; - int n2 = 0; - cin >> n1; - while (n1 > 0) { - n2 = n1 % 10; - n1 = n1 / 10; - cout << n2; - } -} -int main() -{ - cout << "Enter a number"<< endl; - Converter(); -} \ No newline at end of file diff --git a/sem1/AlanMadreimov/MiniHomeWork1/task1.cpp b/sem1/AlanMadreimov/MiniHomeWork1/task1.cpp deleted file mode 100644 index e0ba29f2..00000000 --- a/sem1/AlanMadreimov/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - - -double SquareArea(double a) { - return a * a; - -} - -int main() -{ - double a; - do { - std::cout << "Enter square side: "; - std::cin >> a; - if (a <= 0) { - std::cout << "Side can't be - or 0" << std::endl; - } - } while (a <= 0); - - std::cout << "Square area is: " << SquareArea(a); - return 0; -} - diff --git a/sem1/AlanMadreimov/MiniHomeWork1/task2.cpp b/sem1/AlanMadreimov/MiniHomeWork1/task2.cpp deleted file mode 100644 index 5554916d..00000000 --- a/sem1/AlanMadreimov/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - - - -double TrapezoidArea(double h, double a, double b) { - return h * (a + b) / 2; -} - -int main() { - double h, a, b; - - do { - std::cout << "Enter Height of Trapezoid: "; - std::cin >> h; - std::cout << "Enter base a: "; - std::cin >> a; - std::cout << "Enter base b: "; - std::cin >> b; - if ((a <= 0) or (b <= 0) or (h <= 0)) { - std::cout << "Height and bases can't be - or 0" << std::endl; - } - } while ((a <= 0) or (b <= 0) or (h <= 0)); - - std::cout << TrapezoidArea(h, a, b); - - return 0; -} diff --git a/sem1/AlanMadreimov/MiniHomeWork1/task3.cpp b/sem1/AlanMadreimov/MiniHomeWork1/task3.cpp deleted file mode 100644 index 1a44b0b5..00000000 --- a/sem1/AlanMadreimov/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - - -void Fibo(int n,int firstn=0,int secondn=1) { - int temp; - if (n == 0) { - std::cout << firstn; - } - else if (n == 1) { - std::cout << firstn << " " << secondn; - } - else { - std::cout << "0" << " " << "1 "; - for (int i = 2; i < n; i++) { - temp = firstn + secondn; - firstn = secondn; - secondn = temp; - std::cout << temp << " "; - } - } -} - -int main() { - - int n; - std::cout << "Please enter n: "; - std::cin >> n; - - Fibo(n); - - return 0; -} \ No newline at end of file diff --git a/sem1/AlanMadreimov/MiniHomeWork1/task4.cpp b/sem1/AlanMadreimov/MiniHomeWork1/task4.cpp deleted file mode 100644 index 5cc0834b..00000000 --- a/sem1/AlanMadreimov/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include - - -int Reverser(int num, int nDoz) { - int addN, nNeg = -1; - int result = 0; - while(num != 0) { - addN = num / pow(10, nDoz); - result += addN * pow(10, nNeg); - num = num - addN * pow(10, nDoz); - nDoz--; - nNeg++; - } - return result; -} - -int main() { - int number,numDozens; - std::cout << "Enter number to reverse: "; - std::cin >> number; - for (int i = 1; pow(10,i) <= number; i++) { - numDozens = i; - } - numDozens++; - std::cout << Reverser(number, numDozens); - - return 0; -} -/* -* vector , -* cin.peek() cin.get() isdigit -#include -#include - -void revers() { - char ch; - vector digits; - - std::cout << "Enter number: "; - - while (cin.peek() != '\n') { - ch = cin.get(); - if (isdigit(ch)) { - digits.push_back(ch - '0'); - } - } - for (int i = digits.size() - 1; i >= 0; --i) { - std::cout << digits[i]; - } - std::cout << std::endl; -} - -int main() { - - revers(); - - return 0; -} -*/ \ No newline at end of file diff --git a/sem1/AlanMadreimov/MiniHomeWork2/task1.cpp b/sem1/AlanMadreimov/MiniHomeWork2/task1.cpp deleted file mode 100644 index 7dec047d..00000000 --- a/sem1/AlanMadreimov/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - - - -void TnumSys(long n, int base){ - char arr[16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; - if (n > 0) - { - TnumSys(n / base, base); - std::cout << arr[n % base]; - } -} - - -int main() { - - std::string instr,normalstr; - int type = 0; - bool iscorrect = 1; - std::cout << "Enter number: " - std::cin >> instr; - - for (int i = 0; i < instr.length(); i++) { - if (isdigit(instr[i])) { - normalstr += instr[i]; - } - else { - if (iscorrect) { - std::cout << "I think you meant this number :"; - iscorrect = 0; - } - } - } - - if (!iscorrect) { - std::cout << normalstr << std::endl; - } - - while (type != 8 and type != 16) { - std::cout << "Please enter the desired measurement system (8 or 16): "; - std::cin >> type; - if (type != 8 and type != 16) { - std::cout << "Number systems 8 or 16!" << std::endl; - } - } - - long num = stoi(normalstr); - TnumSys(num, type); - - - return 0; -} diff --git a/sem1/AlanMadreimov/MiniHomeWork2/task2.cpp b/sem1/AlanMadreimov/MiniHomeWork2/task2.cpp deleted file mode 100644 index 7fbdd9c5..00000000 --- a/sem1/AlanMadreimov/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include - - - -int SirakuzGip(long n) { - if (n == 1) { - return 1; - } - else if (n % 2 == 0) { - return SirakuzGip(n / 2); - } - else { - return SirakuzGip((n * 3 + 1) / 2); - } -} - -/*void Test() { - for (int i = 1; i < 100000; i++) { - std::cout << SirakuzGip(i) << " "; - } -} -*/ - -int main() { - - std::string instr,digitstr; - long n = -1; - - while (n <= 0) { - std::cout << "Enter a natural number: "; - std::cin >> instr; - - for (int i = 0; i < instr.length(); i++) { - if (isdigit(instr[i])) { - digitstr += instr[i]; - } - } - n = stoi(digitstr); - - if (n <= 0) { - std::cout << "You entered a non-natural number" << std::endl; - } - - } - std::cout << SirakuzGip(n); - - - return 0; -} \ No newline at end of file diff --git a/sem1/AlanMadreimov/minihomework3/Minihomework3.cpp b/sem1/AlanMadreimov/minihomework3/Minihomework3.cpp deleted file mode 100644 index e7c4a6de..00000000 --- a/sem1/AlanMadreimov/minihomework3/Minihomework3.cpp +++ /dev/null @@ -1,307 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase { -private: - double price; - double weight; - std::string name; - - -public: - - ItemBase(double price, double weight, std::string name) { - this->price = price; - this->weight = weight; - this->name = name; - } - ItemBase() { - - } - - void print_item_data() { - std::cout << "Item: " << name << " Price: " << price << "$" << " Weight: " << weight << "kg"; - } - - double get_price() { - return price; - } - - double get_weight() { - return weight; - } -}; - -class shop { -private: - std::string name; - std::vector items; - -public: - double AVweight; - double AVprice; - - - shop() { - - } - shop(std::string name) { - this->name = name; - } - virtual void add_items() { - } - - void print_name() { - std::cout << "Shop: " << name << "\n"; - } - - void print_stat() { - std::cout << "Average price: " << AVprice << "$ Average weight of goods: " << AVweight << "kg" << "\n"; - } - - void print_all_items() { - for (int i = 0; i < items.size(); i++) { - items[i].print_item_data(); - std::cout << "\n"; - } - } - - - -}; - -class Item_PC : public ItemBase { -private: - double infn; - std::string info; -public: - Item_PC(double price, double weight, std::string name, std::string info, double infn) - : ItemBase(price, weight, name) - { - this->infn = infn; - this->info = info; - } - void print_item_data() - { - if (info == "FPS") { - ItemBase::print_item_data(); - std::cout << " FPS: " << infn; - } - else if (info == "GHz") { - ItemBase::print_item_data(); - std::cout << " Processor frequency: " << infn << "GHz"; - } - else { - ItemBase::print_item_data(); - std::cout << " Memory " << infn << " GB"; - } - } -}; - -class pc_shop : public shop { -private: - std::vector items; -public: - using shop::shop; - - void print_all_items() { - pc_shop::print_name(); - for (int i = 0; i < items.size(); i++) { - items[i].print_item_data(); - std::cout << "\n"; - } - } - void add_items(std::vector items) { - double t_price = 0; - double t_weight = 0; - short int cnt = 0; - for (int i = 0; i < items.size(); i++) { - this->items.push_back(items[i]); - t_price += items[i].get_price(); - t_weight += items[i].get_weight(); - cnt++; - } - AVprice = t_price / cnt; - AVweight = t_weight / cnt; - - - } -}; - -class Item_Book : public ItemBase { -private: - int year; - std::string writer; -public: - Item_Book(double price, double weight, std::string name, std::string writer, int year) - : ItemBase(price, weight, name) - { - this->year = year; - this->writer = writer; - } - void print_item_data() - { - ItemBase::print_item_data(); - std::cout << " Writer: " << writer << " Year of creation: " << year; - - } -}; - -class book_shop : public shop { -private: - std::vector items; -public: - using shop::shop; - - void print_all_items() { - book_shop::print_name(); - for (int i = 0; i < items.size(); i++) { - items[i].print_item_data(); - std::cout << "\n"; - } - } - void add_items(std::vector items) { - double t_price = 0; - double t_weight = 0; - short int cnt = 0; - for (int i = 0; i < items.size(); i++) { - this->items.push_back(items[i]); - t_price += items[i].get_price(); - t_weight += items[i].get_weight(); - cnt++; - } - AVprice = t_price / cnt; - AVweight = t_weight / cnt; - - - } -}; - -class Item_Fruit : public ItemBase { -private: - std::string vit1; - std::string vit2; -public: - Item_Fruit(double price, double weight, std::string name, std::string vit1, std::string vit2) - : ItemBase(price, weight, name) - { - this->vit1 = vit1; - this->vit2 = vit2; - } - void print_item_data() - { - ItemBase::print_item_data(); - std::cout << " Vitamins: " << vit1 << " " << vit2; - - } -}; - -class fruit_shop : public shop { -private: - std::vector items; -public: - using shop::shop; - - void print_all_items() { - fruit_shop::print_name(); - for (int i = 0; i < items.size(); i++) { - items[i].print_item_data(); - std::cout << "\n"; - } - } - void add_items(std::vector items) { - double t_price = 0; - double t_weight = 0; - short int cnt = 0; - for (int i = 0; i < items.size(); i++) { - this->items.push_back(items[i]); - t_price += items[i].get_price(); - t_weight += items[i].get_weight(); - cnt++; - } - AVprice = t_price / cnt; - AVweight = t_weight / cnt; - - - } -}; - -int main() { - setlocale(LC_ALL, "Russian"); - std::ifstream in("D:\\C++Projects\\Minihomework3\\shops.txt"); - std::string str; - - std::string i_name; - double price; - double weight; - std::string inf; - std::string dop_inf; - double dop; - - std::vector pc; - std::vector books; - std::vector fruits; - - std::getline(in, str); - pc_shop pcstore(str); - - for (int i = 0; i < 5;i++) { - std::getline(in, str); - std::stringstream ss(str); - ss >> i_name; - ss >> price; - ss >> weight; - ss >> inf; - ss >> dop; - Item_PC n(price,weight,i_name,inf,dop); - pc.push_back(n); - } - pcstore.add_items(pc); - - std::getline(in, str); - fruit_shop frstore(str); - - for (int i = 0; i < 5; i++) { - std::getline(in, str); - std::stringstream ss(str); - ss >> i_name; - ss >> price; - ss >> weight; - ss >> inf; - ss >> dop; - Item_Fruit n(price,weight,i_name,inf,dop_inf); - fruits.push_back(n); - } - frstore.add_items(fruits); - - std::getline(in, str); - book_shop bkstore(str); - - for (int i = 0; i < 5; i++) { - std::getline(in, str); - std::stringstream ss(str); - ss >> i_name; - ss >> price; - ss >> weight; - ss >> inf; - ss >> dop; - Item_Book n(price,weight,i_name,inf,dop); - books.push_back(n); - } - bkstore.add_items(books); - - pcstore.print_all_items(); - pcstore.print_stat(); - - frstore.print_all_items(); - frstore.print_stat(); - - bkstore.print_all_items(); - bkstore.print_stat(); - - - return 0; -} \ No newline at end of file diff --git a/sem1/AlanMadreimov/minihomework3/shops.txt b/sem1/AlanMadreimov/minihomework3/shops.txt deleted file mode 100644 index fe14d9d7..00000000 --- a/sem1/AlanMadreimov/minihomework3/shops.txt +++ /dev/null @@ -1,18 +0,0 @@ -Nvideo -NVIDIA6090 10000 10 FPS 600 -NVIDIA5090 9999 9 FPS 500 -IntelCPU 300 1 GHz 3.5 -AMDCPU 250 1.5 GHz 3.2 -KingstonRAM 100 0.2 Size 16GB -Bazar -Banana 3 1 Vitamins Ka Ca -Apple 2 1 Vitamins C -Grapes 5 0.5 Sugar 15g -Orange 4 1 Vitamins C -Pineapple 6 2 Vitamins C B6 -UBooks -GameDevInOurLive 15 0.5 A.Y.Madreimov 2020 -GDSecrets 20 0.8 S.A.Margarita 2022 -NotToday 25 0.6 M.A.Buk 2012 -SevenHours 30 1 A.S.Pushkin 2018 -KimchiHow 10 0.4 S.U.Kim 2024 \ No newline at end of file diff --git a/sem1/AlexanderAnglichaninov/minihomework1/task1.cpp b/sem1/AlexanderAnglichaninov/minihomework1/task1.cpp deleted file mode 100644 index 891cd507..00000000 --- a/sem1/AlexanderAnglichaninov/minihomework1/task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -double SArea(double a) { - double result = a * a; - return result; -} - -int main() { - double a; - std::cin >> a; - std::cout << SArea(a); - return 0; -} \ No newline at end of file diff --git a/sem1/AlexanderAnglichaninov/minihomework1/task2.cpp b/sem1/AlexanderAnglichaninov/minihomework1/task2.cpp deleted file mode 100644 index d756683c..00000000 --- a/sem1/AlexanderAnglichaninov/minihomework1/task2.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -double TArea(double a, double b, double h) { - double result = ((a + b) / 2.0) * h; - return result; -} - -int main() { - double a, b, h; - std::cout << "Введите длину основания а, длину основания b, и высоту трапеции h через пробел:" << std::endl; - std::cin >> a >> b >> h; - std::cout << TArea(a, b, h); - return 0; -} \ No newline at end of file diff --git a/sem1/AlexanderAnglichaninov/minihomework1/task3.cpp b/sem1/AlexanderAnglichaninov/minihomework1/task3.cpp deleted file mode 100644 index fc5a4b66..00000000 --- a/sem1/AlexanderAnglichaninov/minihomework1/task3.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -void Fibonacci(int n) { - int a = 0, b = 1, c; - for (int i = 0; i < n; i++) { - std::cout << a << " "; - c = a + b; - a = b; - b = c; - } -} - -int main() { - int n; - std::cin >> n; - Fibonacci(n); - return 0; -} \ No newline at end of file diff --git a/sem1/AlexanderAnglichaninov/minihomework1/task4.cpp b/sem1/AlexanderAnglichaninov/minihomework1/task4.cpp deleted file mode 100644 index ee4a2367..00000000 --- a/sem1/AlexanderAnglichaninov/minihomework1/task4.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int ReverseOrder(int n) { - int new_num = 0; - while (n != 0) { - new_num = new_num * 10 + n % 10; - n /= 10; - } - return new_num; -} - -int main() -{ - int num = 0; - std::cin >> num; - std::cout << ReverseOrder(num); - return 0; -} \ No newline at end of file diff --git a/sem1/AlexanderAnglichaninov/minihomework2/task1.cpp b/sem1/AlexanderAnglichaninov/minihomework2/task1.cpp deleted file mode 100644 index 8fcb1ff3..00000000 --- a/sem1/AlexanderAnglichaninov/minihomework2/task1.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include - - -void numTo16(int num) { - char a[] = "0123456789ABCDEF"; - char result[32]; - int index = 0; - int oldNum = num; - - if (num == 0) { - std::cout << "0" << std::endl; - return; - } - - while (num > 0) { - result[index++] = a[num % 16]; - num /= 16; - } - - std::cout << "Число " << oldNum << " в шестнадцатеричной сс: "; - for (int i = index - 1; i >= 0; i--) { - std::cout << result[i]; - } - std::cout << std::endl; - return; -} - - -void numTo8(int num) { - char result[32]; - int index = 0; - int oldNum = num; - - if (num == 0) { - std::cout << "0" << std::endl; - return; - } - - while (num > 0) { - result[index++] = (num % 8) + '0'; - num /= 8; - } - - std::cout << "Число " << oldNum << " в восьмеричной сс: "; - for (int i = index - 1; i >= 0; i--) { - std::cout << result[i]; - } - std::cout << std::endl; - return; -} - - -int main() { - int choice, num; - - do { - std::cout << "Меню преобразования:\n"; - std::cout << "1. Преобразовать в шестнадцатеричную систему\n"; - std::cout << "2. Преобразовать в восьмеричную систему\n"; - std::cout << "3. Выйти\n"; - std::cout << "Выберите действие: "; - std::cin >> choice; - - if (choice == 3) { - std::cout << "Выход из программы." << std::endl; - break; - } - - std::cout << "Введите десятичное число: "; - std::cin >> num; - - switch (choice) { - case 1: - numTo16(num); - break; - case 2: - numTo8(num); - break; - default: - std::cout << "Неверный выбор, попробуйте снова." << std::endl; - } - - std::cout << std::endl; - } while (choice != 3); - - return 0; -} diff --git a/sem1/AlexanderAnglichaninov/minihomework2/task2.cpp b/sem1/AlexanderAnglichaninov/minihomework2/task2.cpp deleted file mode 100644 index d74772e1..00000000 --- a/sem1/AlexanderAnglichaninov/minihomework2/task2.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - - -void syracuse(int num) { - while (num != 1) { - if (num % 2 == 0) { - num /= 2; - } else { - num = num * 3 + 1; - } - std::cout << num << " "; - } -} - - -int main() { - int num; - - std::cout << "Введите натуральное число: "; - std::cin >> num; - - if (num <= 0) { - std::cout << "Ошибка: ты не знаешь, что такое натуральное число? Серьёзно?... (Просто введи число больше 0...)." << std::endl; - } else { - syracuse(num); - } - - return 0; -} diff --git a/sem1/ArtemLoskutov/MiniHomework_1/Task_1.cpp b/sem1/ArtemLoskutov/MiniHomework_1/Task_1.cpp deleted file mode 100644 index 24bc8c2b..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_1/Task_1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - - - -float area(float side) -{ - return side * side; -} - - - -int main() -{ - float side; - std::cout << "Enter the length of side of the square: "; - std::cin >> side; - std::cout << "Area = " << area(side); -} diff --git a/sem1/ArtemLoskutov/MiniHomework_1/Task_2.cpp b/sem1/ArtemLoskutov/MiniHomework_1/Task_2.cpp deleted file mode 100644 index baaaf338..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_1/Task_2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - - - -float area(float base_1, float base_2, float height) -{ - return (base_1 + base_2) * 0.5 * height; -} - - - -int main() -{ - float base_1, base_2, height; - std::cout << "Enter the length of the first base of the trapezoid: "; - std::cin >> base_1; - std::cout << "Enter the length of the second base of the trapezoid: "; - std::cin >> base_2; - std::cout << "Enter the height of a trapezoid: "; - std::cin >> height; - std::cout << "Area = " << area(base_1, base_2, height); -} diff --git a/sem1/ArtemLoskutov/MiniHomework_1/Task_3.cpp b/sem1/ArtemLoskutov/MiniHomework_1/Task_3.cpp deleted file mode 100644 index 09ff8515..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_1/Task_3.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - - - -int main() -{ - long int n, a = 1, b = 1; - std::cout << "Enter the desired number of Fibonacci series elements: "; - std::cin >> n; - - while (n > 0) - { - std::cout << a << std::endl; - if (n != 1) - { - std::cout << b << std::endl; - } - - a = a + b; - b = b + a; - n = n - 2; - } -} diff --git a/sem1/ArtemLoskutov/MiniHomework_1/Task_4.cpp b/sem1/ArtemLoskutov/MiniHomework_1/Task_4.cpp deleted file mode 100644 index e4c06f59..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_1/Task_4.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - - - -int main() -{ - unsigned long int number, reverse; - std::cout << "Enter the number: "; - std::cin >> number; - - reverse = number % 10; - number /= 10; - while (number > 0) - { - reverse = reverse * 10 + number % 10; - number /= 10; - } - std::cout << "Reverse = " << reverse; -} diff --git a/sem1/ArtemLoskutov/MiniHomework_2/Task_1.cpp b/sem1/ArtemLoskutov/MiniHomework_2/Task_1.cpp deleted file mode 100644 index b1016946..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_2/Task_1.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - - - -int main() -{ - std::cout << "To stop write -1" << std::endl; - while (true) - { - unsigned int number; - std::cout << "Write the number to convert to 8 and 16 number systems: "; - std::cin >> number; - if (number == -1) break; - std::cout << "In octal number system: " << std::oct << number << std::endl; - std::cout << "In hexadecimal number system: " << std::hex << number << std::endl << std::endl; - } -} diff --git a/sem1/ArtemLoskutov/MiniHomework_2/Task_2.cpp b/sem1/ArtemLoskutov/MiniHomework_2/Task_2.cpp deleted file mode 100644 index 23231b30..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_2/Task_2.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - - - -int main() -{ - unsigned int number; - std::cout << "Enter a number to test the Syracuse hypothesis: "; - std::cin >> number; - while (number > 1) - { - if (number % 2 == 0) - { - number /= 2; - std::cout << number << std::endl; - } - else - { - number = (number * 3 + 1) / 2; - std::cout << number << std::endl; - } - } -} diff --git a/sem1/ArtemLoskutov/MiniHomework_3/shops.txt b/sem1/ArtemLoskutov/MiniHomework_3/shops.txt deleted file mode 100644 index 3904adcc..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_3/shops.txt +++ /dev/null @@ -1,21 +0,0 @@ -shop 5ka -items 5 -apple 80rub 200gr -banana 100rub 200gr -coconut 120rub 500gr -water 60rub 500gr -tomato 90rub 300gr -shop BMW -items 5 -car 1000000rub 1000kg -car 2000000rub 1200kg -car 2500000rub 1100kg -car 3000000rub 1500kg -car 5000000rub 1500kg -shop Samsung -items 5 -phone 19999rub 200gr -laptop 29999rub 2000gr -tv 49999rub 16000gr -K9_Thunder 370883317rub 47000000gr -clock 69999rub 50gr diff --git a/sem1/ArtemLoskutov/MiniHomework_3/task_1.cpp b/sem1/ArtemLoskutov/MiniHomework_3/task_1.cpp deleted file mode 100644 index 9a87e3ed..00000000 --- a/sem1/ArtemLoskutov/MiniHomework_3/task_1.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include -#include -#include - -class ShopBase -{ -public: - int all_items = 0; - std::string name; - - void set_name(std::string n) { name = n; }; - void set_all_items(int i) { all_items = i; }; -}; -class CustomShop : public ShopBase -{ -public: - int full_cost = 0; - int full_weight = 0; - - void set_full_cost(int fc) { full_cost = full_cost + fc; }; - void set_full_weight(int fw) { full_weight = full_weight + fw; }; - void print() const - { - std::cout << "Name: " << name << ", items: " << all_items << std::endl; - } -}; -std::vector shops; -class Item -{ -public: - std::string shop_name; - std::string name; - std::string cost; - std::string weight; - - void set_shop_name(std::string s) { shop_name = s; } - void set_name(std::string n) { name = n; } - void set_cost(std::string c) { cost = c; } - void set_weight(std::string w) { weight = w; } - void print() const - { - std::cout << "Shop name: " << shop_name << ", name: " << name << ", cost: " << cost << ", weight: " << weight << std::endl; - } -}; -std::vector items; - -void pull(); -void mid(); - -int main() -{ - pull(); - mid(); -} - -void pull() -{ - std::string line; - std::ifstream file("shops.txt"); - - if (file.is_open()) - { - short int number = -1; - while (std::getline(file, line)) - { - if (line.substr(0, 4) == "shop") - { - CustomShop shop; - shop.set_name(line.substr(4)); - shops.push_back(shop); - number += 1; - } - if (line.substr(0, 5) == "items") - { - shops[number].set_all_items(std::stoi(line.substr(5))); - } - if (line.substr(0, 4) != "shop" and line.substr(0, 5) != "items") - { - Item item; - - for (int i = 0, cursor = 0; i < line.length(); i++) - { - if (line[i] == ' ' and cursor != 0 and item.cost == "") - { - item.set_cost(line.substr(cursor, i - cursor -1)); - item.set_weight(line.substr(i)); - } - if (line[i] == ' ' and cursor == 0) - { - cursor = i; - item.set_name(line.substr(0, cursor)); - } - } - item.set_shop_name(shops[number].name); - items.push_back(item); - } - } - } -} -void mid() -{ - for (int i = 0; i < shops.size(); i++) - { - for (int j = 0; j < items.size(); j++) - { - if (items[j].shop_name == shops[i].name) - { - shops[i].set_full_cost(stoi(items[j].cost)); - shops[i].set_full_weight(stoi(items[j].weight)); - } - } - } - - for (int i = 0; i < shops.size(); i++) - { - std::cout << "Shop" << shops[i].name << std::endl; - std::cout << "Mid cost = " << shops[i].full_cost / shops[i].all_items << std::endl; - std::cout << "Mid weight = " << shops[i].full_weight / shops[i].all_items << std::endl; - } -} \ No newline at end of file diff --git a/sem1/Arzumanyan Sofia/MiniHomework1/minitask1.cpp b/sem1/Arzumanyan Sofia/MiniHomework1/minitask1.cpp deleted file mode 100644 index 548b55b4..00000000 --- a/sem1/Arzumanyan Sofia/MiniHomework1/minitask1.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() { - int q; - std::cin >> q; - std::cout << q * q; - -} \ No newline at end of file diff --git a/sem1/Arzumanyan Sofia/MiniHomework1/minitask2.cpp b/sem1/Arzumanyan Sofia/MiniHomework1/minitask2.cpp deleted file mode 100644 index 9f4e29be..00000000 --- a/sem1/Arzumanyan Sofia/MiniHomework1/minitask2.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main() { - int q; int r; int w; - std::cin >> q; - std::cin >> r; - std::cin >> w; - std::cout << (q + r) * w / 2; - -} diff --git a/sem1/Arzumanyan Sofia/MiniHomework1/minitask3.cpp b/sem1/Arzumanyan Sofia/MiniHomework1/minitask3.cpp deleted file mode 100644 index ca6f9a75..00000000 --- a/sem1/Arzumanyan Sofia/MiniHomework1/minitask3.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() { - int q = 0; int w = 1; int e = 0; int r; int y = 0; - std::cin >> r; - - while (y < r) { - q = w; - w = e; - e = q + w; - std::cout << e << " "; - y++; - } - -} \ No newline at end of file diff --git a/sem1/Arzumanyan Sofia/MiniHomework1/minitask4.cpp b/sem1/Arzumanyan Sofia/MiniHomework1/minitask4.cpp deleted file mode 100644 index 4e6640e1..00000000 --- a/sem1/Arzumanyan Sofia/MiniHomework1/minitask4.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main() { - int q = 0; - int w = 0; - std::cin >> q; - while (q > 0) { - w = w * 10; - w += q % 10; - q = q / 10; - - } - std::cout << w; -} \ No newline at end of file diff --git a/sem1/Arzumanyan Sofia/MiniHomework2/minitask1.cpp b/sem1/Arzumanyan Sofia/MiniHomework2/minitask1.cpp deleted file mode 100644 index 219b982a..00000000 --- a/sem1/Arzumanyan Sofia/MiniHomework2/minitask1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -void intTOoct() { - int x; - std::cin >> x; - std::cout << std::setbase(8) << x << std::endl; - - return; -} - -void intTOhex() { - int x; - std::cin >> x; - std::cout << "0x" << std::hex << x << std::endl; - - return; -} - - -int main() { - - int choice; - - std::cout << "Choose func" << std::endl; - std::cout << "1. Oct" << std::endl; - std::cout << "2. Hex" << std::endl; - std::cout << "exit" << std::endl; - - if (choice == 1) { - intTOoct(); - } - else if (choice == 2) { - intTOhex(); - } - else { - std::cout << "error:(" << std::endl; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/Arzumanyan Sofia/MiniHomework2/minitask2.cpp b/sem1/Arzumanyan Sofia/MiniHomework2/minitask2.cpp deleted file mode 100644 index 25e9d688..00000000 --- a/sem1/Arzumanyan Sofia/MiniHomework2/minitask2.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -void Sirakuzzzz(int x) { - while (x != 1) { - if (x % 2 == 0) { - x /= 2; - } - else { - x = x * 3 + 1; - - } - std::cout << x << std::endl; - - } -} - - int main() { - - int x; - std::cout << "Enter natural number"; - std::cin >> x; - if (x <= 0) { - std::cout << "again.. NATURAL NUMBER"; - } - else { - Sirakuzzzz(x); - } - - return 0; -} diff --git "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.1.cpp" "b/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.1.cpp" deleted file mode 100644 index bc5dcdee..00000000 --- "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.1.cpp" +++ /dev/null @@ -1,15 +0,0 @@ -#include - -//Сначала создадим функцию нахождения площади квадрата -int A_quadrate(int a){ - return a * a; -} - -//Теперь проверим её работоспособность -int main() { - std::cout << "Enter side of quadrate: " << std::endl; - int side = 0; - std::cin >> side; - int a = side; - std::cout << "Area of the square = " << A_quadrate(a) << std::endl; -} \ No newline at end of file diff --git "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.2.cpp" "b/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.2.cpp" deleted file mode 100644 index effc81c0..00000000 --- "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.2.cpp" +++ /dev/null @@ -1,23 +0,0 @@ -#include - -//Созданим функцию нахождения площади трапеции -int Area_trapezoid(int a, int b, int h) { - return (a + b) * h / 2; -} - -//Проверяем функцию -int main() { - std::cout << "Enter fisrt base of trapezoid" << std::endl; - int base_1 = 0; - std::cin >> base_1; - int a = base_1; - std::cout << "Enter second base of trapezoid" << std::endl; - int base_2 = 0; - std::cin >> base_2; - int b = base_2; - std::cout << "Enter height of trapezoid" << std::endl; - int height = 0; - std::cin >> height; - int h = height; - std::cout << "Area of the trapezoid = " << Area_trapezoid(a, b, h) << std::endl; -} diff --git "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.3.cpp" "b/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.3.cpp" deleted file mode 100644 index 114b68a2..00000000 --- "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.3.cpp" +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main() { - std::cout << "Enter number of elements" << std::endl; - int N = 0; - std::cin >> N; - int a = 0; - int b = 1; - int c = 0; - std::cout << "Fibonacci numbers: " << 0 << " " << 1 << " "; - for (int count_elements = 2; count_elements < N; ++count_elements) { - c = a + b; - a = b; - b = c; - std::cout << c << " "; - } -} \ No newline at end of file diff --git "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.4.cpp" "b/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.4.cpp" deleted file mode 100644 index 762192fd..00000000 --- "a/sem1/BakaldinKirill/MiniHomeWork1/MiniHW\342\204\2261.4.cpp" +++ /dev/null @@ -1,20 +0,0 @@ -#include - -//сделаем функцию -int number2reverse(int N) { - int rev = 0; - while (N > 0) { - rev *= 10; - rev += N % 10; - N /= 10; - } - return rev; -} -//проверяем работу, не выводит числа 10, 20, ... и тд, как 01, 02, ... и тд., т.к при сложение с 0 число не изменяется, нужен стринг либо использование массивов -int main() { - std::cout << "Enter a number" << std::endl; - int rev = 0; - std::cin >> rev; - int check = 0; - std::cout << "Your reverse number = " << number2reverse(rev) << std::endl; -} \ No newline at end of file diff --git "a/sem1/BakaldinKirill/MiniHomeWork2/MiniHW\342\204\2262.1.cpp" "b/sem1/BakaldinKirill/MiniHomeWork2/MiniHW\342\204\2262.1.cpp" deleted file mode 100644 index e326ead6..00000000 --- "a/sem1/BakaldinKirill/MiniHomeWork2/MiniHW\342\204\2262.1.cpp" +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int main() -{ - int n1, n2; - std::cout << "Enter the number to convert to hex - "; - std::cin >> n1; - std::cout << std::hex << n1 << std::endl; - std::cout << "Enter the number to convert to oct - "; - std::cin >> n2; - std::cout << std::oct << n2 << std::endl; -} - diff --git "a/sem1/BakaldinKirill/MiniHomeWork2/MiniHW\342\204\2262.2.cpp" "b/sem1/BakaldinKirill/MiniHomeWork2/MiniHW\342\204\2262.2.cpp" deleted file mode 100644 index 96f238d7..00000000 --- "a/sem1/BakaldinKirill/MiniHomeWork2/MiniHW\342\204\2262.2.cpp" +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main() { - std::cout << "Enter natural number - "; - int Nat_N; - std::cin >> Nat_N; - - int res = Nat_N; - while (res != 1) { - std::cout << res << " "; // Вывод текущего значения каждой итерации - if (res % 2 == 0) { // Если число четное - res /= 2; - } - else { // Если число нечетное - res = res * 3 + 1; - } - } - std::cout << res << std::endl; // Вывод последнего значения, равного 1 - - return 0; -} \ No newline at end of file diff --git a/sem1/BakaldinKirill/MiniHomeWork3/MiniHomeWork3.cpp b/sem1/BakaldinKirill/MiniHomeWork3/MiniHomeWork3.cpp deleted file mode 100644 index 00aebae4..00000000 --- a/sem1/BakaldinKirill/MiniHomeWork3/MiniHomeWork3.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase { -public: - double getPrice() const { return 0.0; }; - double getWeight() const { return 0.0; }; -}; - -class Item : public ItemBase { -private: - std::string name; - double price; - double weight; - -public: - Item(std::string name, double price, double weight) - : name(name), price(price), weight(weight) {} - - double getPrice() const { return price; } - double getWeight() const { return weight; } - - std::string getName() const { return name; } -}; - -class Shop { -private: - std::string name; - std::vector items; - -public: - Shop(std::string name) : name(name) {} - - void addItem(Item item) { - items.push_back(item); - } - - double averagePrice() const { - if (items.empty()) return 0.0; - double totalPrice = 0.0; - for (Item item : items) { - totalPrice += item.getPrice(); - } - return totalPrice / items.size(); - } - - double averageWeight() const { - if (items.empty()) return 0.0; - double totalWeight = 0.0; - for (Item item : items) { - totalWeight += item.getWeight(); - } - return totalWeight / items.size(); - } - - std::string getName() const { return name; } -}; - -std::vector parseShopsFromFile(std::string filename) { - std::vector shops; - std::ifstream file(filename); - - if (!file.is_open()) { - std::cerr << "Error opening file.\n"; - return shops; - } - - std::string line, shopName; - int itemCount = 0; - - while (std::getline(file, line)) { - std::istringstream iss(line); - std::string word; - iss >> word; - - if (word == "Shop") { - iss >> shopName; - shops.emplace_back(shopName); - } - else if (word == "Items") { - iss >> itemCount; - } - else { - std::string itemName = word; - double price, weight; - iss >> price >> weight; - Item item(itemName, price, weight); - shops.back().addItem(item); - } - } - - file.close(); - return shops; -} - -int main() { - std::string filename = "shops.txt"; - std::vector shops = parseShopsFromFile(filename); - - for (Shop shop : shops) { - std::cout << "Shop: " << shop.getName() << "\n"; - std::cout << "Average Price: " << shop.averagePrice() << "\n"; - std::cout << "Average Weight: " << shop.averageWeight() << "\n\n"; - } - - return 0; -} diff --git a/sem1/BakaldinKirill/MiniHomeWork3/shops.txt b/sem1/BakaldinKirill/MiniHomeWork3/shops.txt deleted file mode 100644 index 0d9cf573..00000000 --- a/sem1/BakaldinKirill/MiniHomeWork3/shops.txt +++ /dev/null @@ -1,24 +0,0 @@ -Shop ClothingStore -Items 5 -TShirt 15.99 0.2 -Jeans 45.50 0.6 -Jacket 89.99 1.2 -Sneakers 59.99 0.8 -Hat 12.99 0.1 -Jeans 33.50 1.3 - -Shop GroceryStore -Items 5 -Milk 1.50 1.0 -Bread 1.00 0.5 -Cheese 5.75 0.3 -Chicken 8.99 1.5 -Apple 0.99 0.2 - -Shop MovieDiscStore -Items 5 -ActionMovie 14.99 0.1 -RomanticComedy 9.99 0.1 -SciFiMovie 12.49 0.1 -HorrorMovie 10.99 0.1 -Documentary 8.99 0.1 \ No newline at end of file diff --git a/sem1/BashkovIvan/MiniHomework1/1.cpp b/sem1/BashkovIvan/MiniHomework1/1.cpp deleted file mode 100644 index cbb6495d..00000000 --- a/sem1/BashkovIvan/MiniHomework1/1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -float squareArea (float side) { - return side * side; -} - -int main() { - float side; - std::cout << "Please, enter the side of the square:" << std::endl; - std::cin >> side; - std::cout << "The area of the square: " << squareArea(side); -} \ No newline at end of file diff --git a/sem1/BashkovIvan/MiniHomework1/2.cpp b/sem1/BashkovIvan/MiniHomework1/2.cpp deleted file mode 100644 index aeb985dc..00000000 --- a/sem1/BashkovIvan/MiniHomework1/2.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include - -void trapezoidArea1() { - float base1, base2, height; - std::cout << "Please, enter the first base:" << std::endl; - std::cin >> base1; - std::cout << "Please, enter the second base:" << std::endl; - std::cin >> base2; - std::cout << "Please, enter the height:" << std::endl; - std::cin >> height; - std::cout << "The area of the trapezoid: " << height * (base1 + base2) * 0.5; -} - -void trapezoidArea2() { - float midline, height; - std::cout << "Please, enter the midline:" << std::endl; - std::cin >> midline; - std::cout << "Please, enter the height:" << std::endl; - std::cin >> height; - std::cout << "The area of the trapezoid: " << midline * height; -} - -void trapezoidArea3() { - float diagonal1, diagonal2, sine; - std::cout << "Please, enter the first diagonal:" << std::endl; - std::cin >> diagonal1; - std::cout << "Please, enter the second diagonal:" << std::endl; - std::cin >> diagonal2; - std::cout << "Please, enter the sine of the angle between the diagonals:" << std::endl; - std::cin >> sine; - std::cout << "The area of the trapezoid: " << diagonal1 * diagonal2 * sine * 0.5; -} - -int main() { - int choice; - std::cout << "If you want to find the area of the trapezoid using two bases and the height, please, enter 1" << std::endl; - std::cout << "If you want to find the area of the trapezoid using the midline and the height, please, enter 2" << std::endl; - std::cout << "If you want to find the area of the trapezoid using two diagonals and the angle between them, please, enter 3" << std::endl; - std::cin >> choice; - if (choice == 1) { - trapezoidArea1(); - } - else if (choice == 2) { - trapezoidArea2(); - } - else if (choice == 3) { - trapezoidArea3(); - } - else { - std::cout << "You must have made a mistake. Please, rerun the program."; - } -} \ No newline at end of file diff --git a/sem1/BashkovIvan/MiniHomework1/3.cpp b/sem1/BashkovIvan/MiniHomework1/3.cpp deleted file mode 100644 index 63f97adc..00000000 --- a/sem1/BashkovIvan/MiniHomework1/3.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -void fibonacciSequence(long long int N) { - int currentElem, prepreviousElem = 0, previousElem = 1, currentNumber = 0; - while (currentNumber < N) { - if (currentNumber == 0) { - std::cout << 1; - } - else { - currentElem = prepreviousElem + previousElem; - std::cout << " " << currentElem; - prepreviousElem = previousElem; - previousElem = currentElem; - } - currentNumber++; - } -} - -int main() { - long long int N; - std::cout << "Please, enter N:" << std::endl; - std::cin >> N; - std::cout << "First " << N << " numbers of the Fibonacci sequence:" << std::endl; - fibonacciSequence(N); -} \ No newline at end of file diff --git a/sem1/BashkovIvan/MiniHomework1/4.cpp b/sem1/BashkovIvan/MiniHomework1/4.cpp deleted file mode 100644 index 01a8b4cc..00000000 --- a/sem1/BashkovIvan/MiniHomework1/4.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -void numberReverse(long long int number) { - while (number > 0) { - std::cout << number % 10; - number = number / 10; - } -} - -int main() { - long long int number; - std::cout << "Please, enter the number you want to reverse:" << std::endl; - std::cin >> number; - std::cout << "Reversed number:" << std::endl; - numberReverse(number); -} \ No newline at end of file diff --git a/sem1/BashkovIvan/MiniHomework3/1.cpp b/sem1/BashkovIvan/MiniHomework3/1.cpp deleted file mode 100644 index 7161bc75..00000000 --- a/sem1/BashkovIvan/MiniHomework3/1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase { -public: - std::string name; - unsigned int price; - unsigned int mass; - - ItemBase(std::string name1, unsigned int price1, unsigned int mass1) { - name = name1; - price = price1; - mass = mass1; - } -}; - -class Electronics : public ItemBase { -public: - unsigned int fps; - - Electronics(std::string name, unsigned int price, unsigned int mass, unsigned int fps1) : ItemBase(name, price, mass) { - fps = fps1; - } -}; - -class Book : public ItemBase { -public: - unsigned int pageCount; - - Book(std::string name, unsigned int price, unsigned int mass, unsigned int pageCount1) : ItemBase(name, price, mass) { - pageCount = pageCount1; - } -}; - -class VinylRecord : public ItemBase { -public: - unsigned int duration; - - VinylRecord(std::string name, unsigned int price, unsigned int mass, unsigned int duration1) : ItemBase(name, price, mass) { - duration = duration1; - } -}; - -class Shop { -public: - std::string name; - std::vector items; - - Shop(std::string name1) { - name = name1; - } - - void addItem(ItemBase* item) { - items.push_back(item); - } - - int averagePrice() { - int sum = 0; - for (auto item : items) { - sum += item->price; - } - return sum / items.size(); - } - - int averageMass() { - int sum = 0; - for (auto item : items) { - sum += item->mass; - } - return sum / items.size(); - } - -}; - -std::vector parseFile(std::string filename) { - std::vector shops; - std::ifstream file(filename); - std::string line; - Shop* currentShop = nullptr; - - while (std::getline(file, line)) { - std::istringstream ss(line); - std::string word; - ss >> word; - if (word == "Shop") { - std::string shopName; - ss >> shopName; - shops.emplace_back(shopName); - currentShop = &shops.back(); - } - else if (word == "Items" && currentShop) { - int itemCount; - ss >> itemCount; - for (int i = 0; i < itemCount; ++i) { - std::getline(file, line); - std::istringstream itemStream(line); - std::string itemName; - unsigned int price, mass, additional; - itemStream >> itemName >> price >> mass >> additional; - - if (currentShop->name == "TechStore") { - currentShop->addItem(new Electronics(itemName, price, mass, additional)); - } - else if (currentShop->name == "BookStore") { - currentShop->addItem(new Book(itemName, price, mass, additional)); - } - else { - currentShop->addItem(new VinylRecord(itemName, price, mass, additional)); - } - } - } - } - - file.close(); - return shops; -} - -int main() { - std::vector shops = parseFile("data.txt"); - - for (Shop shop : shops) { - std::cout << "Shop: " << shop.name << "\n"; - std::cout << "Average Price: " << shop.averagePrice() << "\n"; - std::cout << "Average Mass: " << shop.averageMass() << "\n\n"; - } -} \ No newline at end of file diff --git a/sem1/BayanZhanatov/minihomework1/task1.cpp b/sem1/BayanZhanatov/minihomework1/task1.cpp deleted file mode 100644 index 2d1670c7..00000000 --- a/sem1/BayanZhanatov/minihomework1/task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a; - cout << " " << endl; - cin >> a; - cout << a * a; -} - diff --git a/sem1/BayanZhanatov/minihomework1/task2.cpp b/sem1/BayanZhanatov/minihomework1/task2.cpp deleted file mode 100644 index e4810503..00000000 --- a/sem1/BayanZhanatov/minihomework1/task2.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a; - int b; - int h; - cout << " " << endl; - cin >> a; - cout << " " << endl; - cin >> b; - cout << " " << endl; - cin >> h; - cout << ((a + b) * h) / 2; -} - diff --git a/sem1/BayanZhanatov/minihomework1/task3.cpp b/sem1/BayanZhanatov/minihomework1/task3.cpp deleted file mode 100644 index f183ad5a..00000000 --- a/sem1/BayanZhanatov/minihomework1/task3.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a = 0; - int b; - int c = 1; - int n; - cout << " " << endl; - cin >> n; - cout << c << " "; - for (int i = 0; i < n - 1; ++i) { - b = a + c; - a = c; - c = b; - cout << b << " "; - } -} - diff --git a/sem1/BayanZhanatov/minihomework1/task4.cpp b/sem1/BayanZhanatov/minihomework1/task4.cpp deleted file mode 100644 index dd1f1fac..00000000 --- a/sem1/BayanZhanatov/minihomework1/task4.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - int a = 0; - int b = 0; - cin >> a; - while (a > 0) { - b *= 10; - b += (a % 10); - a /= 10; - } - cout << b; -} - diff --git a/sem1/BayanZhanatov/minihomework2/task1.cpp b/sem1/BayanZhanatov/minihomework2/task1.cpp deleted file mode 100644 index 30f06d3d..00000000 --- a/sem1/BayanZhanatov/minihomework2/task1.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; -int main() { - setlocale(LC_ALL, "Russian"); - int a; - - cout << " ." << endl; - cin >> a; - - cout << " : "; - cout << std::oct << a << endl; - - cout << " : "; - cout << std::hex << a << endl; -} \ No newline at end of file diff --git a/sem1/BayanZhanatov/minihomework2/task2.cpp b/sem1/BayanZhanatov/minihomework2/task2.cpp deleted file mode 100644 index ed2f6802..00000000 --- a/sem1/BayanZhanatov/minihomework2/task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a; - cout << " : ." << endl; - cin >> a; - while (a != 1) { - if (a % 2 == 0) { - a /= 2; - } - else { - a = (a * 3 + 1) / 2; - } - cout << a << endl; - } -} - diff --git a/sem1/BayanZhanatov/minihomework3/shops.txt b/sem1/BayanZhanatov/minihomework3/shops.txt deleted file mode 100644 index 364632ac..00000000 --- a/sem1/BayanZhanatov/minihomework3/shops.txt +++ /dev/null @@ -1,13 +0,0 @@ -Shop Candy -Items 3 -Licorice 340 1000 -Bullseye 120 400 -Candycorn 60 580 -Shop ForPCs -Items 2 -NVIDIA6090 10000 10 -NVIDIA5090 9999 9 -Shop Fruits -Items 2 -Banana 34 15 -Apple 6 145 \ No newline at end of file diff --git a/sem1/BayanZhanatov/minihomework3/task1.cpp b/sem1/BayanZhanatov/minihomework3/task1.cpp deleted file mode 100644 index 7c285ed0..00000000 --- a/sem1/BayanZhanatov/minihomework3/task1.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase { -public: - virtual ~ItemBase() {} - virtual double getPrice() const = 0; - virtual double getWeight() const = 0; -}; - -class Item : public ItemBase { - std::string name; - double price; - double weight; - -public: - Item(const std::string& name, double price, double weight) - : name(name), price(price), weight(weight) {} - - double getPrice() const override { - return price; - } - - double getWeight() const override { - return weight; - } -}; - -class Shop { - std::string name; - std::vector items; - -public: - Shop(const std::string& name) : name(name) {} - - void addItem(const Item& item) { - items.push_back(item); - } - - double calculateAveragePrice() const { - double total = 0; - for (const auto& item : items) { - total += item.getPrice(); - } - return items.empty() ? 0 : total / items.size(); - } - - double calculateAverageWeight() const { - double total = 0; - for (const auto& item : items) { - total += item.getWeight(); - } - return items.empty() ? 0 : total / items.size(); - } - - std::string getName() const { - return name; - } -}; - -std::vector parseFile(const std::string& filename) { - std::ifstream file(filename); - std::string line; - std::vector shops; - - while (getline(file, line)) { - std::istringstream ss(line); - std::string shopHeader, shopName; - ss >> shopHeader >> shopName; - - if (shopHeader == "Shop") { - Shop shop(shopName); - - getline(file, line); - ss.clear(); - ss.str(line); - std::string itemsHeader; - int itemCount; - ss >> itemsHeader >> itemCount; - - for (int i = 0; i < itemCount; ++i) { - getline(file, line); - ss.clear(); - ss.str(line); - std::string itemName; - double price, weight; - ss >> itemName >> price >> weight; - Item item(itemName, price, weight); - shop.addItem(item); - } - shops.push_back(shop); - } - } - return shops; -} - -int main() { - std::string filename = "shops.txt"; - auto shops = parseFile(filename); - - for (const auto& shop : shops) { - std::cout << "Shop: " << shop.getName() << std::endl; - std::cout << "Average Price: " << shop.calculateAveragePrice() << std::endl; - std::cout << "Average Weight: " << shop.calculateAverageWeight() << std::endl; - } - - return 0; -} diff --git a/sem1/BazovoiiEvgenii/HW1/task 3.cpp b/sem1/BazovoiiEvgenii/HW1/task 3.cpp deleted file mode 100644 index 7bc7dd1a..00000000 --- a/sem1/BazovoiiEvgenii/HW1/task 3.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -#include - - -int main() -{ - int a = 0, b = 1, sum, i, n; - std::cout << "ENTER THE NUMBER N" << std::endl; - std::cin >> n; - - std::cout << std::endl << "FIBONACCI LIST" << std::endl; - std::cout << a << std::endl; - std::cout << b << std::endl; - for (i = 0; i < n; i++) { - sum = a + b; - std::cout << sum << std::endl; - a = b; - b = sum; - - } - return 0; - -} - diff --git a/sem1/BazovoiiEvgenii/HW1/task1.cpp b/sem1/BazovoiiEvgenii/HW1/task1.cpp deleted file mode 100644 index eeeb3807..00000000 --- a/sem1/BazovoiiEvgenii/HW1/task1.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -#include - -int sq(int a) { - return a * a; - -} - -int main() -{ - int a; - std::cout << "type the value of side" << std::endl; - std::cin >> a; - std::cout << "value of the square area:" << std :: endl<< sq(a); -} - diff --git a/sem1/BazovoiiEvgenii/HW1/task2.cpp b/sem1/BazovoiiEvgenii/HW1/task2.cpp deleted file mode 100644 index cb244617..00000000 --- a/sem1/BazovoiiEvgenii/HW1/task2.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int sq(float a, int h) { - return a / 2 * h; -} - -int main() { - int a; - int h; - std::cout << "write the summ of lengths " << std::endl; - std::cin >> a; - std::cout << "write the value of height" << std::endl; - std::cin >> h; - std::cout << "the value of the trapezoid area:" << sq(a, h); - return 0; -} \ No newline at end of file diff --git a/sem1/BazovoiiEvgenii/HW1/taskk4.cpp b/sem1/BazovoiiEvgenii/HW1/taskk4.cpp deleted file mode 100644 index c4a162f7..00000000 --- a/sem1/BazovoiiEvgenii/HW1/taskk4.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int reverse(int n) { - int reverse = 0; - while (n > 0) { - reverse = reverse * 10 + n % 10; - n = n / 10; - } - return reverse; -} - -int main() -{ - int n; - std::cout << "write number\n"; - std::cin >> n; - std::cout << "reverse number is:" << reverse(n); -} \ No newline at end of file diff --git a/sem1/BazovoiiEvgenii/HW2/TASK2(HW2).cpp b/sem1/BazovoiiEvgenii/HW2/TASK2(HW2).cpp deleted file mode 100644 index 05bb989f..00000000 --- a/sem1/BazovoiiEvgenii/HW2/TASK2(HW2).cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int Sirakuza(unsigned long long int i) { - while (i != 1) { - if (i % 2 == 0) { - i /= 2; - } - - else { - i = (i * 3 + 1) / 2; - } - - } - return i; -} -int main() -{ - std::cout << "Write a number more than zero\n"; - unsigned long long int i; - std::cin >> i; - std::cout << Sirakuza(i); -} \ No newline at end of file diff --git a/sem1/BazovoiiEvgenii/HW2/task1(mhw2).cpp b/sem1/BazovoiiEvgenii/HW2/task1(mhw2).cpp deleted file mode 100644 index 998935f5..00000000 --- a/sem1/BazovoiiEvgenii/HW2/task1(mhw2).cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -#include - -int main() -{ - int i; - std::cout << "choose a number system from 8 and 16!\n"; - std::cin >> i; - int a; - if (i == 8 ) { - std::cout << "write a number\n"; - std::cin >> std::oct >> a; - std::cout << a; - } - if (i == 16) { - std::cout << "write a number\n"; - std::cin >> std::hex >> a; - std::cout << a; - } -} diff --git a/sem1/BazuevConstantine/MiniHomeWork1/Task1.cpp b/sem1/BazuevConstantine/MiniHomeWork1/Task1.cpp deleted file mode 100644 index 5447cd59..00000000 --- a/sem1/BazuevConstantine/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "iostream" - -float Area(float lenght); - -int main() -{ - float len; - std::cout << "Enter a lenght of square: "; - std::cin >> len; - std::cout << "The area of square will be: " << Area(len); - -} - -float Area(float lenght) -{ - return lenght * lenght; -} \ No newline at end of file diff --git a/sem1/BazuevConstantine/MiniHomeWork1/Task2.cpp b/sem1/BazuevConstantine/MiniHomeWork1/Task2.cpp deleted file mode 100644 index e35d70d5..00000000 --- a/sem1/BazuevConstantine/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "iostream" - -float Area(float lenght_1, float lenght_2, float height); - -int main() -{ - float len_1, len_2, height; - std::cout << "Enter a lenghts of trapezoid (first a, then b): "; - std::cin >> len_1 >> len_2; - std::cout << "Enter a height of trapezoid: "; - std::cin >> height; - std::cout << "The area of trapezoid will be: " << Area(len_1, len_2, height); - -} - -float Area(float lenght_1, float lenght_2, float height) -{ - return (lenght_1 + lenght_2) * (height / 2); -} \ No newline at end of file diff --git a/sem1/BazuevConstantine/MiniHomeWork1/Task3.cpp b/sem1/BazuevConstantine/MiniHomeWork1/Task3.cpp deleted file mode 100644 index c1647cf4..00000000 --- a/sem1/BazuevConstantine/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "iostream" -#include "string" - -std::string Fs(int lenght); - -int main() -{ - int len; - - std::cout << "Enter a lenght of Fibonacci sequence: "; - std::cin >> len; - std::cout << "Fibonacci sequence: " << Fs(len); - -} - -std::string Fs(int lenght) -{ - std::string text; - long long int first = 0, second = 1, result; - text.append(std::to_string(first) + " "); - text.append(std::to_string(second) + " "); - - for (int counter = 0; counter < lenght - 2; counter++) - { - result = first + second; - text.append(std::to_string(result) + " "); - first = second; - second = result; - } - - return text; -} \ No newline at end of file diff --git a/sem1/BazuevConstantine/MiniHomeWork1/Task4.cpp b/sem1/BazuevConstantine/MiniHomeWork1/Task4.cpp deleted file mode 100644 index 2baa164e..00000000 --- a/sem1/BazuevConstantine/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "iostream" - -int Reverse(int num); - -int main() -{ - int number; - std::cout << "Enter a number: "; - std::cin >> number; - std::cout << "Reverse number is " << Reverse(number); -} - -int Reverse(int num) -{ - int res = 0; - - while (num != 0) - { - res *= 10; - res += num % 10; - num = num / 10; - } - - return res; -} \ No newline at end of file diff --git a/sem1/BazuevConstantine/MiniHomeWork2/MHW2_task1.cpp b/sem1/BazuevConstantine/MiniHomeWork2/MHW2_task1.cpp deleted file mode 100644 index d22acef4..00000000 --- a/sem1/BazuevConstantine/MiniHomeWork2/MHW2_task1.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "iostream" -#include "string" - -std::string Convert(int num, int sys); - -int main() -{ - int number; - int sys_num; - - std::cout << "Enter a number: "; - std::cin >> number; - std::cout << "Enter a calculus system (1 for 16-based, 2 for 8-based. default is 16-based): "; - std::cin >> sys_num; - - while (sys_num != 1 and sys_num != 2) - { - std::cout << "Enter a valid number for system (1 for 16-based, 2 for 8-based. default is 16-based):"; - std::cin >> sys_num; - } - - std::cout << "Number in " << ((sys_num == 2) ? "8-based" : "16-based") << " is " << Convert(number, sys_num); - -} - -std::string Convert(int num, int sys) -{ - if (num == 0) - { - return "0"; - } - - char nums[] = { '0', '1', '2', '3' ,'4' , '5', '6' ,'7' , '8' ,'9', 'A', 'B' , 'C' , 'D', 'E', 'F' }; - - std::string text = ""; - - switch (sys) - { - case(1): - - while (num > 0) - { - text = nums[num % 16] + text; - num /= 16; - } - break; - - case(2): - - while (num > 0) - { - text = nums[num % 8] + text; - num /= 8; - } - break; - } - return text; -} \ No newline at end of file diff --git a/sem1/BazuevConstantine/MiniHomeWork2/MHW2_task2.cpp b/sem1/BazuevConstantine/MiniHomeWork2/MHW2_task2.cpp deleted file mode 100644 index f31f3af4..00000000 --- a/sem1/BazuevConstantine/MiniHomeWork2/MHW2_task2.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "iostream" - -void Cirakuz(int num); - -int main() -{ - int number; - std::cout << "Enter a natural number: "; - std::cin >> number; - - while (number <= 0) - { - std::cout << "Enter a valid NATURAL number: "; - std::cin >> number; - } - - Cirakuz(number); - -} - -void Cirakuz(int num) -{ - while (num > 1) - { - if (num % 2 == 0) - { - num = num / 2; - } - else - { - num = ((num * 3) + 1) / 2; - } - - std::cout << "Current number is " << num << std::endl; - - } - - if (num == 1) - { - std::cout << "proven" << std::endl; - } - else - { - std::cout << "disproved" << std::endl; - } -} \ No newline at end of file diff --git a/sem1/BelykhMatvej/MiniHomeWork1/task1.cpp b/sem1/BelykhMatvej/MiniHomeWork1/task1.cpp deleted file mode 100644 index bba31a81..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -float SquareArea(float a) { - return(a * a); -} - -int main() { - int a; - std::cin >> a; - std::cout << SquareArea(a) << std::endl; -} \ No newline at end of file diff --git a/sem1/BelykhMatvej/MiniHomeWork1/task2.cpp b/sem1/BelykhMatvej/MiniHomeWork1/task2.cpp deleted file mode 100644 index d9a42a8c..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -float TrapezoidArea(float a, float b, float h) { - return(((a + b) / 2) * h); -} - -int main() { - int a,b,h; - std::cin >> a >> b >> h; - std::cout << TrapezoidArea(a,b,h) << std::endl; -} \ No newline at end of file diff --git a/sem1/BelykhMatvej/MiniHomeWork1/task3.cpp b/sem1/BelykhMatvej/MiniHomeWork1/task3.cpp deleted file mode 100644 index 413de01e..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -void FibonacciNum(int n) { - int NumOne = 0, NumTwo = 0, SumN = 1; - if (n > 0) { - std::cout << "0 "; - } - - if (n < 0) { - std::cout << "Error: The input number cannot be negative" << std::endl; - } - - else { - n -= 1; - for (int i = 1; i <= n; i++) { - std::cout << SumN << " "; - NumTwo = NumOne; - NumOne = SumN; - SumN = NumOne + NumTwo; - } - std::cout << std::endl; - } -} - -int main() { - int a; - std::cin >> a; - FibonacciNum(a); -} \ No newline at end of file diff --git a/sem1/BelykhMatvej/MiniHomeWork1/task4.cpp b/sem1/BelykhMatvej/MiniHomeWork1/task4.cpp deleted file mode 100644 index b0563750..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -long long ReverseNum(long long n) { - - long long digit = n % 10; - long long nTwo = n % 10; // - - if (n < 0) { - std::cout << "Error: The input number cannot be negative" << std::endl; - return(0); - } - - else { - n = n / 10; - while (n > 0) { - digit = n % 10; - n = n / 10; - nTwo = nTwo * 10; - nTwo = nTwo + digit; - } - return(nTwo); - } -} - -int main() { - int a; - std::cin >> a; - std::cout << ReverseNum(a) << std::endl; -} diff --git a/sem1/BelykhMatvej/MiniHomeWork2/task1.cpp b/sem1/BelykhMatvej/MiniHomeWork2/task1.cpp deleted file mode 100644 index 1c786fa2..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -void Nsystems(long long n, int system) { - switch (system) { - case 8: - std::cout << std::oct << n << std::endl; - break; - case 16: - std::cout << std::hex << n << std::endl; - break; - default: - std::cout << "Unsupported input data" << std::endl; - break; - } -} - - -int main() { - long long n; - int system; - std::cout << "Number and system(8 or 16)" << std::endl; - std::cin >> n >> system; - Nsystems(n, system); -} \ No newline at end of file diff --git a/sem1/BelykhMatvej/MiniHomeWork2/task2.cpp b/sem1/BelykhMatvej/MiniHomeWork2/task2.cpp deleted file mode 100644 index 9e281a6d..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -void Sirakus(long long n) { - if (n > 0) { - while (n != 1) { - if (n % 2 == 0) { - std::cout << n << "/2=" << n / 2 << std::endl; - n = n / 2; - } - else { - std::cout << "(" << n << "*3+1)/2=" << (n * 3 + 1) / 2 << std::endl; - n = (n * 3 + 1) / 2; - } - } - } - else { - std::cout << "The number must be natural" << std::endl; - } -} - -int main() { - long long n; - std::cin >> n; - Sirakus(n); -} \ No newline at end of file diff --git a/sem1/BelykhMatvej/MiniHomeWork3/MHW3.cpp b/sem1/BelykhMatvej/MiniHomeWork3/MHW3.cpp deleted file mode 100644 index 4b2906af..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork3/MHW3.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -class Color { -public: - explicit Color(int colorCode) : colorCode(colorCode) {} - - friend std::ostream& operator<<(std::ostream& os, const Color& color) { - HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); - SetConsoleTextAttribute(hConsole, color.colorCode); - return os; - } - -private: - int colorCode; -}; - -class Item { -public: - std::string name; - float price; - float weight; - - Item(const std::string& name, float price, float weight) - : name(name), price(price), weight(weight) {} -}; - -class ShopBase { -public: - virtual float AvePrice() const = 0; - virtual float AveWeight() const = 0; -}; - -class CustomShop : public ShopBase { -protected: - std::vector items; - -public: - void addItem(const Item& item) { - items.push_back(item); - } - - float AvePrice() const override { - float total = 0; - for (size_t i = 0; i < items.size(); ++i) { - total += items[i].price; - } - return total / items.size(); - } - - float AveWeight() const override { - float total = 0; - for (size_t i = 0; i < items.size(); ++i) { - total += items[i].weight; - } - return total / items.size(); - } -}; - -class ITMOMerch : public CustomShop { -public: - std::string shopType = "Merchandise"; -}; - -class ITMOTableGames : public CustomShop { -public: - std::string gameCategory = "Board Games"; -}; - -class GraphicsCards : public CustomShop { -public: - std::string graphicsType = "Graphics Processing Units"; -}; - -std::map> Parser() { - std::ifstream file("shops.txt"); - std::string line; - std::map> shops; - - std::unique_ptr currentShop = nullptr; - std::string shopName; - - while (std::getline(file, line)) { - std::istringstream iss(line); - std::string word; - iss >> word; - - if (word == "Shop") { - if (currentShop != nullptr) { - shops[shopName] = std::move(currentShop); - } - iss >> shopName; - - if (shopName == "ITMOMerch") { - currentShop = std::make_unique(); - } - else if (shopName == "ITMOTableGames") { - currentShop = std::make_unique(); - } - else if (shopName == "GraphicsCards") { - currentShop = std::make_unique(); - } - } - else if (word == "Items") { - continue; - } - else if (currentShop != nullptr) { - std::string name = word; - float price, weight; - iss >> price >> weight; - std::string additionalInfo; - std::getline(iss, additionalInfo); - currentShop->addItem(Item(name, price, weight)); - } - } - - if (currentShop != nullptr) { - shops[shopName] = std::move(currentShop); - } - - return shops; -} - -int main() { - std::map> shops = Parser(); - - for (std::map>::iterator i = shops.begin(); i != shops.end(); ++i) { - std::cout << Color(2) << "Shop: " << i->first << std::endl; - std::cout << Color(7) << "Average Price: " << i->second->AvePrice() << std::endl; - std::cout << "Average Weight: " << i->second->AveWeight() << std::endl; - } - - return 0; -} diff --git a/sem1/BelykhMatvej/MiniHomeWork3/Shops.txt b/sem1/BelykhMatvej/MiniHomeWork3/Shops.txt deleted file mode 100644 index 87ca9995..00000000 --- a/sem1/BelykhMatvej/MiniHomeWork3/Shops.txt +++ /dev/null @@ -1,23 +0,0 @@ -Shop ITMOMerch -Items 5 -Hoodie 3500 0.5 Color Blue -Tshirt 1500 0.2 Material Cotton -Cap 1200 0.1 Size Adjustable -Mug 800 0.3 Capacity 300ml -Notebook 500 0.2 Pages 100 - -Shop ITMOTableGames -Items 5 -StressQuest 1200 1.0 Players 2-4 -GraderNightmare 800 0.8 Age 12+ -DeadlineDash 500 0.3 TimeLimit 30min -Studentopoly 2500 1.5 Players 2-6 -SyntaxScramble 1500 1.2 Difficulty Medium - -Shop GraphicsCards -Items 5 -RTX3090 150000 1.5 FPS 600 -RTX3080 100000 1.4 FPS 550 -GTX1660 20000 1.0 FPS 300 -GTX1080 15000 0.9 FPS 280 -GTX1050 8000 0.8 FPS 200 diff --git a/sem1/BiktagirovaDiana/MiniHomeWork1/Task1.cpp b/sem1/BiktagirovaDiana/MiniHomeWork1/Task1.cpp deleted file mode 100644 index 830ef7a9..00000000 --- a/sem1/BiktagirovaDiana/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Task1.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// -using std::cin; -using std::cout; - -#include - -void SquareArea() { - int input = 0; - - cin >> input; - cout << "Square area:"; - cout << input * input; - return; -} -int main() -{ - cout << "Enter the length of the square"; - SquareArea(); -} - - - -// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/sem1/BiktagirovaDiana/MiniHomeWork1/Task2.cpp b/sem1/BiktagirovaDiana/MiniHomeWork1/Task2.cpp deleted file mode 100644 index f363d63e..00000000 --- a/sem1/BiktagirovaDiana/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Task2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// -#include -using std::cin; -using std::cout; - -void TrapezoidArea() { - int base1 = 0; - int base2 = 0; - int height = 0; - cin >> base1; - cout << "Enter the length of the second base of the trapezoid"; - cin >> base2; - cout << "Enter the length of the trapezoid height"; - cin >> height; - cout << "Trapezoid area:"; - cout << (((base1 + base2)/2) * height); - return; - -} -int main() -{ - cout << "Enter the length of the first base of the trapezoid"; - TrapezoidArea(); -} - -// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/sem1/BiktagirovaDiana/MiniHomeWork1/Task3.cpp b/sem1/BiktagirovaDiana/MiniHomeWork1/Task3.cpp deleted file mode 100644 index e2de5af4..00000000 --- a/sem1/BiktagirovaDiana/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Task3.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// - -#include -using std::cin; -using std::cout; -using std::endl; - - -void FibonacciGenerator() { - int NumberOfDigits; - cin >> NumberOfDigits; - int k = 0; - int n1 = 0; - int n2 = 1; - int n3 = n1 + n2; - while (k < NumberOfDigits){ - cout << n1 << endl; - n1 = n2; - n2 = n3; - n3 = n1 + n2; - k += 1; - } -} -int main() -{ - cout << "Enter the number of digits"< "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/sem1/BiktagirovaDiana/MiniHomeWork1/Task4.cpp b/sem1/BiktagirovaDiana/MiniHomeWork1/Task4.cpp deleted file mode 100644 index 1255da84..00000000 --- a/sem1/BiktagirovaDiana/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -#include -using std::cout; -using std::cin; -using std::endl; - -void Converter() { - int n1; - int n2 = 0; - cin >> n1; - while (n1 > 0) { - n2 = n1 % 10; - n1 = n1 / 10; - cout << n2; - } -} -int main() -{ - cout << "Enter a number"<< endl; - Converter(); -} \ No newline at end of file diff --git a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask1.cpp b/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask1.cpp deleted file mode 100644 index 209a93af..00000000 --- a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -void square(float b) -{ - std::cout << "Площадь квадрата = "<< b*b << std::endl; -} - -int main() -{ - float a; - setlocale(LC_ALL, "ru"); - std::cout << "Введите длину стороны" << std::endl; - std::cin >> a; - square(a); - return 0; -} diff --git a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask2.cpp b/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask2.cpp deleted file mode 100644 index 4cd28bf3..00000000 --- a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -void trapezoid(float a,float b,float c) -{ - std::cout << "Площадь трапеции = "<< (a +b)* c/2 << std::endl; -} - -int main() -{ - float a,b,c; - setlocale(LC_ALL, "ru"); - std::cout << "Введите длину первого основания" << std::endl; - std::cin >> a; - std::cout << "Введите длину второго основания" << std::endl; - std::cin >> b; - std::cout << "Введите длину высоты" << std::endl; - std::cin >> c; - trapezoid(a, b, c); - return 0; -} diff --git a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask3.cpp b/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask3.cpp deleted file mode 100644 index b2d36d41..00000000 --- a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask3.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -void fib2(int a) -{ - int i = 0; - int r = 0; - int m = 1; - int l; - - std::cout << "0" << std::endl; - std::cout << "1" << std::endl; - while (i < a) - { - i++; - l = m + r; - r = m; - m = l; - std::cout << l << std::endl; - } - -} - -int main() -{ - setlocale(LC_ALL, "ru"); - int a; - std::cout << "Выберите сколько чисел Фибоначи вывести" << std::endl; - std::cin >> a; - fib2(a); -} \ No newline at end of file diff --git a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask4.cpp b/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask4.cpp deleted file mode 100644 index 3cebc076..00000000 --- a/sem1/BolonevIvan/MiniHomeWork1/BolonevIAMiniHomeWorktask4.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -void back(int a) -{ - - int c = 10; - int i = 0; - int m = 0; - while (a > 0) - { - i = a % 10; - m = m * 10 + i; - a = a / 10; - - } - std::cout << m; -} - -int main() -{ - setlocale(LC_ALL, "ru"); - std::cout << "Введите число чтобы развернуть его" << std::endl; - int a; - std::cin >> a; - back(a); - -} diff --git a/sem1/BolonevIvan/MiniHomeWork2/BolonevIvanminihomework2task1a.cpp b/sem1/BolonevIvan/MiniHomeWork2/BolonevIvanminihomework2task1a.cpp deleted file mode 100644 index bf0f5bc8..00000000 --- a/sem1/BolonevIvan/MiniHomeWork2/BolonevIvanminihomework2task1a.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -void octal(int a) -{ - std::string number = ""; - std::string help; - while (a > 0) - { - number = std::to_string(a % 8) + number; - a = a / 8; - } - std::cout << "Ваше число в 8-ой системе: "; - std::cout << number; -} -int main() -{ - setlocale(LC_ALL, "ru"); - int a; - std::cout << "Введите число для перевода его в 8-у систему"<> a; - octal(a); -} \ No newline at end of file diff --git a/sem1/BolonevIvan/MiniHomeWork2/BolonevIvanminihomework2task1b.cpp b/sem1/BolonevIvan/MiniHomeWork2/BolonevIvanminihomework2task1b.cpp deleted file mode 100644 index 159da6a9..00000000 --- a/sem1/BolonevIvan/MiniHomeWork2/BolonevIvanminihomework2task1b.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -int main() -{ - setlocale(LC_ALL, "ru"); - std::cout << "Введите число для перевода в 16-ю систему"<> a; - l = a; - while (l > 0) - { - b = l % 16; - switch (b) - { - case 10: - passage = "A"; - break; - case 11: - passage = "B"; - break; - case 12: - passage = "C"; - break; - case 13: - passage = "D"; - break; - case 14: - passage = "E"; - break; - case 15: - passage = "F"; - break; - default: - passage = std::to_string(b); - } - number = passage + number; - l = l / 16; - } - std::cout << "Ваше число в 16-ой системе: "; - std::cout << number << std::endl; -} \ No newline at end of file diff --git a/sem1/BolonevIvan/MiniHomeWork2/Bolonevivanminihomewrork2task2.cpp b/sem1/BolonevIvan/MiniHomeWork2/Bolonevivanminihomewrork2task2.cpp deleted file mode 100644 index da4c0ea1..00000000 --- a/sem1/BolonevIvan/MiniHomeWork2/Bolonevivanminihomewrork2task2.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -void syracuse(int number) -{ - while (number != 1) - { - if (number % 2 == 0) - { - number = number / 2; - } - else if (number % 2 == 1) - { - number = number * 3 + 1; - } - } - std::cout << number << " Ого получилось" << std::endl; -} - -int main() -{ - setlocale(LC_ALL, "ru"); - std::cout << "Гипотеза Сиракуз" << std::endl; - int number; - std::cout << "Выберите число" << std::endl; - std::cin >> number; - syracuse(number); -} \ No newline at end of file diff --git a/sem1/BorodaiVladimir/MiniHomeWork1/task1.cpp b/sem1/BorodaiVladimir/MiniHomeWork1/task1.cpp deleted file mode 100644 index 2089e978..00000000 --- a/sem1/BorodaiVladimir/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,17 +0,0 @@ - - - - -#include - - - -int main() -{ - std::cout << "Enter the side of the square:"; - int a; - std::cin >> a; - std::cout << "Result:" << a * a; - -} - diff --git a/sem1/BorodaiVladimir/MiniHomeWork1/task2.cpp b/sem1/BorodaiVladimir/MiniHomeWork1/task2.cpp deleted file mode 100644 index f92604ed..00000000 --- a/sem1/BorodaiVladimir/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - - - -#include - - - -float main() -{ - - float a; - float b; - float h; - std::cout << "Enter the bottom side of the trapeze: "; - std::cin >> a; - std::cout << "Enter the top side of the trapeze: "; - std::cin >> b; - std::cout << "Enter the high of the trapeze: "; - std::cin >> h; - std::cout << "Result:" << (a + b) * h / 2; - -} - diff --git a/sem1/BorodaiVladimir/MiniHomeWork1/task3.cpp b/sem1/BorodaiVladimir/MiniHomeWork1/task3.cpp deleted file mode 100644 index 776969e2..00000000 --- a/sem1/BorodaiVladimir/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - - - -#include - - - -int main() -{ - - int a = 0; - int b = 1; - int c; - int n; - std::cout << "Enter the number of elements: "; - std::cin >> n; - std::cout << 0 << " " << 1 << " "; - for (int i = 0; i < n - 2; i = i + 1) { - c = a + b; - a = b; - b = c; - std::cout << c << " "; - } -} - diff --git a/sem1/BorodaiVladimir/MiniHomeWork1/task4.cpp b/sem1/BorodaiVladimir/MiniHomeWork1/task4.cpp deleted file mode 100644 index 4ef9a66e..00000000 --- a/sem1/BorodaiVladimir/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - - - -#include - - -int main() -{ - - int a; - int b = 0; - std::cin >> a; - - while (a > 0) { - b *= 10; - b += a % 10; - a /= 10; - } - - - - if (a % 10 == 0) { - std::cout << "0" << b; - } - else { - std::cout << b; - } -} - diff --git a/sem1/BorodaiVladimir/MiniHomeWork2/task1.cpp b/sem1/BorodaiVladimir/MiniHomeWork2/task1.cpp deleted file mode 100644 index e946b914..00000000 --- a/sem1/BorodaiVladimir/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -#include - -int main() { - int numb; //linkin park - int choose; - - std::cout << "Enter a number: "; - std::cin >> numb; - std::cout << "Choose convertion: " << std::endl; - std::cout << "1. Oct(8)" << std::endl; - std::cout << "2. Hex(16)" << std::endl; - std::cout << "Enter your choice: "; - std::cin >> choose; - - if (choose == 1) { - std::cout << "Result: " << std::oct << numb; - } - else if (choose == 2) { - std::cout << "Resault: " << std::hex << numb; - } - else { - std::cout << "Choose 1 or 2!" ; - } - - -} \ No newline at end of file diff --git a/sem1/BorodaiVladimir/MiniHomeWork2/task2.cpp b/sem1/BorodaiVladimir/MiniHomeWork2/task2.cpp deleted file mode 100644 index 79e06928..00000000 --- a/sem1/BorodaiVladimir/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#include - -int main() { - int n; - - std::cout << "Enter a number: "; - - if (!(std::cin >> n) or n == 0) { - std::cout << "OOPS! Invalid " << std::endl; - return 1; - } - else { - std::cout << "The Syracuse Sequence: " << n << " "; - - - while (n != 1) { - if (n % 2 == 0) { - n /= 2; - } - else { - n = (3 * n + 1) / 2; - } - std::cout << n << " "; - } - - - std::cout << " Congratulations!" << std::endl; - - return 0; - } -} \ No newline at end of file diff --git a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.1.cpp b/sem1/BuchelnikovEgor/MiniHomework1/DZ1.1.cpp deleted file mode 100644 index 654f4382..00000000 --- a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int func(int a) { - std::cout << "S kvadrata = " << a*a; - return a; -} -int main() { - int b; - std::cout << "Vvedite storonu kradrata" << std::endl; - std::cin >> b; - func(b); - return 0; -} - diff --git a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.2.cpp b/sem1/BuchelnikovEgor/MiniHomework1/DZ1.2.cpp deleted file mode 100644 index bb5db7bc..00000000 --- a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.2.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -int funcTRAPECIA(int a, int b, int c) { - std::cout << "Ploshad trapecii = " << ((a + b) * 1 / 2) * c; - return a; -} -int main() { - int base1, base2, height; - std::cout << "Vvedite 1 i 2 osnovanie trapecii" << std::endl; - std::cin >> base2 >> base1; - std::cout << "Vvedte visotu trapecii" << std::endl; - std::cin >> height; - funcTRAPECIA(base1, base2, height); - return 0; -} diff --git a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.3.cpp b/sem1/BuchelnikovEgor/MiniHomework1/DZ1.3.cpp deleted file mode 100644 index db34e2bf..00000000 --- a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.3.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -int main() { - setlocale(LC_ALL, "Russian"); - int variable1 = 0, variable2 = 1, variable3; - while (true) { - int N; - std::cout << "Введите колличество элементов ряда Фиббоначи "; - std::cin >> N; - if (N == 0) { - std::cout << "0"; - break; - } - - for (int i=0; i < N; i++) { - variable3 = variable1 + variable2; - std::cout << variable3 << " " << std::endl; - variable1 = variable2; - variable2 = variable3; - } - break; - } -} diff --git a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.4.cpp b/sem1/BuchelnikovEgor/MiniHomework1/DZ1.4.cpp deleted file mode 100644 index ddf16142..00000000 --- a/sem1/BuchelnikovEgor/MiniHomework1/DZ1.4.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -int main() { - setlocale(LC_ALL, "Russian"); - int number, digit=0; - std::cout << "Введите число "; - std::cin >> number; - while (number > 0) { - digit = digit * 10; - digit = (number % 10)+digit; - number = number / 10; - } - std::cout << digit; -} diff --git a/sem1/BykovAA/minhw2/task1.cpp b/sem1/BykovAA/minhw2/task1.cpp deleted file mode 100644 index bdb6410b..00000000 --- a/sem1/BykovAA/minhw2/task1.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include -#include - -int Convert(int number, int base); -std::string ConvertToBaseEight(int number, int base); -std::string ConvertToBaseSixteen(int number, int base); - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int number; - int base; - - while (true) - { - std::cout << "Введите число: "; - std::cin >> number; - std::cout << "Введите основание, в которое хотите перевести: "; - std::cin >> base; - - if (Convert(number, base) == 0) - { - break; - } - } - - return 0; -} - -int Convert(int number, int base) -{ - std::string convertedNumber; - - switch (base) - { - case 8: - convertedNumber = ConvertToBaseEight(number, base); - break; - case 16: - convertedNumber = ConvertToBaseSixteen(number, base); - break; - default: - std::cout << "Неизвестная система счисления" << std::endl; - return 1; - } - - std::cout << convertedNumber; - return 0; -} - -std::string ConvertToBaseEight(int number, int base) -{ - std::string eightBaseNumber; - - while (number > 0) - { - eightBaseNumber = std::to_string(number % base) + eightBaseNumber; - number = number / base; - } - - return eightBaseNumber; -} - -std::string ConvertToBaseSixteen(int number, int base) -{ - std::string sixteenBaseNumber; - int modulo; - - while (number > 0) - { - modulo = (number % base); - - switch (modulo) - { - case 10: - sixteenBaseNumber = "A" + sixteenBaseNumber; - break; - case 11: - sixteenBaseNumber = "B" + sixteenBaseNumber; - break; - case 12: - sixteenBaseNumber = "C" + sixteenBaseNumber; - break; - case 13: - sixteenBaseNumber = "D" + sixteenBaseNumber; - break; - case 14: - sixteenBaseNumber = "E" + sixteenBaseNumber; - break; - case 15: - sixteenBaseNumber = "F" + sixteenBaseNumber; - break; - default: - sixteenBaseNumber = std::to_string(modulo) + sixteenBaseNumber; - break; - } - - number = number / base; - } - - return sixteenBaseNumber; -} - - diff --git a/sem1/BykovAA/minhw2/task2.cpp b/sem1/BykovAA/minhw2/task2.cpp deleted file mode 100644 index aa38d039..00000000 --- a/sem1/BykovAA/minhw2/task2.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -int CheckSiracus(int number); - -int main() -{ - setlocale(LC_ALL, "Russian"); - - for (int i = 1; i < 10001; i++) - { - CheckSiracus(i); - } -} - -int CheckSiracus(int number) -{ - if (number == 1) - { - std::cout << "Гипотеза не нарушена" << std::endl; - } - else - { - if (number % 2 == 0) - { - number = number / 2; - } - else - { - number = (number * 3 + 1) / 2; - } - - CheckSiracus(number); - } - - return number; -} \ No newline at end of file diff --git a/sem1/BykovAA/minihw1/task1.cpp b/sem1/BykovAA/minihw1/task1.cpp deleted file mode 100644 index 600897e1..00000000 --- a/sem1/BykovAA/minihw1/task1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include - -float FindSquareArea(float squareSide); - -int main() -{ - setlocale(LC_ALL, "Russian"); - - float squareSide; - - while(true) - { - std::cout << "Вdедите длину стороны квадрата: "; - std::cin >> squareSide; - - if (squareSide > 0) - { - std::cout << "Площадь квадрата = " << FindSquareArea(squareSide); - break; - } - else - { - std::cout << "Некорректный ввод!" << std::endl; - } - } - - return 0; -} - -float FindSquareArea(float squareSide) -{ - float area; - - area = squareSide * squareSide; - - return area; -} \ No newline at end of file diff --git a/sem1/BykovAA/minihw1/task2.cpp b/sem1/BykovAA/minihw1/task2.cpp deleted file mode 100644 index 30b4883a..00000000 --- a/sem1/BykovAA/minihw1/task2.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include - -float FindTrapezeArea(float firstBaseLength, float secondBaseLength, float height); - -int main() -{ - setlocale(LC_ALL, "Russian"); - - float firstBaseLength; - float secondBaseLength; - float height; - - while (true) - { - std::cout << "Введите длину первого основания трапеции: "; - std::cin >> firstBaseLength; - std::cout << "Введите длину второго основания трапеции: "; - std::cin >> secondBaseLength; - std::cout << "Введите длину высоты трапеции: "; - std::cin >> height; - - if (firstBaseLength > 0 && secondBaseLength > 0 && height) - { - std::cout << "Площадь квадрата = " << FindTrapezeArea(firstBaseLength, secondBaseLength, height); - break; - } - else - { - std::cout << "Некорректный ввод!" << std::endl; - } - } - - return 0; -} - -float FindTrapezeArea(float firstBaseLength, float secondBaseLength, float height) -{ - float area; - - area = .5f * (firstBaseLength + secondBaseLength) * height; - - return area; -} \ No newline at end of file diff --git a/sem1/BykovAA/minihw1/task3.cpp b/sem1/BykovAA/minihw1/task3.cpp deleted file mode 100644 index e141eb65..00000000 --- a/sem1/BykovAA/minihw1/task3.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include - -int FindFiboElement(int elementNumber); - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int elementNumber; - - std::cout << "Введите сколько чисел Фибоначи вы хотите вывести: "; - std::cin >> elementNumber; - - for (int i = 1; i <= elementNumber; i++) - { - std::cout << FindFiboElement(i) << std::endl; - } - - return 0; -} - -int FindFiboElement(int elementNumber) -{ - int fiboNumber; - - switch (elementNumber) - { - case 1: - fiboNumber = 0; - break; - case 2: - fiboNumber = 1; - break; - default: - fiboNumber = FindFiboElement(elementNumber - 2) + FindFiboElement(elementNumber - 1); - break; - } - - return fiboNumber; -} \ No newline at end of file diff --git a/sem1/BykovAA/minihw1/task4.cpp b/sem1/BykovAA/minihw1/task4.cpp deleted file mode 100644 index 051958f8..00000000 --- a/sem1/BykovAA/minihw1/task4.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -int FlipNumber(int number); - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int number; - - std::cout << "Введите число для преобразования: "; - std::cin >> number; - - std::cout << FlipNumber(number); - - return 0; -} - -int FlipNumber(int number) -{ - int flippedNumber; - - flippedNumber = number % 10; - number = number / 10; - - while(number > 0) - { - flippedNumber = flippedNumber * 10 + number % 10; - number = number / 10; - } - - return flippedNumber; -} \ No newline at end of file diff --git a/sem1/BykovAA/minihw3/task1.cpp b/sem1/BykovAA/minihw3/task1.cpp deleted file mode 100644 index 96a5da3a..00000000 --- a/sem1/BykovAA/minihw3/task1.cpp +++ /dev/null @@ -1,184 +0,0 @@ -#include -#include -#include -#include - -class ItemBase -{ -protected: - std::string name; - double price; - double mass; - std::string distributorType; - -public: - ItemBase(std::string name, double price, double mass) - { - this->name = name; - this->price = price; - this->mass = mass; - } - - std::string GetDistrubitorType() - { - return this->distributorType; - } - - double GetPrice() - { - return this->price; - } - - double GetMass() - { - return this->mass; - } -}; - -class Electronics : public ItemBase -{ -public: - Electronics(std::string name, double price, double mass) : ItemBase(name, price, mass) - { - this->distributorType = "ForPCs"; - } -}; - -class Groceries : public ItemBase -{ -public: - Groceries(std::string name, double price, double mass) : ItemBase(name, price, mass) - { - this->distributorType = "Groceries"; - } -}; - -class Clothes : public ItemBase -{ -public: - Clothes(std::string name, double price, double mass) : ItemBase(name, price, mass) - { - this->distributorType = "Clothes"; - } -}; - -class Shop -{ -private: - std::string type; - std::vector itemsList; - -public: - int numberOfItems; - - Shop(std::string type) - { - this->type = type; - } - - void AddItem(ItemBase item) - { - this->itemsList.push_back(item); - } - - std::string GetType() - { - return this->type; - } - - double GetAvrgPrice() - { - double avrgPrice = 0; - - for (int i = 0; i < this->itemsList.size(); i++) - { - avrgPrice += itemsList[i].GetPrice(); - } - - avrgPrice /= numberOfItems; - - return avrgPrice; - } - - double GetAvrgMass() - { - double avrgMass = 0; - - for (int i = 0; i < this->itemsList.size(); i++) - { - avrgMass += itemsList[i].GetMass(); - } - - avrgMass /= numberOfItems; - - return avrgMass; - } - - void GetInfo() - { - std::cout << "В магазине " << GetType() << " средняя стоимость товаров: " << GetAvrgPrice() << ", а их средняя масса: " << GetAvrgMass() << std::endl; - } -}; - -void Initialize(std::vector& shoplist); - -int main() -{ - setlocale(LC_ALL, "Russian"); - std::vector shoplist; - - Initialize(shoplist); - - for (int i = 0; i < shoplist.size(); i++) - { - shoplist[i].GetInfo(); - } -} - -void Initialize(std::vector& shoplist) -{ - std::ifstream in("shoplist.txt"); - std::string line; - - if (in.is_open()) - { - while (std::getline(in, line)) - { - if (line.find("Shop") != std::string::npos) - { - Shop shop(line.substr(line.find(" ")+1, line.size())); - shoplist.push_back(shop); - } - else if (line.find("Item") != std::string::npos) - { - shoplist[shoplist.size()-1].numberOfItems = stoi(line.substr(line.find(" ") + 1, line.size())); - } - else - { - double mass = stod(line.substr(line.rfind(" ")+1, line.size())); - line.erase(line.rfind(" "), line.size()); - double price = stod(line.substr(line.rfind(" ")+1, line.size())); - line.erase(line.rfind(" "), line.size()); - std::string name = line; - - if (shoplist[shoplist.size() - 1].GetType() == "ForPCs") - { - Electronics item(name, price, mass); - shoplist[shoplist.size() - 1].AddItem(item); - } - else if (shoplist[shoplist.size() - 1].GetType() == "Groceries") - { - Electronics item(name, price, mass); - shoplist[shoplist.size() - 1].AddItem(item); - } - else if(shoplist[shoplist.size() - 1].GetType() == "Clothes") - { - Electronics item(name, price, mass); - shoplist[shoplist.size() - 1].AddItem(item); - } - } - } - } - - in.close(); -} \ No newline at end of file diff --git a/sem1/DaniilGatich/miniHomeWork1/Task1.cpp b/sem1/DaniilGatich/miniHomeWork1/Task1.cpp deleted file mode 100644 index a5ce8742..00000000 --- a/sem1/DaniilGatich/miniHomeWork1/Task1.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -float square(float side) -{ - std::cout << "Enter side of your quadrant:"; - std::cin >> side; - std::cout << "Square of your quadrant is - " << side * side; - return 0; -} - -int main() -{ - float usersSide = 0; - square(usersSide); -} - - diff --git a/sem1/DaniilGatich/miniHomeWork1/Task2.cpp b/sem1/DaniilGatich/miniHomeWork1/Task2.cpp deleted file mode 100644 index 61cd9b1c..00000000 --- a/sem1/DaniilGatich/miniHomeWork1/Task2.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -float trapSquare(float side1, float side2, float height) -{ - std::cout << "Enter upper side of your trapeze:"; - std::cin >> side1; - std::cout << "Enter bottom side of your trapeze:"; - std::cin >> side2; - std::cout << "Enter height of your trapeze:"; - std::cin >> height; - std::cout << "Square of your trapeze is - " << (side1 + side2) / 2 * height; - return 0; -} - -int main() -{ - float usersSide1 = 0; - float usersSide2 = 0; - float usersHeight = 0; - trapSquare(usersSide1, usersSide2, usersHeight); -} \ No newline at end of file diff --git a/sem1/DaniilGatich/miniHomeWork1/Task3.cpp b/sem1/DaniilGatich/miniHomeWork1/Task3.cpp deleted file mode 100644 index 6f1945e0..00000000 --- a/sem1/DaniilGatich/miniHomeWork1/Task3.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - - -int Fibo() -{ - int n = 0; - int i = 0; - int a = 0; - int b = 1; - int c = 0; - - std::cout << "Enter how many Fibonachi numbers you want:"; - std::cin >> n; - while (i < n) - { - a = b; - b = c; - c = a + b; - std::cout << c <<", "; - i++; - } - return 0; -} - -int main() -{ - Fibo(); -} \ No newline at end of file diff --git a/sem1/DaniilGatich/miniHomeWork1/Task4.cpp b/sem1/DaniilGatich/miniHomeWork1/Task4.cpp deleted file mode 100644 index 5d0c15dd..00000000 --- a/sem1/DaniilGatich/miniHomeWork1/Task4.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -long int Reverse() -{ - long int n, ost; - long int reverse = 0; - std::cout << "Enter a number: "; - std::cin >> n; - while (n > 0) - { - ost = n % 10; - reverse = reverse * 10 + ost; - n /= 10; - } - std::cout << reverse; - return 0; -} -int main() -{ - Reverse(); -} diff --git a/sem1/DaniilGatich/miniHomeWork2/task1.cpp b/sem1/DaniilGatich/miniHomeWork2/task1.cpp deleted file mode 100644 index a4a71274..00000000 --- a/sem1/DaniilGatich/miniHomeWork2/task1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int OctHex(int numb) -{ - int numb1 = numb; - std::cout << "Your number in hexadecimal sys:" << std::hex << numb; - std::cout << " "; - std::cout << "Your number in octalal sys:" << std::oct << numb1; - return 0; -} - -int main() -{ - int _userNum; - std::cout << "Enter your number:"; - std::cin >> _userNum; - OctHex(_userNum); -} - diff --git a/sem1/DaniilGatich/miniHomeWork2/task2.cpp b/sem1/DaniilGatich/miniHomeWork2/task2.cpp deleted file mode 100644 index 0e9b2e64..00000000 --- a/sem1/DaniilGatich/miniHomeWork2/task2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -int main() -{ - int _userNum; - std::cout << "What number do u want to check with Syracuse hypothesis?: "; - std::cin >> _userNum; - while (_userNum != 1) - { - if (_userNum == 2) - { - std::cout << "It's even number, so we devide it by 2: "; - std::cout << _userNum << ":2 = " << _userNum / 2 << std::endl; - std::cout << "It's we finally got 1 "; - break; - } - if (_userNum % 2 == 0) - { - std::cout << "It's even number, so we devide it by 2: "; - std::cout << _userNum << ":2 = " << _userNum / 2 << std::endl; - _userNum = _userNum / 2; - } - if (_userNum % 2 != 0) - { - - std::cout << "It's not an even number, so we multiply it by 3 plus 1: "; - std::cout << _userNum << "*3 + 1 = " << _userNum * 3 + 1 << std::endl; - _userNum = _userNum * 3 + 1; - } - } -} diff --git a/sem1/DaniilGrishin/MiniHomeWork1/task1.cpp b/sem1/DaniilGrishin/MiniHomeWork1/task1.cpp deleted file mode 100644 index 31b3eb3a..00000000 --- a/sem1/DaniilGrishin/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -double sqrArea() { - double side; - double result; - std::cout << "Enter side of square length:" << std::endl; - std::cin >> side; - result = side * side; - std::cout << "Area of square:" << std::endl << result << std::endl; - return result; -} - -int main() { - sqrArea(); -} \ No newline at end of file diff --git a/sem1/DaniilGrishin/MiniHomeWork1/task2.cpp b/sem1/DaniilGrishin/MiniHomeWork1/task2.cpp deleted file mode 100644 index 7add3bf6..00000000 --- a/sem1/DaniilGrishin/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -double trapArea() { - double first_base, second_base, height, result; - std::cout << "Enter the first base of a trapezoid: " << std::endl; - std::cin >> first_base; - std::cout << "Enter the second base of a trapezoid: " << std::endl; - std::cin >> second_base; - std::cout << "Enter the height of a trapezoid: " << std::endl; - std::cin >> height; - result = (first_base + second_base) / 2 * height; - std::cout << "Area of a trapezoid: " << std::endl << (first_base + second_base) / 2 * height; -} - -int main() { - trapArea(); -} \ No newline at end of file diff --git a/sem1/DaniilGrishin/MiniHomeWork1/task3.cpp b/sem1/DaniilGrishin/MiniHomeWork1/task3.cpp deleted file mode 100644 index 1ac5db20..00000000 --- a/sem1/DaniilGrishin/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -int fibbRow() { - int N; - unsigned long long int nextn; //nextn - - unsigned long long int prev1 = 1; //prev1 - - unsigned long long int prev2 = 0; //prev2 - 2 - std::cout << "Enter the length of Fibonacci row:" << std::endl; - std::cin >> N; - if (N >= 94) { - std::cout << "The data type does not allow counting a row greater than 93 "; //.. unsigned long long int - 2^64, 94- - return 0; - } - for (int i = 1; i <= N; ++i) { - nextn = prev1 + prev2; - prev1 = prev2; - prev2 = nextn; - std::cout << nextn << " "; - } - return 0; -} - -int main() { - fibbRow(); -} \ No newline at end of file diff --git a/sem1/DaniilGrishin/MiniHomeWork1/task4.cpp b/sem1/DaniilGrishin/MiniHomeWork1/task4.cpp deleted file mode 100644 index 1bbf70f6..00000000 --- a/sem1/DaniilGrishin/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int reverseNumber() { - int num, res; - res = 0; - std::cout << "Enter a number to reverse:" << std::endl; - std::cin >> num; - while (num > 0) { - res *= 10; - res += num % 10; - num /= 10; - } - std::cout << "Reversed:" << std::endl << res; - return 0; -} - -int main() { - reverseNumber(); -} \ No newline at end of file diff --git a/sem1/DaniilGrishin/minihomework2/task1.cpp b/sem1/DaniilGrishin/minihomework2/task1.cpp deleted file mode 100644 index e6c90edb..00000000 --- a/sem1/DaniilGrishin/minihomework2/task1.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -int main() { - while (true) { - int selection; - std::cout << "Select mode:" << std::endl << "1 - decimal to octal" << std::endl << "2 - decimal to hexadecimal" << std::endl << "3 - exit" << std::endl; - std::cin >> selection; - if (selection != 1 and selection != 2 and selection != 3) { - std::cout << "Wrong selection" << std::endl; - break; - } - - switch (selection) { - case 1: { - int number; - std::cout << "Enter number to convert:" << std::endl; - std::cin >> number; - std::cout << "Result:" << std::endl << std::oct << number << std::endl << std::endl; - break; - } - case 2: { - int number; - std::cout << "Enter number to convert:" << std::endl; - std::cin >> number; - std::cout << "Result:" << std::endl << std::hex << number << std::endl << std::endl; - break; - } - case 3: { - return 0; - } - } - } -} \ No newline at end of file diff --git a/sem1/DaniilGrishin/minihomework2/task2.cpp b/sem1/DaniilGrishin/minihomework2/task2.cpp deleted file mode 100644 index 61a0dfe4..00000000 --- a/sem1/DaniilGrishin/minihomework2/task2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -bool checkSyracuse(const int num) { - int number = num; - while (number > 1) { - number = number % 2 == 0 ? - number / 2 - : number * 3 + 1; - } - if (number == 1) { - return true; - } - else { - return false; - } -} - -int main() { - int num; - std::cout << "Welcome to Syracuse checking program!" << std::endl << std::endl; - std::cout << "Syracuse says that if you enter any number, " << std::endl << "then perform a sequence of operations" << std::endl << "and repeat it with the result of this sequence," << std::endl << "then eventually it will turn into 1." << std::endl << std::endl; - std::cout << "Let's check it!" << std::endl; std::cout << "Enter any number:" << std::endl; - std::cin >> num; - if (checkSyracuse(num)) { - std::cout << "Syracuse's hypothesis is correct! Yay!"; - } - else { - std::cout << "Syracuse's hypothesis is wrong... :("; - } -} - diff --git a/sem1/DaniilGrishin/minihomework3/shops.txt b/sem1/DaniilGrishin/minihomework3/shops.txt deleted file mode 100644 index 975ef225..00000000 --- a/sem1/DaniilGrishin/minihomework3/shops.txt +++ /dev/null @@ -1,22 +0,0 @@ -Shop ForPCs -Items 5 -NVIDIA6090 10000 10 FPS 600 -NVIDIA3090 5342 4 FPS 256 -NVIDIA4020 7000 10 FPS 600 -NVIDIA5090 9999 9 FPS 500 -NVIDIA1660 2000 3 FPS 120 -Shop Fruits -Items 6 -BananaAfric 3 1 Vitamins Ka Ca -Apple1 3 1 Vitamins Fe I -Apple2 2 1 Vitamins Fe I -AppleDorogoe 6 1 Vitamins Fe I -Granat 5 1 Vitamins C P B6 -Mandarini 8 1 Vitamins C P -Shop Books -Items 5 -CPlusPlusBook 25 1 Pages 400 -PythonBook 20 1 Pages 300 -Algorithms 300 1.0 Pages 412 -Gamedesign 800 1.1 Pages 250 -SumotatamiGuide 1000 3 Pages 43 \ No newline at end of file diff --git a/sem1/DaniilGrishin/minihomework3/task1.cpp b/sem1/DaniilGrishin/minihomework3/task1.cpp deleted file mode 100644 index d532dc90..00000000 --- a/sem1/DaniilGrishin/minihomework3/task1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include -#include -#include -#include - - -class ItemBase { -public: - std::string name; - double price; - double weight; - - ItemBase(std::string n, double p, double w) : name(n), price(p), weight(w) {} -}; - - -class GPUItem : public ItemBase { -public: - int fps; - - GPUItem(std::string n, double p, double w, int f) : ItemBase(n, p, w), fps(f) {} -}; - -class FruitItem : public ItemBase { -public: - std::string vitamins; - - FruitItem(std::string n, double p, double w, std::string v) : ItemBase(n, p, w), vitamins(v) {} -}; - -class BookItem : public ItemBase { -public: - int pages; - - BookItem(std::string n, double p, double w, int pg) : ItemBase(n, p, w), pages(pg) {} -}; - -class Shop { -public: - std::string name; - std::vector items; - - Shop(std::string n) : name(n) {} - - // - void addItem(ItemBase* item) { - items.push_back(item); - } - - // - double averagePrice() { - double total = 0; - for (auto& item : items) { - total += item->price; - } - return items.empty() ? 0 : total / items.size(); - } - - // - double averageWeight() { - double total = 0; - for (auto& item : items) { - total += item->weight; - } - return items.empty() ? 0 : total / items.size(); - } -}; - -int main() { - std::ifstream file("shops.txt"); - std::string line; - std::vector shops; - - while (std::getline(file, line)) { - if (line.find("Shop") != std::string::npos) { - std::string shopName = line.substr(5); - shops.emplace_back(shopName); - } - - // - else if (line.find("Items") != std::string::npos) { - int itemCount; - std::istringstream(line.substr(6)) >> itemCount; // - - for (int i = 0; i < itemCount; ++i) { - std::getline(file, line); // - - std::istringstream iss(line); - std::string itemName; - double price, weight; - - - iss >> itemName >> price >> weight; - - // - if (shops.back().name == "ForPCs") { - int fps; - iss >> fps; - GPUItem* gpuItem = new GPUItem(itemName, price, weight, fps); - shops.back().addItem(gpuItem); - } - else if (shops.back().name == "Fruits") { - std::string vitamins; - iss >> vitamins; - FruitItem* fruitItem = new FruitItem(itemName, price, weight, vitamins); - shops.back().addItem(fruitItem); - } - else if (shops.back().name == "Books") { - int pages; - iss >> pages; - BookItem* bookItem = new BookItem(itemName, price, weight, pages); - shops.back().addItem(bookItem); - } - } - } - } - - for (auto& shop : shops) { - std::cout << "Shop: " << shop.name << std::endl; - std::cout << "Average Price: " << shop.averagePrice() << std::endl; - std::cout << "Average Weight: " << shop.averageWeight() << std::endl; - std::cout << std::endl; - } - - file.close(); - return 0; -} diff --git a/sem1/Didenko Darya/mim_home_work_2/number 1.cpp b/sem1/Didenko Darya/mim_home_work_2/number 1.cpp deleted file mode 100644 index 74b05f43..00000000 --- a/sem1/Didenko Darya/mim_home_work_2/number 1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int main() { - int num, system; - std::cout << "Enter the system of convertion \n"; - std::cout << "Enter the value you want to convert \n"; - std::cin >> system >> num; - switch (system) { - case 8: - std::cout << std::oct << num; - break; - case 16: - std::cout << std::hex << num; - break; - default: std::cout << "Sorry, you have entered an unsupported system"; - } - -} \ No newline at end of file diff --git a/sem1/Didenko Darya/mim_home_work_2/number 2.cpp b/sem1/Didenko Darya/mim_home_work_2/number 2.cpp deleted file mode 100644 index 477268a8..00000000 --- a/sem1/Didenko Darya/mim_home_work_2/number 2.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main() { - long long num; - std::cin >> num; - if (num < 0) { - std::cout << "The number must be natural" << std::endl; - } - - while (num != 1 and num > 0) { - if (num % 2 == 0) { - num /= 2; - std::cout << num << std::endl; - - } - else { - num = (3 * num + 1) / 2; - std::cout << num << std::endl; - } - } -} \ No newline at end of file diff --git a/sem1/Didenko Darya/mini_home_work_1/task 1.cpp b/sem1/Didenko Darya/mini_home_work_1/task 1.cpp deleted file mode 100644 index 3d9a60a8..00000000 --- a/sem1/Didenko Darya/mini_home_work_1/task 1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -float square_area(float lenght) { - return lenght * lenght; -} - - -int main() -{ - float lenght; - std::cout << "Enter a lenght of a square: "; - std::cin >> lenght; - std::cout << "The area of the square is: " << square_area(lenght) << std::endl; -} \ No newline at end of file diff --git a/sem1/Didenko Darya/mini_home_work_1/task2.cpp b/sem1/Didenko Darya/mini_home_work_1/task2.cpp deleted file mode 100644 index e6ba397d..00000000 --- a/sem1/Didenko Darya/mini_home_work_1/task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -float trapezoid_area(float a, float b, float h) { - return ((a + b) * h) * 0.5; -} - -int main() -{ - float a, b, h; - std::cout << "Enter a lenght of a first base: "; - std::cin >> a; - std::cout << "Enter a lenght of a second base: "; - std::cin >> b; - std::cout << "Enter a height of a trapezoid: "; - std::cin >> h; - std::cout << "The area of the trapezoid is: " << trapezoid_area(a, b, h) << std::endl; -} \ No newline at end of file diff --git a/sem1/Didenko Darya/mini_home_work_1/task3.cpp b/sem1/Didenko Darya/mini_home_work_1/task3.cpp deleted file mode 100644 index 25d476dc..00000000 --- a/sem1/Didenko Darya/mini_home_work_1/task3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -void fibonachi_row(int n) { - - int first_n = 0, second_n = 1, result_n, i = 0; - - std::cout << "0 1" << " "; - - for (i; i < n - 1; ++i) { - result_n = first_n + second_n; - first_n = second_n; - second_n = result_n; - std::cout << result_n << " "; - } -} - -int main() { - int a; - std::cout << "Enter the lenght of the Fibohachi sequence:" << " "; - std::cin >> a; - if (a < 1 || a > 46) { - std::cout << "Sorry, the programm doesn't work correctly with the value you entered :( " << std::endl; - } - else { - fibonachi_row(a); - } -} \ No newline at end of file diff --git a/sem1/Didenko Darya/mini_home_work_1/task4.cpp b/sem1/Didenko Darya/mini_home_work_1/task4.cpp deleted file mode 100644 index 008ddb52..00000000 --- a/sem1/Didenko Darya/mini_home_work_1/task4.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -long long function_reverse_number(long long given_number) { - long long final_number = 0; - bool is_negative = false; - - if (given_number < 0) { - is_negative = true; - given_number = -given_number; - } - - while (given_number > 0) { - final_number *= 10; - final_number = final_number + given_number % 10; - given_number /= 10; - } - if (is_negative == true) { - final_number = -final_number; - } - return final_number; -} - - -int main() { - long long n; - std::cout << "Enter a number: "; - std::cin >> n; - std::cout << "Reversed number is: " << function_reverse_number(n) << std::endl; - -} \ No newline at end of file diff --git a/sem1/EliseySin/DZ_1/dz_1.cpp b/sem1/EliseySin/DZ_1/dz_1.cpp deleted file mode 100644 index 174b3e4f..00000000 --- a/sem1/EliseySin/DZ_1/dz_1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int calculateSquareArea(int side) -{ - return side * side; -} - -int main() -{ - int sk; - std::cout << "Введите сторону квадрата: "; - std::cin >> sk; - - int svk = calculateSquareArea(sk); - std::cout << "Площадь квадрата: " << svk; - - return 0; -} diff --git a/sem1/EliseySin/DZ_1/dz_2.cpp b/sem1/EliseySin/DZ_1/dz_2.cpp deleted file mode 100644 index b79c99ed..00000000 --- a/sem1/EliseySin/DZ_1/dz_2.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -int calculateTrapezoidArea(int bst, int mst, int vt) -{ - return ((bst + mst) * vt) / 2; -} - -int main() -{ - int bst; - int mst; - int vt; - - std::cout << "Введите большую сторону трапеции: "; - std::cin >> bst; - std::cout << "Введите меньшую сторону трапеции: "; - std::cin >> mst; - std::cout << "Введите высоту трапеции: "; - std::cin >> vt; - - int pt = calculateTrapezoidArea(bst, mst, vt); - std::cout << "Площадь трапеции: " << pt; - - return 0; -} diff --git a/sem1/EliseySin/DZ_1/dz_3.cpp b/sem1/EliseySin/DZ_1/dz_3.cpp deleted file mode 100644 index e952ed44..00000000 --- a/sem1/EliseySin/DZ_1/dz_3.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -void printFibonacciSequence(int ke) -{ - int e0 = 0; - int e1 = 1; - int enext; - - if (ke >= 1) - { - std::cout << e0 << " "; - } - if (ke >= 2) - { - std::cout << e1 << " "; - } - - for (int b = 3; b <= ke; b++) - { - enext = e0 + e1; - e0 = e1; - e1 = enext; - - std::cout << enext << " "; - } -} - -int main() -{ - int ke; - std::cout << "Введите кол-во элементов последовательности Фибоначчи: "; - std::cin >> ke; - - printFibonacciSequence(ke); - return 0; -} diff --git a/sem1/EliseySin/DZ_1/dz_4.cpp b/sem1/EliseySin/DZ_1/dz_4.cpp deleted file mode 100644 index 2c66c033..00000000 --- a/sem1/EliseySin/DZ_1/dz_4.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int reverseNumber(int number) -{ - int rnumber = 0; - while (number != 0) - { - rnumber *= 10; - rnumber += number % 10; - number /= 10; - } - return rnumber; -} - -int main() -{ - int number; - - std::cout << "Введите любое число, чтобы его развернуть: "; - std::cin >> number; - - int rnumber = reverseNumber(number); - - std::cout << "Число после разворота: " << rnumber << std::endl; - - return 0; -} diff --git a/sem1/EliseySin/mini DZ/miniDZ_1.cpp b/sem1/EliseySin/mini DZ/miniDZ_1.cpp deleted file mode 100644 index 5ca9358f..00000000 --- a/sem1/EliseySin/mini DZ/miniDZ_1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -std::string toOctal(int number) -{ - std::string octal; - while (number > 0) - { - octal = std::to_string(number % 8) + octal; - number /= 8; - } - return octal.empty() ? "0" : octal; -} - -std::string toHexadecimal(int number) -{ - std::string hexadecimal; - const char hexDigits[] = "0123456789ABCDEF"; - while (number > 0) - { - hexadecimal = hexDigits[number % 16] + hexadecimal; - number /= 16; - } - return hexadecimal.empty() ? "0" : hexadecimal; -} - -int main() -{ - int number; - - std::cout << "Введите число в десятичной системе счисления: "; - std::cin >> number; - - std::string octal = toOctal(number); - std::string hexadecimal = toHexadecimal(number); - - std::cout << "Введенное число в восьмиричной системе: : " << octal << std::endl; - std::cout << "Введенное число в шестнадцатиричной системе: " << hexadecimal << std::endl; - - return 0; -} diff --git a/sem1/EliseySin/mini DZ/miniDZ_2.cpp b/sem1/EliseySin/mini DZ/miniDZ_2.cpp deleted file mode 100644 index cc4415ba..00000000 --- a/sem1/EliseySin/mini DZ/miniDZ_2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include - -void HypothesisSyracuse(int n) -{ - if (n <= 0) - { - std::cout << "Ошибка: Введите положительное целое число!" << std::endl; - return; - } - - std::cout << "Последовательность для числа " << n << ": "; - while (n != 1) - { - std::cout << n << " "; - if (n % 2 == 0) - { - n /= 2; - } - else - { - n = (3 * n + 1) / 2; - } - } - std::cout << n << std::endl; - std::cout << "Гипотеза подтверждена!" << std::endl; -} - -int main() -{ - int number; - - std::cout << "Введите положительное целое число: "; - std::cin >> number; - - HypothesisSyracuse(number); - return 0; -} diff --git a/sem1/Ermakov Ioann/minihomework1/task1.cpp b/sem1/Ermakov Ioann/minihomework1/task1.cpp deleted file mode 100644 index 04253b82..00000000 --- a/sem1/Ermakov Ioann/minihomework1/task1.cpp +++ /dev/null @@ -1,16 +0,0 @@ - - -#include - -int Square(int a) -{ - return a * a; -} -int main() -{ - setlocale(LC_ALL, "Russian"); - int b; - std::cout << "Введите длину стороны a: "; - std::cin >> b; - std::cout << "Площадь данного квадрата = " << Square(b); -} diff --git a/sem1/Ermakov Ioann/minihomework1/task2.cpp b/sem1/Ermakov Ioann/minihomework1/task2.cpp deleted file mode 100644 index 29fa8544..00000000 --- a/sem1/Ermakov Ioann/minihomework1/task2.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#include - -int Square(int a, int b, int h) -{ - return (a + b) / 2 * h; -} -int main() -{ - setlocale(LC_ALL, "Russian"); - int a1, b1, h1; - std::cout << "Введите ширину: " << std::endl; - std::cin >> a1; - std::cout << "Введите длину: " << std::endl; - std::cin >> b1; - std::cout << "Введите высоту: " << std::endl; - std::cin >> h1; - std::cout << "Площадь данной трапеции = " << Square(a1, b1, h1); -} diff --git a/sem1/Ermakov Ioann/minihomework1/task3.cpp b/sem1/Ermakov Ioann/minihomework1/task3.cpp deleted file mode 100644 index e78d977e..00000000 --- a/sem1/Ermakov Ioann/minihomework1/task3.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -#include - -int Fibon(int n) -{ - ; - int a = 0, b = 1; - int coc = a; - - for (int i = 1; i <= n; i++) - { - std::cout << a << " "; - coc = a + b; - a = b; - b = coc; - } - return b; -} -int main() -{ - int h; - std::cin >> h; - Fibon(h); - -} - diff --git a/sem1/Ermakov Ioann/minihomework1/task4.cpp b/sem1/Ermakov Ioann/minihomework1/task4.cpp deleted file mode 100644 index bbabdf15..00000000 --- a/sem1/Ermakov Ioann/minihomework1/task4.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#include - -int Revert(int a) -{ - int b = 0; - while (a > 0) { - b = b * 10; - b = (a % 10) + b; - a = a / 10; - } - return b; -} -int main() -{ - int a = 0; - std::cin >> a; - std::cout << Revert(a); -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork1/task1.cpp b/sem1/EvdokimovMA/MiniHomeWork1/task1.cpp deleted file mode 100644 index c2b9b7f1..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Created by Максим Евдокимов on 16.09.2024. -// - -#include "iostream" - -float squareArea(const float side) { - return side * side; -} - -int main() { - float side; - - std::cout << "Enter the side of the square: "; - std::cin >> side; - - const float area = squareArea(side); - std::cout << "Area of the square: " << area << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork1/task2.cpp b/sem1/EvdokimovMA/MiniHomeWork1/task2.cpp deleted file mode 100644 index c255aa62..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// Created by Максим Евдокимов on 16.09.2024. -// - -#include "iostream" - -float trapezoidzArea(const float base0, const float base1, const float height) { - return (base0 + base1) * 0.5f * height; -} - -int main() { - float base0, base1, height; - - std::cout << "Enter the bases of the trapezoid: "; - std::cin >> base0 >> base1; - - std::cout << "Enter the height of the trapezoid: "; - std::cin >> height; - - const float area = trapezoidzArea(base0, base1, height); - std::cout << "Area of the trapezoid: " << area << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork1/task3.cpp b/sem1/EvdokimovMA/MiniHomeWork1/task3.cpp deleted file mode 100644 index c80b6340..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -// Created by Максим Евдокимов on 16.09.2024. -// - -#include "iostream" - -void compute_n_fibonacci(const int n) { - long long int* fibonacci = new long long int[std::max(n, 0)]; - - if(n >= 1) { - fibonacci[0] = 0; - std::cout << fibonacci[0] << std::endl; - } - if(n >= 2) { - fibonacci[1] = 1; - std::cout << fibonacci[1] << std::endl; - } - - for(int i = 2; i < n; i++) { - fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2]; - std::cout << fibonacci[i] << std::endl; - } - - delete[] fibonacci; -} - -int main() { - int n; - - std::cout << "Enter the number of terms in the fibonacci sequence: "; - std::cin >> n; - - compute_n_fibonacci(n); - - return 0; -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork1/task4.cpp b/sem1/EvdokimovMA/MiniHomeWork1/task4.cpp deleted file mode 100644 index 38676150..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -// Created by Максим Евдокимов on 16.09.2024. -// - -#include "iostream" - -int revert_number(int number) { - int revert_number = 0; - - while (number != 0) { - revert_number = revert_number * 10 + number % 10; - number /= 10; - } - - return revert_number; -} - -int main() { - int n; - - std::cout << "Enter a number: "; - std::cin >> n; - - const int reverted_n = revert_number(n); - std::cout << "Reverted number: " << reverted_n << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork2/task1.cpp b/sem1/EvdokimovMA/MiniHomeWork2/task1.cpp deleted file mode 100644 index 1a8faa39..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// -// Created by Максим Евдокимов on 29.09.2024. -// - -#include "iostream" - -char* to_base_n(const int number, const int base) { - if(base < 2 || base > 16) { - return nullptr; - } - - int n = number; - int length = 0; - while(n != 0) { - n /= base; - length++; - } - - char* result = new char[length + 1]; - result[length] = '\0'; - - n = number; - for(int i = length - 1; i >= 0; i--) { - const int digit = n % base; - result[i] = digit < 10 ? '0' + digit : 'A' + digit - 10; - n /= base; - } - - return result; -} - -void print_number_in_base(const int number, const int base) { - char* result = to_base_n(number, base); - if(result == nullptr) { - std::cout << "Invalid base" << std::endl; - } else { - std::cout << "Number in base " << base << ": " << result << std::endl; - delete[] result; - } -} - -int main() { - int mode; - std::cout << "Enter the mode (1 - decimal to custom (2-16), 2 - decimal to octal, 3 - decimal to hexadecimal): "; - std::cin >> mode; - - switch(mode) { - case 1: { - std::cout << "Selected custom base" << std::endl; - - int number, base; - std::cout << "Enter the number: "; - std::cin >> number; - - std::cout << "Enter the base: "; - std::cin >> base; - - print_number_in_base(number, base); - break; - } - case 2: { - std::cout << "Selected octal base" << std::endl; - - int number; - std::cout << "Enter the number: "; - std::cin >> number; - - print_number_in_base(number, 8); - break; - } - case 3: { - int number; - std::cout << "Selected hexadecimal base" << std::endl; - std::cout << "Enter the number: "; - std::cin >> number; - - print_number_in_base(number, 16); - break; - } - default: { - std::cout << "Invalid mode" << std::endl; - break; - } - } -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork2/task2.cpp b/sem1/EvdokimovMA/MiniHomeWork2/task2.cpp deleted file mode 100644 index a65df5a2..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// -// Created by Максим Евдокимов on 29.09.2024. -// - -#include "iostream" - -bool check_syracuse_sequence(const int n) { - int number = n; - - while (number > 1) { - number = number % 2 == 0 ? number / 2 : (number * 3 + 1) / 2; - } - - if (number == 1) { - std::cout << "The Syracuse sequence for " << n << " converges to 1" << std::endl; - } else { - std::cout << "The Syracuse sequence for " << n << " does not converge to 1" << std::endl; - } - - return number == 1; -} - -int main() { - std::cout << "This program tests the Siracusa hypothesis by traversing all numbers in a given interval." << std::endl; - std::cout << "The hypothesis states that all numbers eventually converge to 1." << std::endl; - std::cout << "Enter the interval to test. It must be a subset of the natural numbers." << std::endl; - - int start_number, end_number; - std::cout << "Enter the start number: "; - std::cin >> start_number; - - std::cout << "Enter the end number: "; - std::cin >> end_number; - - if (start_number > end_number) { - std::cout << "The start number must be less than or equal to the end number" << std::endl; - return 1; - } - - bool is_converging = true; - for (int i = start_number; i <= end_number && is_converging; i++) { - is_converging = check_syracuse_sequence(i); - } - - if (is_converging) { - std::cout << "All numbers in the interval converge to 1" << std::endl; - } else { - std::cout << "Not all numbers in the interval converge to 1" << std::endl; - } -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/construction-item.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/construction-item.cpp deleted file mode 100644 index 5a158272..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/construction-item.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include "../../item.cpp" -#include "fstream" - -class ConstructionItem : public Item { - std::string material; - std::string dimensions; - -public: - void parseValues(std::ifstream& stream) override { - std::getline(stream, material); - std::getline(stream, dimensions); - } - - std::string getDisplayString() const override { - std::ostringstream stream; - stream << "Name: " << getName() << std::endl; - stream << "Description: " << getDescription() << std::endl; - stream << "Price: " << getPrice().rubles << " rubles " << (int)getPrice().kopecks << " kopecks" << std::endl; - stream << "Mass: " << getMass() << "kg" << std::endl; - stream << "Material: " << material << std::endl; - stream << "Dimensions: " << dimensions << std::endl; - return stream.str(); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/construction-shop.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/construction-shop.cpp deleted file mode 100644 index a981ee3a..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/construction-shop.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include -#include - -#include "../../shop.cpp" -#include "../../utils.cpp" - -#include "construction-item.cpp" -#include "tool-item.cpp" - -class ConstructionShop : public Shop { -public: - void parseItems(std::ifstream &stream, unsigned int items_count) override { - for (unsigned int i = 0; i < items_count; i++) { - std::string type; - while (type.empty()) { - std::getline(stream, type); - } - - unsigned int type_hash = hash_string(type.c_str(), type.size()); - - switch (type_hash) { - case hash_string("construction", 12): { - auto item = new ConstructionItem(); - item->parseFromStream(stream); - items.push_back(item); - break; - } - case hash_string("tool", 4): { - auto item = new ToolItem(); - item->parseFromStream(stream); - items.push_back(item); - break; - } - default: { - throw std::runtime_error("Unknown item type"); - } - } - } - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/tool-item.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/tool-item.cpp deleted file mode 100644 index d81a0283..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ConstructionShop/tool-item.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include "../../item.cpp" - -class ToolItem : public Item { - std::string type; - std::string power; - std::string brand; - -public: - void parseValues(std::ifstream& stream) override { - std::getline(stream, type); - std::getline(stream, power); - std::getline(stream, brand); - } - - std::string getDisplayString() const override { - std::ostringstream stream; - stream << "Name: " << getName() << std::endl; - stream << "Description: " << getDescription() << std::endl; - stream << "Price: " << getPrice().rubles << " rubles " << (int)getPrice().kopecks << " kopecks" << std::endl; - stream << "Mass: " << getMass() << "kg" << std::endl; - stream << "Type: " << type << std::endl; - stream << "Power: " << power << std::endl; - stream << "Brand: " << brand << std::endl; - return stream.str(); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/computer-item.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/computer-item.cpp deleted file mode 100644 index 5595b281..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/computer-item.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include "../../item.cpp" -#include "fstream" - -class ComputerItem : public Item { - std::string cpu; - std::string gpu; - std::string ram; - std::string storage; - std::string os; - -public: - void parseValues(std::ifstream& stream) override { - std::getline(stream, cpu); - std::getline(stream, gpu); - std::getline(stream, ram); - std::getline(stream, storage); - std::getline(stream, os); - } - - std::string getDisplayString() const override { - std::ostringstream stream; - stream << "Name: " << getName() << std::endl; - stream << "Description: " << getDescription() << std::endl; - stream << "Price: " << getPrice().rubles << " rubles " << (int)getPrice().kopecks << " kopecks" << std::endl; - stream << "Mass: " << getMass() << "kg" << std::endl; - stream << "CPU: " << cpu << std::endl; - stream << "GPU: " << gpu << std::endl; - stream << "RAM: " << ram << std::endl; - stream << "Storage: " << storage << std::endl; - stream << "OS: " << os << std::endl; - return stream.str(); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/electronics-shop.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/electronics-shop.cpp deleted file mode 100644 index 0f143c79..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/electronics-shop.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include -#include - -#include "../../shop.cpp" -#include "../../utils.cpp" - -#include "phone-item.cpp" -#include "computer-item.cpp" - -class ElectronicsShop : public Shop { -public: - void parseItems(std::ifstream &stream, unsigned int items_count) override { - for (unsigned int i = 0; i < items_count; i++) { - std::string type; - while (type.empty()) { - std::getline(stream, type); - } - - unsigned int type_hash = hash_string(type.c_str(), type.size()); - - switch (type_hash) { - case hash_string("phone", 5): { - auto item = new PhoneItem(); - item->parseFromStream(stream); - items.push_back(item); - break; - } - case hash_string("computer", 8): { - auto item = new ComputerItem(); - item->parseFromStream(stream); - items.push_back(item); - break; - } - default: { - throw std::runtime_error("Unknown item type"); - } - } - } - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/phone-item.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/phone-item.cpp deleted file mode 100644 index 50ae7ed3..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/ElectronicsShop/phone-item.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include "../../item.cpp" - -class PhoneItem : public Item { - std::string cpu; - std::string gpu; - std::string ram; - std::string storage; - std::string os; - std::string camera; - -public: - void parseValues(std::ifstream& stream) override { - std::getline(stream, cpu); - std::getline(stream, gpu); - std::getline(stream, ram); - std::getline(stream, storage); - std::getline(stream, os); - std::getline(stream, camera); - } - - std::string getDisplayString() const override { - std::ostringstream stream; - stream << "Name: " << getName() << std::endl; - stream << "Description: " << getDescription() << std::endl; - stream << "Price: " << getPrice().rubles << " rubles " << (int)getPrice().kopecks << " kopecks" << std::endl; - stream << "Mass: " << getMass() << "kg" << std::endl; - stream << "CPU: " << cpu << std::endl; - stream << "GPU: " << gpu << std::endl; - stream << "RAM: " << ram << std::endl; - stream << "Storage: " << storage << std::endl; - stream << "OS: " << os << std::endl; - stream << "Camera: " << camera << std::endl; - return stream.str(); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/beverage-item.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/beverage-item.cpp deleted file mode 100644 index 1b0f8e1e..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/beverage-item.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include "../../item.cpp" - -class BeverageItem : public Item { - double volume; - std::string brand; - -public: - void parseValues(std::ifstream& stream) override { - std::string line; - std::getline(stream, line); - volume = std::stod(line); - - std::getline(stream, brand); - } - - std::string getDisplayString() const override { - std::ostringstream stream; - stream << "Name: " << getName() << std::endl; - stream << "Description: " << getDescription() << std::endl; - stream << "Price: " << getPrice().rubles << " rubles " << (int)getPrice().kopecks << " kopecks" << std::endl; - stream << "Volume: " << volume << std::endl; - stream << "Brand: " << brand << std::endl; - return stream.str(); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/grocery-item.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/grocery-item.cpp deleted file mode 100644 index a30810db..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/grocery-item.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include "../../item.cpp" -#include "fstream" - -class GroceryItem : public Item { - std::string expirationDate; - std::string ingredients; - std::string brand; - -public: - void parseValues(std::ifstream& stream) override { - std::getline(stream, expirationDate); - std::getline(stream, ingredients); - std::getline(stream, brand); - } - - std::string getDisplayString() const override { - std::ostringstream stream; - stream << "Name: " << getName() << std::endl; - stream << "Description: " << getDescription() << std::endl; - stream << "Price: " << getPrice().rubles << " rubles " << (int)getPrice().kopecks << " kopecks" << std::endl; - stream << "Mass: " << getMass() << "kg" << std::endl; - stream << "Expiration date: " << expirationDate << std::endl; - stream << "Ingredients: " << ingredients << std::endl; - stream << "Brand: " << brand << std::endl; - return stream.str(); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/grocery-shop.cpp b/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/grocery-shop.cpp deleted file mode 100644 index 2e7ae3fb..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/Implementations/GroceryShop/grocery-shop.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include -#include - -#include "../../shop.cpp" -#include "../../utils.cpp" - -#include "grocery-item.cpp" -#include "beverage-item.cpp" - -class GroceryShop : public Shop { -public: - void parseItems(std::ifstream &stream, unsigned int items_count) override { - for (unsigned int i = 0; i < items_count; i++) { - std::string type; - while (type.empty()) { - std::getline(stream, type); - } - - unsigned int type_hash = hash_string(type.c_str(), type.size()); - - switch (type_hash) { - case hash_string("grocery", 7): { - auto item = new GroceryItem(); - item->parseFromStream(stream); - items.push_back(item); - break; - } - case hash_string("beverage", 8): { - auto item = new BeverageItem(); - item->parseFromStream(stream); - items.push_back(item); - break; - } - default: { - throw std::runtime_error("Unknown item type: " + type); - } - } - } - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/combined-data.txt b/sem1/EvdokimovMA/MiniHomeWork3/SampleData/combined-data.txt deleted file mode 100644 index d108cbac..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/combined-data.txt +++ /dev/null @@ -1,187 +0,0 @@ -3 - -construction -Builder -25 Lenin St., Moscow, 101000 -6 - -construction -Cement Mix -High-quality cement for construction projects -499 99 -50.0 -Concrete -30x40x15 cm - -tool -Cordless Drill -Powerful drill for all types of construction work -3999 50 -1.2 -Drill -18V -Bosch - -construction -Bricks -Durable red bricks for building walls and structures -29 50 -2.5 -Clay -20x10x6 cm - -tool -Electric Saw -High-efficiency saw for precise wood and metal cutting -5499 00 -3.5 -Saw -1200W -Makita - -construction -Steel Rebar -Strong steel rebar for concrete reinforcement -149 99 -10.0 -Steel -12x12x1000 cm - -tool -Angle Grinder -Versatile grinder for grinding, cutting, and polishing -2799 99 -2.3 -Grinder -750W -DeWalt - -electronics -DVideo -78 Mira Ave., Saint Petersburg, 190000 -6 - -phone -iPhone 13 -Newest generation iPhone with advanced camera features -79999 99 -0.174 -A15 Bionic -Apple GPU (4-core graphics) -4GB -128GB -iOS 15 -12MP - -computer -MacBook Pro 16-inch -High-performance laptop designed for professionals -299999 00 -2.0 -M1 Pro -Integrated 16-core GPU -16GB -512GB SSD -macOS Monterey - -phone -Samsung Galaxy S21 -Flagship smartphone with high-end display and camera -69999 99 -0.169 -Exynos 2100 -Mali-G78 MP14 -8GB -256GB -Android 11 -64MP - -computer -Dell XPS 15 -Powerful laptop with InfinityEdge display and latest processor -209999 99 -1.8 -Intel Core i7-11800H -NVIDIA GeForce GTX 1650 -16GB -1TB SSD -Windows 10 - -phone -Google Pixel 6 -Google’s latest smartphone with advanced AI camera features -59999 99 -0.207 -Google Tensor -Mali-G78 MP20 -8GB -128GB -Android 12 -50MP - -computer -HP Spectre x360 -Versatile 2-in-1 laptop with strong security features -159999 99 -1.32 -Intel Core i5-1135G7 -Intel Iris Xe Graphics -8GB -512GB SSD -Windows 10 - -grocery -Shestorochka -12 Gagarin St., Kazan, 420000 -6 - -grocery -Whole Wheat Flour -High-quality flour for baking and cooking -349 90 -1.0 -15.10.2025 -Wheat -Mills - -grocery -Organic Honey -Pure organic honey harvested from local farms -599 00 -0.5 -15.06.2024 -Honey -Bee Farms - -beverage -Apple Juice -Freshly squeezed apple juice with no added sugar -129 50 -1.0 -1.0 -Natural Juice Co. - -beverage -Sparkling Water -Refreshing sparkling water with natural minerals -89 90 -0.5 -0.5 -Pure Springs - -grocery -Almonds -Raw almonds for snacking and baking -899 00 -0.25 -15.11.2024 -Almonds -Nutri Snacks - -beverage -Green Tea -High-quality green tea for a refreshing drink -199 00 -0.25 -0.25 -Tea Masters \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/construction-data.txt b/sem1/EvdokimovMA/MiniHomeWork3/SampleData/construction-data.txt deleted file mode 100644 index 4d77ebad..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/construction-data.txt +++ /dev/null @@ -1,50 +0,0 @@ -construction -Cement Mix -High-quality cement for construction projects -499 99 -50.0 -Concrete -30x40x15 cm - -tool -Cordless Drill -Powerful drill for all types of construction work -3999 50 -1.2 -Drill -18V -Bosch - -construction -Bricks -Durable red bricks for building walls and structures -29 50 -2.5 -Clay -20x10x6 cm - -tool -Electric Saw -High-efficiency saw for precise wood and metal cutting -5499 00 -3.5 -Saw -1200W -Makita - -construction -Steel Rebar -Strong steel rebar for concrete reinforcement -149 99 -10.0 -Steel -12x12x1000 cm - -tool -Angle Grinder -Versatile grinder for grinding, cutting, and polishing -2799 99 -2.3 -Grinder -750W -DeWalt \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/electronics-data.txt b/sem1/EvdokimovMA/MiniHomeWork3/SampleData/electronics-data.txt deleted file mode 100644 index be3ade49..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/electronics-data.txt +++ /dev/null @@ -1,68 +0,0 @@ -phone -iPhone 13 -Newest generation iPhone with advanced camera features -79999 99 -0.174 -A15 Bionic -Apple GPU (4-core graphics) -4GB -128GB -iOS 15 -12MP - -computer -MacBook Pro 16-inch -High-performance laptop designed for professionals -299999 00 -2.0 -M1 Pro -Integrated 16-core GPU -16GB -512GB SSD -macOS Monterey - -phone -Samsung Galaxy S21 -Flagship smartphone with high-end display and camera -69999 99 -0.169 -Exynos 2100 -Mali-G78 MP14 -8GB -256GB -Android 11 -64MP - -computer -Dell XPS 15 -Powerful laptop with InfinityEdge display and latest processor -209999 99 -1.8 -Intel Core i7-11800H -NVIDIA GeForce GTX 1650 -16GB -1TB SSD -Windows 10 - -phone -Google Pixel 6 -Google’s latest smartphone with advanced AI camera features -59999 99 -0.207 -Google Tensor -Mali-G78 MP20 -8GB -128GB -Android 12 -50MP - -computer -HP Spectre x360 -Versatile 2-in-1 laptop with strong security features -159999 99 -1.32 -Intel Core i5-1135G7 -Intel Iris Xe Graphics -8GB -512GB SSD -Windows 10 \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/grocery-data.txt b/sem1/EvdokimovMA/MiniHomeWork3/SampleData/grocery-data.txt deleted file mode 100644 index 1b111f5a..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/SampleData/grocery-data.txt +++ /dev/null @@ -1,50 +0,0 @@ -grocery -Whole Wheat Flour -High-quality flour for baking and cooking -349 90 -1.0 -15.10.2025 -Wheat -Mills - -grocery -Organic Honey -Pure organic honey harvested from local farms -599 00 -0.5 -15.06.2024 -Honey -Bee Farms - -beverage -Apple Juice -Freshly squeezed apple juice with no added sugar -129 50 -1.0 -1.0 -Natural Juice Co. - -beverage -Sparkling Water -Refreshing sparkling water with natural minerals -89 90 -0.5 -0.5 -Pure Springs - -grocery -Almonds -Raw almonds for snacking and baking -899 00 -0.25 -15.11.2024 -Almonds -Nutri Snacks - -beverage -Green Tea -High-quality green tea for a refreshing drink -199 00 -0.25 -0.25 -Tea Masters \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/item.cpp b/sem1/EvdokimovMA/MiniHomeWork3/item.cpp deleted file mode 100644 index 3c388402..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/item.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#pragma once - -#include "string" -#include "price.cpp" -#include -#include - -class Item { - std::string name; - std::string description; - Price price; - double mass; - -public: - Item() { - name = "Unnamed item"; - description = "No description"; - price = Price(); - } - - void parseFromStream(std::ifstream& stream) { - // Read item data - parseItemData(stream); - - // Read values - parseValues(stream); - } - void parseItemData(std::ifstream& stream) { - // Read name - std::getline(stream, name); - - // Read description - std::string line; - std::getline(stream, line); - description = line; - - // Read price - std::string price_str; - std::getline(stream, price_str); - price = Price::parseFromString(price_str); - - // Read mass - std::string mass_str; - std::getline(stream, mass_str); - mass = std::stod(mass_str); - } - virtual void parseValues(std::ifstream& stream) { } - - std::string getName() const { - return name; - } - std::string getDescription() const { - return description; - } - Price getPrice() const { - return price; - } - double getMass() const { - return mass; - } - - virtual std::string getDisplayString() const { - std::ostringstream stream; - stream << "Name: " << name << std::endl; - stream << "Description: " << description << std::endl; - stream << "Price: " << price.rubles << " rubles " << (int)price.kopecks << " kopecks" << std::endl; - stream << "Mass: " << mass << " kg" << std::endl; - return stream.str(); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/main.cpp b/sem1/EvdokimovMA/MiniHomeWork3/main.cpp deleted file mode 100644 index a3c3cef5..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/main.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#include -#include "utils.cpp" - -#include "Implementations/ConstructionShop/construction-shop.cpp" -#include "Implementations/ElectronicsShop/electronics-shop.cpp" -#include "Implementations/GroceryShop/grocery-shop.cpp" - -std::vector parseShops(std::ifstream& file) { - unsigned int shops_count; - file >> shops_count; - - std::vector shops; - for (unsigned int i = 0; i < shops_count; i++) { - std::string shop_type; - while (shop_type.empty()) { - std::getline(file, shop_type); - } - - unsigned int shop_type_hash = hash_string(shop_type.c_str(), shop_type.size()); - - switch (shop_type_hash) { - case hash_string("construction", 12): { - auto shop = new ConstructionShop(); - shop->parseFromStream(file); - shops.push_back(shop); - break; - } - case hash_string("electronics", 11): { - auto shop = new ElectronicsShop(); - shop->parseFromStream(file); - shops.push_back(shop); - break; - } - case hash_string("grocery", 7): { - auto shop = new GroceryShop(); - shop->parseFromStream(file); - shops.push_back(shop); - break; - } - default: { - throw std::runtime_error("Unknown shop type: " + shop_type); - } - } - } - - return shops; -} - -void compute_shop_stats(const Shop& shop, double& avg_price, double& avg_mass) { - unsigned long int items_count = 0; - avg_price = 0; - avg_mass = 0; - - for (auto item : shop.getItems()) { - avg_price += static_cast(item->getPrice()); - avg_mass += item->getMass(); - items_count++; - } - - avg_price /= items_count; - avg_mass /= items_count; -} - -int main() { - std::ifstream file("SampleData/combined-data.txt"); - if (!file.is_open()) { - std::cerr << "Failed to open file" << std::endl; - wait_for_enter(); - return 1; - } - - std::cout << "Parsing shops..." << std::endl; - auto shops = parseShops(file); - std::cout << shops.size() << " shops parsed" << std::endl << std::endl; - - while(true) { - for(unsigned int i = 0; i < shops.size(); i++) { - std::cout << i + 1 << ". " << shops[i]->getName() << " (" << shops[i]->getAddress() << ")" << std::endl; - } - - std::cout << "Enter shop name (or 'exit' to exit, 'stats' to show short stats): "; - std::string shop_name; - std::cin >> shop_name; - std::cout << std::endl << std::endl; - - if (shop_name == "exit") { - break; - } - - if (shop_name == "stats") { - unsigned long int items_count = 0; - double avg_price = 0; - double avg_mass = 0; - - for (auto shop : shops) { - double shop_avg_price; - double shop_avg_mass; - compute_shop_stats(*shop, shop_avg_price, shop_avg_mass); - - avg_price += shop_avg_price; - avg_mass += shop_avg_mass; - items_count += shop->getItems().size(); - } - - avg_price /= shops.size(); - avg_mass /= shops.size(); - - std::cout << "Shops count: " << shops.size() << std::endl; - std::cout << "Items count: " << items_count << std::endl; - std::cout << "Average price: " << avg_price << " RUB" << std::endl; - std::cout << "Average mass: " << avg_mass << " kg" << std::endl; - - wait_for_enter(); - clear_screen(); - continue; - } - - bool found = false; - for (auto shop : shops) { - if (shop->getName() == shop_name) { - found = true; - std::cout << "Shop: " << shop->getName() << std::endl; - std::cout << "Address: " << shop->getAddress() << std::endl << std::endl; - - double avg_price; - double avg_mass; - compute_shop_stats(*shop, avg_price, avg_mass); - - std::cout << "Shop stats:" << std::endl; - std::cout << "Items count: " << shop->getItems().size() << std::endl; - std::cout << "Average price: " << avg_price << " RUB" << std::endl; - std::cout << "Average mass: " << avg_mass << " kg" << std::endl << std::endl << std::endl; - - std::cout << "Items:" << std::endl; - for (auto item : shop->getItems()) { - std::cout << item->getDisplayString() << std::endl; - } - std::cout << std::endl; - break; - } - } - - if (!found) { - std::cout << "Shop not found" << std::endl; - } - - wait_for_enter(); - clear_screen(); - } - - return 0; -} \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/price.cpp b/sem1/EvdokimovMA/MiniHomeWork3/price.cpp deleted file mode 100644 index cbd632d9..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/price.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#pragma once - -#include "string" -#include "sstream" - -struct Price { - unsigned long long int rubles; - unsigned char kopecks; - - Price() { - rubles = 0; - kopecks = 0; - } - Price(unsigned long long int rubles, unsigned char kopecks) { - this->rubles = rubles; - this->kopecks = kopecks; - } - - explicit operator double() const { - return static_cast(rubles) + kopecks / 100.0; - } - - static Price parseFromString(std::string& str) { - std::istringstream stream(str); - unsigned long long int rubles; - unsigned short int kopecks; - - stream >> rubles; - stream >> kopecks; - - return Price(rubles, kopecks); - } - - Price operator+(Price other) { - Price result; - result.rubles = rubles + other.rubles; - result.kopecks = kopecks + other.kopecks; - if (result.kopecks >= 100) { - result.rubles++; - result.kopecks -= 100; - } - return result; - } - Price operator-(Price other) { - Price result; - result.rubles = rubles - other.rubles; - result.kopecks = kopecks - other.kopecks; - if (result.kopecks < 0) { - result.rubles--; - result.kopecks += 100; - } - return result; - } - Price operator*(unsigned long long int multiplier) { - Price result; - result.rubles = rubles * multiplier; - result.kopecks = kopecks * multiplier; - result.rubles += result.kopecks / 100; - result.kopecks %= 100; - return result; - } - Price operator/(unsigned long long int divider) { - Price result; - result.rubles = rubles / divider; - result.kopecks = kopecks / divider; - return result; - } - - bool operator>(Price other) { - return rubles > other.rubles || (rubles == other.rubles && kopecks > other.kopecks); - } - bool operator<(Price other) { - return rubles < other.rubles || (rubles == other.rubles && kopecks < other.kopecks); - } - bool operator>=(Price other) { - return rubles > other.rubles || (rubles == other.rubles && kopecks >= other.kopecks); - } - bool operator<=(Price other) { - return rubles < other.rubles || (rubles == other.rubles && kopecks <= other.kopecks); - } - bool operator==(Price other) { - return rubles == other.rubles && kopecks == other.kopecks; - } - bool operator!=(Price other) { - return rubles != other.rubles || kopecks != other.kopecks; - } - - std::string toString() { - return std::to_string(rubles) + "." + (kopecks < 10 ? "0" : "") + std::to_string(kopecks); - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/shop.cpp b/sem1/EvdokimovMA/MiniHomeWork3/shop.cpp deleted file mode 100644 index 487677f0..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/shop.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#pragma once - -#include "string" -#include "item.cpp" -#include -#include -#include - -class Shop { - std::string name; - std::string address; - -protected: - std::vector items; - -public: - Shop() { - name = "Unnamed shop"; - address = "No address"; - items = std::vector(); - } - ~Shop() { - for (auto item : items) { - delete item; - } - } - - void parseFromStream(std::ifstream& stream) { - // Parse shop data - parseShopData(stream); - - // Parse items count - std::string items_count_str; - std::getline(stream, items_count_str); - unsigned int items_count = std::stoi(items_count_str); - - // Parse items - items.reserve(items_count); - parseItems(stream, items_count); - } - - virtual void parseShopData(std::ifstream& stream) { - std::getline(stream, name); - std::getline(stream, address); - } - virtual void parseItems(std::ifstream& stream, unsigned int items_count) { - throw std::runtime_error("Not implemented"); - } - - std::string getName() { - return name; - } - std::string getAddress() { - return address; - } - const std::vector& getItems() const { - return items; - } -}; \ No newline at end of file diff --git a/sem1/EvdokimovMA/MiniHomeWork3/utils.cpp b/sem1/EvdokimovMA/MiniHomeWork3/utils.cpp deleted file mode 100644 index 26cef6f1..00000000 --- a/sem1/EvdokimovMA/MiniHomeWork3/utils.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -// Created by Maksim Evdokimov on 01.11.2024. -// - -#pragma once - -#include -#include - -static constexpr unsigned int hash_string(const char* data, size_t const size) noexcept { - unsigned int hash = 5381; - - for(const char *c = data; c < data + size; ++c) - hash = ((hash << 5) + hash) + (unsigned char) *c; - - return hash; -} - -static void clear_screen() { -#if defined _WIN32 - system("cls"); -#elif defined (__LINUX__) || defined(__gnu_linux__) || defined(__linux__) - system("clear"); -#elif defined (__APPLE__) - system("clear"); -#endif -} - -static void wait_for_enter() { - std::cout << "Press Enter to continue..."; - std::cin.ignore(); - std::cin.get(); -} \ No newline at end of file diff --git a/sem1/EvdokimovaAnna/MiniHomeWork1/task1.cpp b/sem1/EvdokimovaAnna/MiniHomeWork1/task1.cpp deleted file mode 100644 index 7c1df87b..00000000 --- a/sem1/EvdokimovaAnna/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -using std::cout; -using std::cin; - -int main() -{ - int side; - cout << "Enter the side of the square: "; - cin >> side; - cout << side * side; - return 0; -} diff --git a/sem1/EvdokimovaAnna/MiniHomeWork1/task2.cpp b/sem1/EvdokimovaAnna/MiniHomeWork1/task2.cpp deleted file mode 100644 index 22928bac..00000000 --- a/sem1/EvdokimovaAnna/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -using std::cout; -using std::cin; - -int main() -{ - int a; - int b; - int h; - - cout << "Enter the larger base: "; - cin >> a; - cout << "\nEnter the smaller base: "; - cin >> b; - cout << "\nEnter the height: "; - cin >> h; - cout << "\nArea of the trapezoid:"; - cout << (a + b) / 2 * h; - - return 0; -} diff --git a/sem1/EvdokimovaAnna/MiniHomeWork1/task3.cpp b/sem1/EvdokimovaAnna/MiniHomeWork1/task3.cpp deleted file mode 100644 index 10998931..00000000 --- a/sem1/EvdokimovaAnna/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -using std::cin; -using std::cout; -using std::endl; - -int main() -{ - int N; - - cout << "Enter the number of Fibonacci elements (>0): "; - cin >> N; - - long long first = 0, second = 1; - - cout << "\nA Fibonacci series of " << N << " elements: " << endl; - - for (int i = 0; i < N; ++i) { - if (i == 0) { - cout << first << " "; - } else if (i == 1) { - cout << second << " "; - } else { - long long next = first + second; - cout << next << " "; - first = second; - second = next; - } - } - cout << endl; - return 0; -} diff --git a/sem1/EvdokimovaAnna/MiniHomeWork1/task4.cpp b/sem1/EvdokimovaAnna/MiniHomeWork1/task4.cpp deleted file mode 100644 index 4481ebed..00000000 --- a/sem1/EvdokimovaAnna/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - int a, b = 0; - cout << "Enter a number: "; - cin >> a; - while (a > 0) - { - b *= 10; - b += (a % 10); - a /=10; - } - cout << b; - return 0; -} diff --git a/sem1/EvdokimovaAnna/MiniHomeWork3/hw3.cpp b/sem1/EvdokimovaAnna/MiniHomeWork3/hw3.cpp deleted file mode 100644 index 4ed20c86..00000000 --- a/sem1/EvdokimovaAnna/MiniHomeWork3/hw3.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include -#include -#include -#include -#include -#include - -using namespace std; - -class Item -{ -public: - string name; - double price; - double weight; - - Item(const string& n, double p, double w) : name(n), price(p), weight(w) {} -}; - -class ShopBase -{ -public: - virtual double averagePrice() const = 0; - virtual double averageWeight() const = 0; - virtual string getShopName() const = 0; -}; - -class CustomShop : public ShopBase -{ -protected: - vector items; - string shopName; - -public: - CustomShop(const string& name) : shopName(name) {} - - void addItem(const Item& item) - { - items.push_back(item); - } - - double averagePrice() const override - { - double totalPrice = 0; - for (const auto& item : items) - { - totalPrice += item.price; - } - return (items.size() > 0) ? totalPrice / items.size() : 0; - } - - double averageWeight() const override - { - double totalWeight = 0; - for (const auto& item : items) - { - totalWeight += item.weight; - } - return (items.size() > 0) ? totalWeight / items.size() : 0; - } - - string getShopName() const override - { - return shopName; - } -}; - -class ShopFruits : public CustomShop -{ -public: - ShopFruits() : CustomShop("Fruits") {} -}; - -class ShopVegetables : public CustomShop -{ -public: - ShopVegetables() : CustomShop("Vegetables") {} -}; - -class ShopDrinks : public CustomShop -{ -public: - ShopDrinks() : CustomShop("Drinks") {} -}; - -void processFile(const string& filename) -{ - ifstream file(filename); - string line; - CustomShop* currentShop = nullptr; - - while (getline(file, line)) - { - stringstream ss(line); - string word; - ss >> word; - - if (word == "Shop") - { - string shopName; - ss >> shopName; - - - if (shopName == "Fruits") - { - currentShop = new ShopFruits(); - } - else if (shopName == "Vegetables") - { - currentShop = new ShopVegetables(); - } - else if (shopName == "Drinks") - { - currentShop = new ShopDrinks(); - } - } - - if (word == "Items") - { - int itemCount; - ss >> itemCount; - for (int i = 0; i < itemCount; ++i) - { - string itemName; - double itemPrice, itemWeight; - getline(file, line); - stringstream itemStream(line); - itemStream >> itemName >> itemPrice >> itemWeight; - Item newItem(itemName, itemPrice, itemWeight); - currentShop -> addItem(newItem); - } - - - cout << "Shop: " << currentShop->getShopName() << endl; - cout << "Average price: " << fixed << setprecision(2) << currentShop -> averagePrice() << endl; - cout << "Average weight: " << fixed << setprecision(2) << currentShop -> averageWeight() << endl; - cout << "-----------------------------" << endl; - } - } - - file.close(); -} - -int main() -{ - string filename = "shopp.txt"; - processFile(filename); - - return 0; -} \ No newline at end of file diff --git a/sem1/EvdokimovaAnna/MiniHomeWork3/shopp.txt b/sem1/EvdokimovaAnna/MiniHomeWork3/shopp.txt deleted file mode 100644 index e84480b9..00000000 --- a/sem1/EvdokimovaAnna/MiniHomeWork3/shopp.txt +++ /dev/null @@ -1,23 +0,0 @@ -Shop Fruits -Items 5 -Apple 199 1000 -Grapes 500 200 -Pineapple 800 500 -Cherry 200 1000 -Banana 100 100 - -Shop Vegetables -Items 5 -Potatoes 40 1000 -Tomatoes 199 1000 -Carrot 149 500 -Courgette 150 100 -Onion 100 100 - -Shop Drinks -Items 5 -Wine 2000 950 -Energetic 60 450 -Water 50 1000 -Cola 200 1500 -Mineral water 70 1000 \ No newline at end of file diff --git a/sem1/EvdokimovaAnna/minihomework2/task2.1.cpp b/sem1/EvdokimovaAnna/minihomework2/task2.1.cpp deleted file mode 100644 index 2187f037..00000000 --- a/sem1/EvdokimovaAnna/minihomework2/task2.1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using std::cout; -using std::cin; - -int a; - -int main() -{ - cout << "Enter a number: "; - cin >> a; - cout << "\nhex:"; - cout << hex << a; - - cout << "\noct:"; - cout << oct << a; - - return 0; -} diff --git a/sem1/EvdokimovaAnna/minihomework2/task2.2.cpp b/sem1/EvdokimovaAnna/minihomework2/task2.2.cpp deleted file mode 100644 index 0ef99355..00000000 --- a/sem1/EvdokimovaAnna/minihomework2/task2.2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - int n; - cout << "Enter natural number:" << endl; - cin >> n; - while (n != 1) - { - if (n % 2 == 0) { n /= 2; } - else { n = ((n * 3) + 1) / 2; } - cout << n << endl; - } - return 0; -} diff --git a/sem1/Evgenii Stefanovskii/Minihomework 2/Task 2.cpp b/sem1/Evgenii Stefanovskii/Minihomework 2/Task 2.cpp deleted file mode 100644 index 99ca7988..00000000 --- a/sem1/Evgenii Stefanovskii/Minihomework 2/Task 2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -void siraHypothesis(int num) { - while(num != 1){ - if(num % 2 == 0){ - num /= 2; - } - else{ - num = num * 3 + 1; - } - std::cout << num << std::endl; - } -} - -int main() { - int num; - std::cout << "Enter natural number: " << std::endl; - std::cin >> num; - siraHypothesis(num); - std::cout << "The final sequence: " << std::endl; - return 0; -} \ No newline at end of file diff --git a/sem1/Evgenii Stefanovskii/Minihomework 2/Task1.cpp b/sem1/Evgenii Stefanovskii/Minihomework 2/Task1.cpp deleted file mode 100644 index 4fe172a6..00000000 --- a/sem1/Evgenii Stefanovskii/Minihomework 2/Task1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include -using namespace std; - -// Функция для преобразования десятичного числа в шестнадцатеричное -string tenTosixteen(int num) { - string result = ""; - while (num > 0) { - if (num % 16 < 10) { - result += to_string(num % 16); - } else { - result += (char)(num % 16 + 'A' - 10); - } - num /= 16; - } - reverse(result.begin(), result.end()); - return result; -} - -// Функция для преобразования десятичного числа в восьмеричное -string tenToeight(int num) { - string result = ""; - while (num > 0) { - result += to_string(num % 8); - num /= 8; - } - reverse(result.begin(), result.end()); - return result; -} - -int main(){ - int num; - std::cout << "Enter number" << endl; - std::cin >> num; - tenTosixteen(num); - tenToeight(num); - std::cout << "Hex number: " << tenTosixteen(num) << endl; - std::cout << "Oct number: " << tenToeight(num) << endl; - return 0; -} \ No newline at end of file diff --git a/sem1/Evgenii Stefanovskii/data.txt b/sem1/Evgenii Stefanovskii/data.txt deleted file mode 100644 index f5e2f31d..00000000 --- a/sem1/Evgenii Stefanovskii/data.txt +++ /dev/null @@ -1,15 +0,0 @@ -RTX3060 50000 100 2 -RTX4090 200000 150 3 -Iphone18ProMax 9999999 300 4 -XiaomiPlusMaxSuperLiteUltra 100 10 25 -Utyg 500 500 1 -Chipsi 150 50 2 -Pomidor 100 80 3 -Kartoshka 100 90 4 -Kola 80 200 1 -Fanta 100 220 2 -M60 20000000 300 412 -X5 300000000 400 4251 -X3 10000000 250 51254 -M5 40000000 500 24124 -M3 1000000 100 51245 \ No newline at end of file diff --git a/sem1/Evgenii Stefanovskii/dz3.cpp b/sem1/Evgenii Stefanovskii/dz3.cpp deleted file mode 100644 index 42ac5f29..00000000 --- a/sem1/Evgenii Stefanovskii/dz3.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include -#include -#include -#include - - -class ItemBase { -public: - std::string name; - int price; - int weight; - - - void parse(std::string s) { - - } -}; - -class Food : public ItemBase { -public: - int calories; - void parse(std::string s) { - std::string tmp = ""; - std::vector vars; - for (auto el : s) { - if (el == ' ') { - vars.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - vars.push_back(tmp); - name = vars[0]; - price = stoi(vars[1]); - calories = stoi(vars[2]); - weight = stoi(vars[3]); - } -}; - -class Technic : public ItemBase { -public: - int consumption; - void parse(std::string s) { - std::string tmp = ""; - std::vector vars; - for (auto el : s) { - if (el == ' ') { - vars.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - vars.push_back(tmp); - name = vars[0]; - price = stoi(vars[1]); - consumption = stoi(vars[2]); - weight = stoi(vars[3]); - } -}; - -class Wires : public ItemBase { -public: - int length; - void parse(std::string s) { - std::string tmp = ""; - std::vector vars; - for (auto el : s) { - if (el == ' ') { - vars.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - vars.push_back(tmp); - name = vars[0]; - price = stoi(vars[1]); - length = stoi(vars[2]); - weight = stoi(vars[3]); - } -}; - -class Shop { -public: - std::vector items; - - int getAveragePrice() { - int result = 0; - if (items.empty()) - return 0; - for (auto item : items) - result += item.price; - return result / items.size(); - } - int getAverageWeight() { - int result = 0; - if (items.empty()) - return 0; - for (auto item : items) - result += item.weight; - return result / items.size(); - } -}; - - - -int main() { - setlocale(LC_ALL, "ru"); - Shop technic, wires, food; - std::ifstream in; - in.open("data.txt"); - std::string line; - for (int i = 0; i < 5; ++i) { - getline(in, line); - Technic item; - item.parse(line); - technic.items.push_back(item); - } - for (int i = 0; i < 5; ++i) { - getline(in, line); - Food item; - item.parse(line); - food.items.push_back(item); - } - for (int i = 0; i < 5; ++i) { - getline(in, line); - Wires item; - item.parse(line); - wires.items.push_back(item); - } - - - std::cout << "Средняя цена в магазине техники: " << technic.getAveragePrice() << '\n'; - std::cout << "Средний вес в магазине техники: " << technic.getAverageWeight() << '\n'; - std::cout << "Средняя цена в продуктовом магазине: " << food.getAveragePrice() << '\n'; - std::cout << "Средний вес в продуктовом магазине: " << food.getAverageWeight() << '\n'; - std::cout << "Средняя цена в магазине проводов: " << wires.getAveragePrice() << '\n'; - std::cout << "Средний вес в магазине проводов: " << wires.getAverageWeight() << '\n'; - -} \ No newline at end of file diff --git "a/sem1/Fedor Sobolev/MIni Homework \342\204\2262/Task \342\204\2261.cpp" "b/sem1/Fedor Sobolev/MIni Homework \342\204\2262/Task \342\204\2261.cpp" deleted file mode 100644 index ae8fa75e..00000000 --- "a/sem1/Fedor Sobolev/MIni Homework \342\204\2262/Task \342\204\2261.cpp" +++ /dev/null @@ -1,23 +0,0 @@ -#include - -void decimaltohexadecimal(int decimal) { - setlocale(LC_ALL, "Russian"); - std::cout << "Шестнадцатеричное значение: " << std::hex << std::uppercase << decimal << std::endl; -} - -void decimaltooctal(int decimal) { - setlocale(LC_ALL, "Russian"); - std::cout << "Восьмеричное значение: " << std::oct << decimal << std::endl; -} - -int main() { - int decimal; - setlocale(LC_ALL, "Russian"); - std::cout << "Введите десятичное число: "; - std::cin >> decimal; - - decimaltohexadecimal(decimal); - decimaltooctal(decimal); - - return 0; -} \ No newline at end of file diff --git "a/sem1/Fedor Sobolev/MIni Homework \342\204\2262/Task \342\204\2262.cpp" "b/sem1/Fedor Sobolev/MIni Homework \342\204\2262/Task \342\204\2262.cpp" deleted file mode 100644 index b616c22c..00000000 --- "a/sem1/Fedor Sobolev/MIni Homework \342\204\2262/Task \342\204\2262.cpp" +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int main() { - - int number; - setlocale(LC_ALL, "Russian"); - std::cout << "Введите натуральное число: "; - std::cin >> number; - - while (number != 1) { - if (number % 2 == 0) { - number /= 2; - } - else { - number = (number * 3 + 1) / 2; - } - - std::cout << number << " "; - } - - std::cout << std::endl << "Число стало равно 1." << std::endl; - - return 0; -} \ No newline at end of file diff --git "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2261.cpp" "b/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2261.cpp" deleted file mode 100644 index 40bed946..00000000 --- "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2261.cpp" +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int sideofthesquare; - std::cout << "Введите длину стороны квадрата:"; - std::cin >> sideofthesquare; - std::cout << sideofthesquare * sideofthesquare; -} diff --git "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2262.cpp" "b/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2262.cpp" deleted file mode 100644 index dfa12e55..00000000 --- "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2262.cpp" +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int firstbaseofatrapezoid, secondbaseofatrapezoid, heightoftrapezoid; - std::cout << "Введите длину первого основании трапеции:"; - std::cin >> firstbaseofatrapezoid; - std::cout << "Введите длину второго основании трапеции:"; - std::cin >> secondbaseofatrapezoid; - std::cout << "Введите длину высоты трапеции:"; - std::cin >> heightoftrapezoid; - std::cout << (firstbaseofatrapezoid * secondbaseofatrapezoid) / 2 * heightoftrapezoid; -} diff --git "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2263.cpp" "b/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2263.cpp" deleted file mode 100644 index 7208c19c..00000000 --- "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2263.cpp" +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int firstnumber = 0, secondnumber = 1, thirdnumber, amount, counter = 0; - std::cout << "Введите количество элементов числа Фибоначчи:"; - std::cin >> amount; - std::cout << firstnumber << " " << secondnumber << " "; - for (counter; amount - 1 > counter; ++counter) { - thirdnumber = firstnumber + secondnumber; - firstnumber = secondnumber; - secondnumber = thirdnumber; - std::cout << thirdnumber << " "; - } -} diff --git "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2264.cpp" "b/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2264.cpp" deleted file mode 100644 index 087e8c0c..00000000 --- "a/sem1/Fedor Sobolev/Mini Homework \342\204\2261/Task \342\204\2264.cpp" +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int firstnumber = 0, secondnumber = 0; - std::cout << "Введите число:"; - std::cin >> firstnumber; - while (firstnumber > 0) { - secondnumber *= 10; - secondnumber += firstnumber % 10; - firstnumber /= 10; - } - std::cout << secondnumber; -} diff --git a/sem1/GinailoYosef/MiniHomework1/task1.cpp b/sem1/GinailoYosef/MiniHomework1/task1.cpp deleted file mode 100644 index 40eed804..00000000 --- a/sem1/GinailoYosef/MiniHomework1/task1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int getSquareArea(int squareSide){ - return squareSide * squareSide; -}; - -int main(){ - int squareSide; - std::cin >> squareSide; - std::cout << getSquareArea(squareSide); -}; \ No newline at end of file diff --git a/sem1/GinailoYosef/MiniHomework1/task2.cpp b/sem1/GinailoYosef/MiniHomework1/task2.cpp deleted file mode 100644 index 505db7f8..00000000 --- a/sem1/GinailoYosef/MiniHomework1/task2.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int getTrapezoidArea(int sideA, int sideB, int height){ - return (sideA + sideB) * height / 2; -} - -int main(){ - int sideA, sideB, height; - std::cin >> sideA, sideB, height; - std::cout << getTrapezoidArea(sideA, sideB, height); -}; \ No newline at end of file diff --git a/sem1/GinailoYosef/MiniHomework1/task3.cpp b/sem1/GinailoYosef/MiniHomework1/task3.cpp deleted file mode 100644 index 0a90d1bf..00000000 --- a/sem1/GinailoYosef/MiniHomework1/task3.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -void printFibonacciList(int elementsAmount){ - int twoStepsBackNum = 0; - int oneStepBackNum = 1; - - if (elementsAmount >= 1){ std::cout << twoStepsBackNum << " "; }; - if (elementsAmount >= 2){ std::cout << oneStepBackNum << " "; }; - - for (int i = 2; i < elementsAmount; i++){ - int currentResult = oneStepBackNum + twoStepsBackNum; - - std::cout << currentResult << " "; - - twoStepsBackNum = oneStepBackNum; - oneStepBackNum = currentResult; - }; -}; - -int main(){ - int elementsAmount; - std::cin >> elementsAmount; - printFibonacciList(elementsAmount); -}; \ No newline at end of file diff --git a/sem1/GinailoYosef/MiniHomework1/task4.cpp b/sem1/GinailoYosef/MiniHomework1/task4.cpp deleted file mode 100644 index 94f54179..00000000 --- a/sem1/GinailoYosef/MiniHomework1/task4.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -void printReverseDigits(int number){ - while (number >= 10){ - std::cout << number % 10; - number /= 10; - }; - - std::cout << number; -}; - -int main(){ - int number; - std::cin >> number; - printReverseDigits(number); -}; \ No newline at end of file diff --git a/sem1/GinailoYosef/MiniHomework2/task1.cpp b/sem1/GinailoYosef/MiniHomework2/task1.cpp deleted file mode 100644 index 34179014..00000000 --- a/sem1/GinailoYosef/MiniHomework2/task1.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include - -std::string convertNumber(int number, int base){ - std::string tempResult, result; - - while (number != 0){ - int remainder = number % base; - - if (remainder > 9){ - tempResult += (char)(remainder + 55); - } else { - tempResult += (char)(remainder + 48); - }; - - number = round(number / base); - }; - - for (int i = tempResult.length()-1; i >= 0; i--){ - result += tempResult[i]; - }; - - return result; -}; - -int main(){ - while (true) { - std::cout << "Do you want to convert number to:\n1. octal number\n2. hexadecimal number\nYour choice: "; - - int input, number; - std::cin >> input; - - if (input != 1 && input != 2){ - std::cout << "Thats not an option\n\n"; - - } else { - std::cout << "Enter a natural number: "; - std::cin >> number; - - if (number <= 0) { - std::cout << "This number is not a natural number\n\n"; - } else { - std::cout << "Result: " << convertNumber(number, input * 8) << "\n\n"; - }; - }; - }; -}; \ No newline at end of file diff --git a/sem1/GinailoYosef/MiniHomework2/task2.cpp b/sem1/GinailoYosef/MiniHomework2/task2.cpp deleted file mode 100644 index 07cc3e22..00000000 --- a/sem1/GinailoYosef/MiniHomework2/task2.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int main(){ - while (true) { - int number; - - std::cout << "Enter a natural number\nYour number: "; - std::cin >> number; - - int countOfTries = 0; - if (number <= 0){ - std::cout << "This is not a natural number\n\n"; - } else { - while (number != 1){ - countOfTries += 1; - - if (number % 2 == 0){ - number /= 2; - } else { - number = (number * 3 + 1)/2; - }; - }; - - std::cout << "Algorithm finished after " << countOfTries <<" actions. Result = 1\n\n"; - }; - }; -}; \ No newline at end of file diff --git a/sem1/GinailoYosef/MiniHomework3/ShopData.txt b/sem1/GinailoYosef/MiniHomework3/ShopData.txt deleted file mode 100644 index f77ea606..00000000 --- a/sem1/GinailoYosef/MiniHomework3/ShopData.txt +++ /dev/null @@ -1,21 +0,0 @@ -Shop PcParts -Items 5 -NVIDIA4060 700 3 400FPS -NVIDIA2050 250 3 80FPS -NVIDIA1660 150 3 50FPS -NVIDIA4090 2000 3 800FPS -NVIDIA3060 500 3 300FPS -Shop Products -Items 5 -Banana 3 1 20 -Apple 5 1 100 -Kiwi 10 1 30 -Mango 7 1 25 -Watermellon 30 10 15 -Shop Clothes -Items 5 -Yellow_T-Shirt 50 1 false -Black_Shirt 60 1 true -Jeans 60 1 true -Gloves 40 1 false -Top_Hat 100 2 true \ No newline at end of file diff --git a/sem1/GinailoYosef/MiniHomework3/Source.cpp b/sem1/GinailoYosef/MiniHomework3/Source.cpp deleted file mode 100644 index a2637342..00000000 --- a/sem1/GinailoYosef/MiniHomework3/Source.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include -#include -#include -#include - -class itemBase{ -public: - std::string name; - int cost, weight; - - itemBase(std::string _name, int _cost, int _weight){ - this->name = _name; - this->cost = _cost; - this->weight = _weight; - }; -}; - -class item : public itemBase{ -public: - std::string type; - - std::string fps; - int amount; - bool looksCool; - - item(std::string _name, int _cost, int _weight, int _amount) : itemBase(_name, _cost, _weight) { this->amount = _amount; this->type = "atableProduct"; }; - item(std::string _name, int _cost, int _weight, std::string _fps) : itemBase(_name, _cost, _weight) { this->fps = _fps; this->type = "pcPart"; }; - item(std::string _name, int _cost, int _weight, bool _looksCool) : itemBase(_name, _cost, _weight) { this->looksCool = _looksCool; this->type = "pieceOfClothing"; }; - - void printContent(){ - std::cout << "NAME: " << name << "\n"; - std::cout << "COST: " << cost << "\n"; - std::cout << "WEIGHT: " << weight << "\n"; - - if (type == "pcPart"){std::cout << "FPS: " << fps << "\n";}; - if (type == "atableProduct"){std::cout << "AMOUNT: " << amount << "\n";}; - if (type == "pieceOfClothing"){ - std::string result; - if (looksCool){ - result = "YES"; - } else { - result = "NO"; - }; - std::cout << "LOOKS COOL?: " << result << "\n"; - }; - }; -}; - -class shop{ -public: - std::string name; - std::vector content; - - shop(std::string _name, std::vector _content){ - this -> name = _name; - this -> content = _content; - }; - - void printContent(){ - std::cout << "Shop with " << name << ":\n\n"; - for (int i = 0; i < content.size(); i++){ - content[i].printContent(); - std::cout << "\n"; - }; - std::cout << "\n"; - }; - - float getAverageWeight(){ - int sum{0}; - for (int i = 0; i < content.size(); i++){ - sum += content[i].weight; - }; - return (float) sum/content.size(); - }; - - void printAverageWeight(){ - std::cout << "AVERAGE WEIGHT FOR A SHOP WITH " << name << " IS: " << getAverageWeight() << "\n\n"; - } - - float getAveragePrice(){ - int sum{0}; - for (int i = 0; i < content.size(); i++){ - sum += content[i].cost; - } - return (float) sum/content.size(); - }; - - void printAveragePrice(){ - std::cout << "AVERAGE PRICE FOR A SHOP WITH " << name << " IS: " << getAveragePrice() << "\n\n";; - } -}; - -class fileReader{ -public: - std::vector shops; - - void loadContent(){ - std::string line, shopName; - std::vector content; - std::string itemData[4]{"","","",""}; - int itemsAmount; - - std::ifstream in("ShopData.txt"); - if (in.is_open()){ - while (std::getline(in, line)){ - //Название магазина - shopName = line.substr(5); //Чтение строки с n-ного символа - - //Кол-во предметов - std::getline(in, line); - itemsAmount = std::stoi(line.substr(6)); //Перевод string в int - - for (int i=0; i < itemsAmount; i++){ - std::getline(in,line); - - int currentSlot{0}; - std::string temp{""}; - - for (int i = 0; i < line.length(); i++){ - if (currentSlot < 3){ - if (line[i] == ' '){ - itemData[currentSlot] = temp; - currentSlot += 1; - temp = ""; - } else { - temp += line[i]; - } - } else { - temp += line[i]; - } - } - - itemData[3] = temp; - - if (shopName == "Products"){ - item newItem(itemData[0], std::stoi(itemData[1]), std::stoi(itemData[2]), std::stoi(itemData[3])); - content.push_back(newItem); - - } else if (shopName == "PcParts"){ - item newItem(itemData[0], std::stoi(itemData[1]), std::stoi(itemData[2]), itemData[3]); - content.push_back(newItem); - - } else if (shopName == "Clothes"){ - bool thirdParam; - - if (itemData[3] == "true"){ - thirdParam = true; - } else { - thirdParam = false; - } - - item newItem(itemData[0], std::stoi(itemData[1]), std::stoi(itemData[2]), thirdParam); - content.push_back(newItem); - } - }; - - shop newShop(shopName, content); - content.clear(); - shops.push_back(newShop); - }; - }; - - in.close(); - }; - - fileReader(){ - loadContent(); - } - - void printContent(){ - for (int i = 0; i < shops.size(); i++){ - shops[i].printContent(); - }; - }; - - void printAveragePrices(){ - for (int i = 0; i < shops.size(); i++){ - shops[i].printAveragePrice(); - }; - }; - - void printAverageWeights(){ - for (int i = 0; i < shops.size(); i++){ - shops[i].printAverageWeight(); - }; - }; -}; - -int main(){ - fileReader reader; - int userInput; - - std::cout << "CHOOSE AN OPTION:\n"; - std::cout << "1) PRINT AVERAGE PRICES\n"; - std::cout << "2) PRINT AVERAGE WEIGHTS\n"; - std::cout << "3) PRINT ALL THE CONTENT\n"; - - while (std::cin >> userInput){ - if (userInput == 1){ - reader.printAveragePrices(); - } else if (userInput == 2){ - reader.printAverageWeights(); - } else if (userInput == 3){ - reader.printContent(); - } else { - std::cout << "NOT AN OPTION\n"; - }; - }; -} \ No newline at end of file diff --git a/sem1/GrigoryevAA/MiniHomeWork1/task1.cpp b/sem1/GrigoryevAA/MiniHomeWork1/task1.cpp deleted file mode 100644 index 7f57a619..00000000 --- a/sem1/GrigoryevAA/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -double SquareBox(double side) -{ - return side * side; -} - - -int main() -{ - double side = 0; - - while (true) - { - std::cout << "Enter side of your box: "; - std::cin >> side; - if (side < 0) - { - break; - } - else - { - std::cout << "Square of your box is " << SquareBox(side) << std::endl; - } - } -} diff --git a/sem1/GrigoryevAA/MiniHomeWork1/task2.cpp b/sem1/GrigoryevAA/MiniHomeWork1/task2.cpp deleted file mode 100644 index 0cd72c10..00000000 --- a/sem1/GrigoryevAA/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include - -double SquareTrapezoid(double baseUp, double baseDown, double sideLeft, double sideRight) -{ - double part = (pow(baseDown - baseUp, 2) + pow(sideLeft, 2) - pow(sideRight, 2)) / (2 * (baseDown - baseUp)); - double square = (baseDown + baseUp) / 2 * (std::sqrt(pow(sideLeft, 2) - pow(part, 2))); - - return square; -} - - -int main() -{ - double baseUp = 0; - double baseDown = 0; - double sideLeft = 0; - double sideRight = 0; - - while (true) - { - std::cout << "Enter up base of trapezoid: "; - std::cin >> baseUp; - std::cout << "Enter down base of trapezoid: "; - std::cin >> baseDown; - std::cout << "Enter left side of trapezoid: "; - std::cin >> sideLeft; - std::cout << "Enter right side of trapezoid: "; - std::cin >> sideRight; - - if (baseUp < 0 || baseDown < 0 || sideLeft < 0 || sideRight < 0) - { - break; - } - else - { - std::cout << "Square of your trapezoid is " << SquareTrapezoid(baseUp, baseDown, sideLeft, sideRight) << std::endl; - } - } -} diff --git a/sem1/GrigoryevAA/MiniHomeWork1/task3.cpp b/sem1/GrigoryevAA/MiniHomeWork1/task3.cpp deleted file mode 100644 index bd2f6e5d..00000000 --- a/sem1/GrigoryevAA/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include - -int main() -{ - int N = 0; - while (true) - { - std::cout << "Quantity of Fibonacci numbers: "; - std::cin >> N; - std::cout << "" << std::endl; - if (N == 0) - { - break; - } - else if (N == 1) - { - std::cout << 0 << std::endl; - } - else if (N == 2) - { - std::cout << 0 << std::endl; - std::cout << 1 << std::endl; - } - else - { - double a = 0; - double b = 1; - - std::cout << 0 << std::endl; - std::cout << 1 << std::endl; - - for (int i = 0; i < N - 2; i++) - { - double c = a + b; - std::cout << c << std::endl; - a = b; - b = c; - } - } - std::cout << "" << std::endl; - } - -} diff --git a/sem1/GrigoryevAA/MiniHomeWork1/task4.cpp b/sem1/GrigoryevAA/MiniHomeWork1/task4.cpp deleted file mode 100644 index b5dbb54a..00000000 --- a/sem1/GrigoryevAA/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int main() -{ - long long N = 0; - while (true) - { - std::cout << "Enter number: "; - std::cin >> N; - std::cout << "" << std::endl; - if (N == 0) - { - std::cout << "0"; - } - else - { - while (N > 0) - { - std::cout << N % 10; - N /= 10; - } - } - std::cout << "" << std::endl; - std::cout << "" << std::endl; - } - -} diff --git a/sem1/GrigoryevAA/MiniHomeWork2/task1.cpp b/sem1/GrigoryevAA/MiniHomeWork2/task1.cpp deleted file mode 100644 index 618126de..00000000 --- a/sem1/GrigoryevAA/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include - -int to_oct(long long num) -{ - std::string result; - - while (num != 0) - { - result += std::to_string(num % 8); - num /= 8; - } - - std::reverse(result.begin(), result.end()); - - return std::stoi(result); -} - -std::string to_hex(long long num) -{ - std::string result; - - while (num != 0) - { - int current_mod = num % 16; - - switch (current_mod) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - result += std::to_string(current_mod); - break; - case 10: - result += 'A'; - break; - case 11: - result += 'B'; - break; - case 12: - result += 'C'; - break; - case 13: - result += 'D'; - break; - case 14: - result += 'E'; - break; - case 15: - result += 'F'; - break; - } - - num /= 16; - } - std::reverse(result.begin(), result.end()); - - return result; -} - - - -int main() -{ - long long num; - - int num_sys; - - std::cout << "Hi! Welcome to program for conversion from decimal to octal and hexadecimal number systems!" << std::endl; - while (true) - { - std::cout << "Enter number: "; - std::cin >> num; - std::cout << "Choose number system." << std::endl; - std::cout << "1 - octal (8)" << std::endl; - std::cout << "2 - hexadecimal (16)" << std::endl; - std::cin >> num_sys; - - switch (num_sys) - { - case 1: - std::cout << to_oct(num); - break; - case 2: - std::cout << to_hex(num); - break; - } - - std::cout << "" << std::endl; - } - -} diff --git a/sem1/GrigoryevAA/MiniHomeWork2/task2.cpp b/sem1/GrigoryevAA/MiniHomeWork2/task2.cpp deleted file mode 100644 index 5373de81..00000000 --- a/sem1/GrigoryevAA/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include - - -int main() -{ - long long num; - - - std::cout << "Hi! Welcome to program for testing the Syracuse hypothesis!" << std::endl; - while (true) - { - std::cout << "Please, enter the number: "; - std::cin >> num; - - while (num != 1) - { - if (num % 2 == 0) - { - std::cout << num << " it's a even number, so we divide by 2" << std::endl; - num /= 2; - std::cout << "Result: " << num << std::endl; - - } - else - { - std::cout << num << " it's a odd number, so we multiply by 3, add 1, divide by 2" << std::endl; - num *= 3; - num += 1; - num /= 2; - std::cout << "Result: " << num << std::endl; - } - } - std::cout << "" << std::endl; - } - - - - -} diff --git a/sem1/HilinskiyKK/MiniHomeWork3/Mini homework 3.cpp b/sem1/HilinskiyKK/MiniHomeWork3/Mini homework 3.cpp deleted file mode 100644 index 5057ba19..00000000 --- a/sem1/HilinskiyKK/MiniHomeWork3/Mini homework 3.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include -#include -#include -#include - -class ItemBase { -public: - virtual ~ItemBase() = default; - virtual double getPrice() const = 0; - virtual double getWeight() const = 0; -}; - -class Item : public ItemBase { -private: - std::string name; - double price; - double weight; - -public: - Item(const std::string& name, double price, double weight) - : name(name), price(price), weight(weight) {} - - double getPrice() const override { - return price; - } - - double getWeight() const override { - return weight; - } -}; - -class Shop { -private: - std::string name; - std::vector> items; - -public: - Shop(const std::string& name) : name(name) {} - - void addItem(std::unique_ptr item) { - items.push_back(std::move(item)); - } - - double averagePrice() const { - if (items.empty()) return 0.0; - - double totalPrice = 0.0; - for (const auto& item : items) { - totalPrice += item->getPrice(); - } - return totalPrice / items.size(); - } - - double averageWeight() const { - if (items.empty()) return 0.0; - - double totalWeight = 0.0; - for (const auto& item : items) { - totalWeight += item->getWeight(); - } - return totalWeight / items.size(); - } - - const std::string& getName() const { - return name; - } -}; - -void processShopData(const std::string& data, std::vector& shops) { - std::istringstream stream(data); - std::string line; - - while (std::getline(stream, line)) { - if (line.find("Shop") != std::string::npos) { - std::string shopName = line.substr(5); - Shop shop(shopName); - - std::getline(stream, line); // Read "Items X" - int numItems = std::stoi(line.substr(6)); - - for (int i = 0; i < numItems; ++i) { - std::getline(stream, line); - std::istringstream itemStream(line); - std::string itemName; - double price, weight; - itemStream >> itemName >> price >> weight; - - // Добавляем предмет в магазин - shop.addItem(std::make_unique(itemName, price, weight)); - } - - shops.push_back(std::move(shop)); - } - } -} - -int main() { - std::string data = R"( -Shop PCBrutal -Items 5 -KCAS600W 10 6 -RYZEN7 15 1 -ASEROCK-A320 13 5 -RTX4060 40 7 -DDR5-6000 18 2 -Shop BestTables -Items 6 -Oak-desk 52 187 -Birch-bench 46 190 -Glass-table 43 78 -Green-chair 29 55 -Dark-closet 64 199 -Double-bed 58 165 -Shop Underwater-water -Items 5 -Salt-water 2 5 -Rose-flavored-water 4 5 -Fish-water 3 5 -Iron-water 7 5 -BIG-water 100 250 -)"; - - std::vector shops; - processShopData(data, shops); - - for (const auto& shop : shops) { - std::cout << "Shop: " << shop.getName() << "\n"; - std::cout << "Average Price: " << shop.averagePrice() << "\n"; - std::cout << "Average Weight: " << shop.averageWeight() << "\n"; - } - - return 0; -} diff --git a/sem1/IlyaKruk/MiniHomeWork1/task1.cpp b/sem1/IlyaKruk/MiniHomeWork1/task1.cpp deleted file mode 100644 index b63cfb97..00000000 --- a/sem1/IlyaKruk/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -using namespace std; -int main() -{ - int a; - cout << "Enter the side of the square" << endl; - cin >> a; - cout << "Its area is " << a * a; -} diff --git a/sem1/IlyaKruk/MiniHomeWork1/task2.cpp b/sem1/IlyaKruk/MiniHomeWork1/task2.cpp deleted file mode 100644 index 4a73d578..00000000 --- a/sem1/IlyaKruk/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -using namespace std; -int main() -{ - int a, b, h; - cout << "Enter trapezoid's bases" << endl; - cin >> a >> b; - cout << "Enter trapeziod's height" << endl; - cin >> h; - cout << "Its area is " << (a + b) / 2 * h; -} diff --git a/sem1/IlyaKruk/MiniHomeWork1/task3.cpp b/sem1/IlyaKruk/MiniHomeWork1/task3.cpp deleted file mode 100644 index 741a4273..00000000 --- a/sem1/IlyaKruk/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -using namespace std; -int main() -{ - int n; - cout << "How many fibonacci numbers do you want?" << endl; - cin >> n; - int a = 0, b = 1, c = 0; - for (int i = 0; i < n; i++) - { - cout << a << ' '; - c = a; - a = b; - b = c + b; - } -} diff --git a/sem1/IlyaKruk/MiniHomeWork1/task4.cpp b/sem1/IlyaKruk/MiniHomeWork1/task4.cpp deleted file mode 100644 index e325296a..00000000 --- a/sem1/IlyaKruk/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -using namespace std; -int main() -{ - long long int a; - cout << "Which number do you want to reverse?" << endl; - cin >> a; - while (true) - { - cout << a % 10; - a /= 10; - if (a == 0) - { - break; - } - } -} \ No newline at end of file diff --git a/sem1/IsaevDS/ddzddd.cpp b/sem1/IsaevDS/ddzddd.cpp deleted file mode 100644 index a862cd6e..00000000 --- a/sem1/IsaevDS/ddzddd.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase { -protected: - std::string name; - double price; - double weight; -public: - ItemBase(const std::string& name, double price, double weight) - : name(name), price(price), weight(weight) {} - - virtual ~ItemBase() = default; - - double getPrice() { return price; } - double getWeight() { return weight; } -}; - -class MilkItem : public ItemBase { -public: - MilkItem(const std::string& name, double price, double weight) - : ItemBase(name, price, weight) {} -}; -class GameItem : public ItemBase { -public: - GameItem(const std::string& name, double price, double weight) - : ItemBase(name, price, weight) {} -}; -class PCItem : public ItemBase { -public: - PCItem(const std::string& name, double price, double weight) - : ItemBase(name, price, weight) {} -}; -class Shop { -private: - std::string name; - std::vector items; // Храним указатели на предметы -public: - Shop(const std::string& name) : name(name) {} - - ~Shop() { - - } - - void addItem(ItemBase* item) { - items.push_back(item); - } - - double calculateAveragePrice() const { - if (items.empty()) return 0.0; - double totalPrice = 0.0; - for (const auto& item : items) { - totalPrice += item->getPrice(); - } - return totalPrice / items.size(); - } - - double calculateAverageWeight() const { - if (items.empty()) return 0.0; - double totalWeight = 0.0; - for (const auto& item : items) { - totalWeight += item->getWeight(); - } - return totalWeight / items.size(); - } - - void printStatistics() const { - std::cout << "Shop: " << name << '\n'; - std::cout << "Average Price: " << calculateAveragePrice() << '\n'; - std::cout << "Average Weight: " << calculateAverageWeight() << '\n'; - } -}; - -void parseFile(std::vector& shops) { - std::fstream file("shops.txt"); - if (!file.is_open()) { - std::cout << "sss" << '\n'; - return; - } - - std::string line; - Shop* currentShop = nullptr; - std::string shopName; - while (getline(file, line)) { - std::stringstream ss(line); - std::string word; - - int itemCount = 0; - ss >> word; - - if (word == "Shop") { - - ss >> shopName; - shops.emplace_back(shopName); - currentShop = &shops.back(); - } - else if (word == "Items" && currentShop != nullptr) { - ss >> itemCount; - for (int i = 0; i < itemCount; i++) - { - getline(file, line); - std::stringstream ss(line); - ss >> word; - std::string itemName = word; - double price, weight; - ss >> price >> weight; - if (shopName == "Milkshop") - { - currentShop->addItem(new MilkItem(itemName, price, weight)); - } - else if (shopName == "Peckarnya") - { - currentShop->addItem(new PCItem(itemName, price, weight)); - } - else if (shopName == "Gamesi") - { - currentShop->addItem(new GameItem(itemName, price, weight)); - } - } - } - } - - file.close(); -} - -int main() { - std::vector shops; - parseFile(shops); - - for (const auto& shop : shops) { - shop.printStatistics(); - std::cout << std::endl; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/IsaevDS/shops.txt b/sem1/IsaevDS/shops.txt deleted file mode 100644 index 8ecab50d..00000000 --- a/sem1/IsaevDS/shops.txt +++ /dev/null @@ -1,23 +0,0 @@ -Shop Milkshop -Items 5 -MilkFresh 2.5 1.0 -MilkLowFat 3.0 1.0 -MilkChocolate 4.5 1.2 -MilkAlmond 5.0 1.1 -MilkCoconut 6.0 1.3 - -Shop Peckarnya -Items 5 -GamingPC 1500.0 15.0 -OfficePC 800.0 10.0 -UltraPC 2500.0 20.0 -BudgetPC 500.0 8.0 -CreatorPC 1800.0 12.0 - -Shop Gamesi -Items 5 -GameOverwatch 30.0 0.05 -GameMinecraft 25.0 0.04 -GameFortnite 0.0 0.06 -GameCyberpunk 40.0 0.05 -GameStardewValley 15.0 0.03 diff --git a/sem1/IsaevDmitrii/MiniHomeWork1/task1.cpp b/sem1/IsaevDmitrii/MiniHomeWork1/task1.cpp deleted file mode 100644 index d74dbe66..00000000 --- a/sem1/IsaevDmitrii/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -float squareOfSquare(float a) -{ - return a * a; -} - -int main() -{ - float side; - std::cin >> side; - std::cout< - -float squareOfTrapezium(float p1, float p2, float h) -{ - return (p1+p2)/2*h; -} - -int main() -{ - float side1, side2, height; - std::cin >> side1 >> side2 >> height; - std::cout< - -void fibonachi(int N, int counter, int least1,int least2) -{ - if (counter >= N) - return; - if (counter == 0 or counter == 1) { - std::cout << 1 <<' '; - return (fibonachi(N, counter + 1, 1, 1)); - } - std::cout << least1 + least2 << ' '; - return(fibonachi(N,counter+1,least2, least1 + least2)); -} - -int main() -{ - int N; - std::cin >>N; - fibonachi(N,0,0,0); -} \ No newline at end of file diff --git a/sem1/IsaevDmitrii/MiniHomeWork1/task4.cpp b/sem1/IsaevDmitrii/MiniHomeWork1/task4.cpp deleted file mode 100644 index 78dd17c3..00000000 --- a/sem1/IsaevDmitrii/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - int reverse(int N) { - int ans = 0; - int numCounter = 0; - for (int i = 1; (N % (int)pow(10, (i - 1))) != N; i++) { - numCounter++; - } - for (int i=1; (N % (int)pow(10, (i - 1))) != N; i++) { - int num = N % (int)pow(10, i) / (int)pow(10,i-1); - ans += num * (int)pow(10, (numCounter-i)); - } - return ans; -} - -int main() -{ - int N; - - std::cin >>N; - std::cout< -#include - -std::string numBaseMax16(int num10, int n) -{ - std::string result; - char base[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','F' }; - while(num10/n!=0) - { - result += base[num10 % n]; - num10 /= n; - } - result += base[num10 % n]; - reverse(result.begin(),result.end()); - return result; -} -int main() -{ - int num; - std::cin >> num; - std::cout << numBaseMax16(num, 8) << "\n" << numBaseMax16(num, 16); -} \ No newline at end of file diff --git a/sem1/IsaevDmitrii/MiniHomework2/Task2.cpp b/sem1/IsaevDmitrii/MiniHomework2/Task2.cpp deleted file mode 100644 index fafa1753..00000000 --- a/sem1/IsaevDmitrii/MiniHomework2/Task2.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -void CollatzConjecture(int n) -{ - while (n != 1) - { - if (n == 1) { - return; - } - if (n % 2 == 0) - { - n /= 2; - std::cout << n << '\n'; - } - else - { - n = (n * 3 + 1); - std::cout << n << '\n'; - } - } -} -int main() -{ - int num; - std::cin >> num; - CollatzConjecture(num); -} \ No newline at end of file diff --git a/sem1/Juliana Grigoreva/MiniHomeWork1/task1.cpp b/sem1/Juliana Grigoreva/MiniHomeWork1/task1.cpp deleted file mode 100644 index 6339bd95..00000000 --- a/sem1/Juliana Grigoreva/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() -{ - int a; - std::cin >> a; - std::cout << a * a; -} \ No newline at end of file diff --git a/sem1/Juliana Grigoreva/MiniHomeWork1/task2.cpp b/sem1/Juliana Grigoreva/MiniHomeWork1/task2.cpp deleted file mode 100644 index 2afd4519..00000000 --- a/sem1/Juliana Grigoreva/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int(a); - int(b); - int(h); - std::cout << "Определение площади трапеции" << std::endl; - std::cout << "Введите вверхнюю сторону трапеции" << std::endl; - std::cin >> a; - std::cout << "Введите нижнюю сторону трапеции" << std::endl; - std::cin >> b; - std::cout << "Введите высоту трапеции" << std::endl; - std::cin >> h; - std::cout << "S = " << (a + b) / 2 * h; -} - diff --git a/sem1/Juliana Grigoreva/MiniHomeWork1/task3.cpp b/sem1/Juliana Grigoreva/MiniHomeWork1/task3.cpp deleted file mode 100644 index 3a2abc9b..00000000 --- a/sem1/Juliana Grigoreva/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main() { - int n; int i; int a = 0; int b = 1; int c; - std::cin >> n; - std::cout << a << " " << b << " "; - while (i < (n - 2)) { - i++; - c = a + b; - a = b; - b = c; - std::cout << c << " "; - } -} \ No newline at end of file diff --git a/sem1/Juliana Grigoreva/MiniHomeWork1/task4.cpp b/sem1/Juliana Grigoreva/MiniHomeWork1/task4.cpp deleted file mode 100644 index c5fa69fd..00000000 --- a/sem1/Juliana Grigoreva/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() { - int n; int b = 0; - std::cin >> n; - while (n > 0) { - b *= 10; - b += n % 10; - n /= 10; - } - std::cout << b; -} \ No newline at end of file diff --git a/sem1/Juliana Grigoreva/MiniHomeWork2/task1.cpp b/sem1/Juliana Grigoreva/MiniHomeWork2/task1.cpp deleted file mode 100644 index 09210ccd..00000000 --- a/sem1/Juliana Grigoreva/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -int main() { - int a; - std::string b = ""; - std::cin >> a; - int a0 = a; - while (a > 0) { - std::string a1 = std::to_string(a % 8); - b += a1; - a /= 8; - } - reverse(b.begin(), b.end()); - std::cout << b << " - oct" << std::endl; - - std::string b0 = ""; - while (a0 > 0) { - std::string a01 = std::to_string(a0 % 16); - b0 += a01; - a0 /= 16; - } - reverse(b0.begin(), b0.end()); - std::cout << b0 << " - hex"; -} \ No newline at end of file diff --git a/sem1/Juliana Grigoreva/MiniHomeWork2/task2.cpp b/sem1/Juliana Grigoreva/MiniHomeWork2/task2.cpp deleted file mode 100644 index 81b601dc..00000000 --- a/sem1/Juliana Grigoreva/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -// - -int main() { - int a; - std::cin >> a; - while (a != 1) { - if (a % 2 == 0) { - a /= 2; - } - else { - a = (a * 3 + 1) / 2; - } - std::cout << a << " "; - } -} - -// . , -// \ No newline at end of file diff --git a/sem1/Kamalova Julia/MiniHomeWork2/task1.cpp b/sem1/Kamalova Julia/MiniHomeWork2/task1.cpp deleted file mode 100644 index 3f3bc9f2..00000000 --- a/sem1/Kamalova Julia/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include - -std::string decToOct(int dec) { - std::string oct = ""; - if (dec == 0) { - return "0"; - } - while (dec > 0) { - int remainder = dec % 8; - oct = std::to_string(remainder) + oct; - dec /= 8; - } - return oct; -} - -std::string decToHex(int dec) { - std::string hex = ""; - if (dec == 0) { - return "0"; - } - while (dec > 0) { - int remainder = dec % 16; - if (remainder < 10) { - hex = std::to_string(remainder) + hex; - } - else { - char hexDigit = 'A' + (remainder - 10); - hex = hexDigit + hex; - } - dec /= 16; - } - return hex; -} - -int main() { - setlocale(LC_ALL, "RUS"); - int decNum; - std::cout << "Десятичное число: "; - std::cin >> decNum; - - std::cout << "Восьмеричное число: " << decToOct(decNum) << std::endl; - std::cout << "Шестнадцатеричное число: " << decToHex(decNum) << std::endl; - - return 0; -} diff --git a/sem1/Kamalova Julia/MiniHomeWork2/task2.cpp b/sem1/Kamalova Julia/MiniHomeWork2/task2.cpp deleted file mode 100644 index 027d47a0..00000000 --- a/sem1/Kamalova Julia/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -#include -int main() { - setlocale(LC_ALL, "RUS"); - int x; - std::cout << "Введите число: "; - std::cin >> x; - - while (x != 1) { - if (x % 2 == 0) { - x /= 2; - std::cout << x << " "; - } - else { - x = (x * 3) + 1; - std::cout << x << " "; - } - } - std::cout << std::endl; - std::cout << "Гипотеза верна"; - return 0; -} diff --git a/sem1/KarpachMA/MiniHomework1/task1.cpp b/sem1/KarpachMA/MiniHomework1/task1.cpp deleted file mode 100644 index e8315338..00000000 --- a/sem1/KarpachMA/MiniHomework1/task1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -int findSquareSpace(int squareSide); -int main() -{ - int squareSide = 0; - std::cout << "Введите размер стороны квадрата" << std::endl; - std::cin >> squareSide; - std::cout << "Площадь квадрата равна " << findSquareSpace(squareSide); -} -int findSquareSpace(int squareSide){ - return squareSide * squareSide; -} \ No newline at end of file diff --git a/sem1/KarpachMA/MiniHomework1/task2.cpp b/sem1/KarpachMA/MiniHomework1/task2.cpp deleted file mode 100644 index 26d18324..00000000 --- a/sem1/KarpachMA/MiniHomework1/task2.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -int findTrapezoidSpace(int trapezoidHeight, int trapezoidMidline); -int main() -{ - int trapezoidHeight = 0; - int trapezoidMidline = 0; - std::cout << "Введите размер высоты трапеции" << std::endl; - std::cin >> trapezoidHeight; - std::cout << "Введите размер средней линии трапеции" << std::endl; - std::cin >> trapezoidMidline; - std::cout << "Площадь трапеции равна " << findTrapezoidSpace(trapezoidHeight, trapezoidMidline); -} -int findTrapezoidSpace(int trapezoidHeight, int trapezoidMidline){ - return trapezoidHeight*trapezoidMidline; -} \ No newline at end of file diff --git a/sem1/KarpachMA/MiniHomework1/task3.cpp b/sem1/KarpachMA/MiniHomework1/task3.cpp deleted file mode 100644 index c910245d..00000000 --- a/sem1/KarpachMA/MiniHomework1/task3.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -void displayFibonacciNumbers(int numbersCount); -int main() -{ - int numbersCount = 0; - std::cout << "Введите количество чисел Фибоначчи" << std::endl; - std::cin >> numbersCount; - displayFibonacciNumbers(numbersCount); -} -void displayFibonacciNumbers(int numbersCount){ - if (numbersCount == 1){ - std::cout << "0"; - } else if (numbersCount == 2){ - std::cout << "0" << std::endl; - std::cout << "1"; - } else { - int firstNumber = 0; - int firstNumberDublicate = 0; - int secondNumber = 1; - std::cout << "0" << std::endl; - std::cout << "1" << std::endl; - for (int i = 0; i < numbersCount-2; i++){ - std::cout << firstNumber + secondNumber << std::endl; - firstNumberDublicate = firstNumber; - firstNumber = secondNumber; - secondNumber = firstNumberDublicate + secondNumber; - } - } -} \ No newline at end of file diff --git a/sem1/KarpachMA/MiniHomework1/task4.cpp b/sem1/KarpachMA/MiniHomework1/task4.cpp deleted file mode 100644 index 2d45ffe7..00000000 --- a/sem1/KarpachMA/MiniHomework1/task4.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -int numberBackwards(int number); -int main() -{ - int number = 0; - std::cout << "Введите число" << std::endl; - std::cin >> number; - std::cout << "Число наоборот это "; - std::cout << numberBackwards(number); -} -int numberBackwards(int number){ - int numberLength = 0; - int numberDublciate = number; - int transformedNumber = 0; - while (number > 0) - { - numberLength++; - number /= 10; - } - while (numberDublciate > 0) - { - transformedNumber += ((pow(10, numberLength - 1)) * (numberDublciate % 10)); - numberDublciate /= 10; - numberLength--; - } - - return transformedNumber; -} diff --git a/sem1/KazakAV/HW1.cpp b/sem1/KazakAV/HW1.cpp deleted file mode 100644 index a75e0782..00000000 --- a/sem1/KazakAV/HW1.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main() { - int st = 0; - std::cin >> st; - std::cout << st * st << std::endl; -} \ No newline at end of file diff --git a/sem1/KazakAV/HW2.cpp b/sem1/KazakAV/HW2.cpp deleted file mode 100644 index c424b10c..00000000 --- a/sem1/KazakAV/HW2.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main() { - int a1, a2, h; - std::cin >> a1 >> a2 >> h; - std::cout << (a1 + a2) * 0.5 * h; -} \ No newline at end of file diff --git a/sem1/KazakAV/HW3.cpp b/sem1/KazakAV/HW3.cpp deleted file mode 100644 index 9eb42b6c..00000000 --- a/sem1/KazakAV/HW3.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int main() { - int number; - int i0 = 0; - int i1 = 1; - std::cin >> number; - if (number == 0) { - std::cout << "wrong"; - } - else{ - std::cout << "1 "; - for (int i = 0; i < number - 1; i++) { - std::cout << (i1 + i0) << " "; - i1 = i0 + i1; - i0 = i1 - i0; - } - } -} diff --git "a/sem1/KazakAV/hw2/\320\274\320\265.cpp" "b/sem1/KazakAV/hw2/\320\274\320\265.cpp" deleted file mode 100644 index 2ac2688b..00000000 --- "a/sem1/KazakAV/hw2/\320\274\320\265.cpp" +++ /dev/null @@ -1,7 +0,0 @@ -#include -int main() { - int number = 0; - std::cin >> number; - std::cout << std::oct << number << " - octal number notation" << std::endl; - std::cout << std::hex << number << " - hexadecimal number notation"; -} \ No newline at end of file diff --git "a/sem1/KazakAV/hw2/\320\274\320\2652.cpp" "b/sem1/KazakAV/hw2/\320\274\320\2652.cpp" deleted file mode 100644 index a6718dad..00000000 --- "a/sem1/KazakAV/hw2/\320\274\320\2652.cpp" +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main() { - int number = 0; - std::cin >> number; - while (number != 1) { - if (number % 2 == 0) { - number = number / 2; - } - else { - number = ((number * 3) + 1) / 2; - } - } - if (number == 1) { - std::cout << "True"; - } -} \ No newline at end of file diff --git a/sem1/KazakAV/hw4.cpp b/sem1/KazakAV/hw4.cpp deleted file mode 100644 index d8e6e4ac..00000000 --- a/sem1/KazakAV/hw4.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main() { - int n; - std::cin >> n; - while (n > 0) { - int n1 = n % 10; - n = n / 10; - std::cout << n1; - } -} diff --git a/sem1/KhetagKambolov/MiniHomeWork1/Task1.cpp b/sem1/KhetagKambolov/MiniHomeWork1/Task1.cpp deleted file mode 100644 index 98e081de..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -double Square(double side) -{ - return side * side; -} - -int main() -{ - double input; - std::cout << "Enter the size of a square: "; - std::cin >> input; - std::cout << Square(input); -} - - - - - - - diff --git a/sem1/KhetagKambolov/MiniHomeWork1/Task2.cpp b/sem1/KhetagKambolov/MiniHomeWork1/Task2.cpp deleted file mode 100644 index 67406073..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -double Trapezoid(double side1, double side2, double height) -{ - return (side1 + side2) * height / 2; -} - -int main() -{ - double side1, side2, height; - std::cout << "Enter the size of the first side: "; - std::cin >> side1; - std::cout << "Enter the size of the second side: "; - std::cin >> side2; - std::cout << "Enter the height: "; - std::cin >> height; - std::cout << Trapezoid(side1, side2, height); -} - - - - - - - diff --git a/sem1/KhetagKambolov/MiniHomeWork1/Task3.cpp b/sem1/KhetagKambolov/MiniHomeWork1/Task3.cpp deleted file mode 100644 index 0d9b2ae8..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -int main() -{ - int n, prev1 = 0, prev2 = 1, next; - std::cout << "Enter the number: "; - std::cin >> n; - for (int i = 0; i < n; i++) - { - if (i == 0) { - std::cout << 0 << "\n"; - continue; - } - if (i == 1) { - std::cout << 1 << "\n"; - continue; - } - next = prev1 + prev2; - prev1 = prev2; - prev2 = next; - std::cout << next << "\n"; - } -} - - - - - - - diff --git a/sem1/KhetagKambolov/MiniHomeWork1/Task4.cpp b/sem1/KhetagKambolov/MiniHomeWork1/Task4.cpp deleted file mode 100644 index ea5b6634..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int main() -{ - int n, reversed = 0; - std::cout << "Enter the number: "; - std::cin >> n; - while (n != 0) { - int remain = n % 10; - if (remain == 0) std::cout << 0; - reversed = reversed * 10 + remain; - n /= 10; - } - std::cout << reversed; -} - - - - - - - diff --git a/sem1/KhetagKambolov/MiniHomeWork2/Task1.cpp b/sem1/KhetagKambolov/MiniHomeWork2/Task1.cpp deleted file mode 100644 index cd2bc79f..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork2/Task1.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int main() -{ - int num, select; - while (true) { - std::cout << "Enter your decimal: "; - std::cin >> num; - std::cout << "Select what to convert to: \n 1 - octal \n 2 - hexadecimal" << std::endl; - std::cin >> select; - switch (select) { - case 1: - std::cout << std::oct << num << std::endl; - break; - case 2: - std::cout << std::hex << num << std::endl; - break; - } - } -} - - - - - - - diff --git a/sem1/KhetagKambolov/MiniHomeWork2/Task2.cpp b/sem1/KhetagKambolov/MiniHomeWork2/Task2.cpp deleted file mode 100644 index b3ea0861..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork2/Task2.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -static void Siracus(int num) { - int temp = num; - std::cout << temp; - while (temp != 1) { - if (temp % 2 == 0) temp /= 2; - else temp = (temp * 3 + 1) / 2; - std::cout << " -> " << temp; - } -} - -int main() -{ - int num; - std::cout << "Enter your number: "; - std::cin >> num; - Siracus(num); -} - - - - - - - diff --git a/sem1/KhetagKambolov/MiniHomeWork3/Shops.txt b/sem1/KhetagKambolov/MiniHomeWork3/Shops.txt deleted file mode 100644 index 2fa01405..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork3/Shops.txt +++ /dev/null @@ -1,18 +0,0 @@ -Shop Knifes Items 5 -Butterfly 7000 0.3 8 -Machete 10000 2.0 20 -KitchenKnife 1000 0.8 10 -Katana 30000 2.5 40 -Bowie 8000 0.5 9 -Shop Clothes Items 5 -Shirt 1500 0.5 S -Jeans 3000 1.0 M -Jacket 5000 2.0 XL -Hat 1000 0.7 S -Socks 200 0.3 XXXL -Shop Paints Items 5 -Red 500 3.0 glossy -Blue 500 3.0 matte -Yellow 500 3.0 glossy -Green 500 3.0 matte -Purple 500 3.0 matte \ No newline at end of file diff --git a/sem1/KhetagKambolov/MiniHomeWork3/Task1.cpp b/sem1/KhetagKambolov/MiniHomeWork3/Task1.cpp deleted file mode 100644 index 77bdde5c..00000000 --- a/sem1/KhetagKambolov/MiniHomeWork3/Task1.cpp +++ /dev/null @@ -1,235 +0,0 @@ -#include -#include -#include -#include - -std::string path = "Shops.txt"; - -class Item { - public: - std::string name; - double price; - double weight; - - Item() { - name = ""; - price = 0; - weight = 0; - } - - Item(std::string name, double price, double weight) { - this->name = name; - this->price = price; - this->weight = weight; - } -}; - -class Knife : public Item { - public: - double length; - - Knife() { - length = 0; - } - - Knife(std::string name, double price, double weight, double length) { - this->name = name; - this->price = price; - this->weight = weight; - this->length = length; - } -}; - -class Cloth : public Item { -public: - std::string size; - - Cloth() { - size = "S"; - } - - Cloth(std::string name, double price, double weight, std::string size) { - this->name = name; - this->price = price; - this->weight = weight; - this->size = size; - } -}; - -class Paint : public Item { -public: - std::string type; - - Paint() { - type = "glossy"; - } - - Paint(std::string name, double price, double weight, std::string type) { - this->name = name; - this->price = price; - this->weight = weight; - this->type = type; - } -}; - -class Shop { - std::vector items; - public: - virtual double GetAvgPrice() { - double sum = 0; - for (Item item : items) - { - sum += item.price; - } - return sum / 5; - } - - virtual double GetAvgWeight() { - double sum = 0; - for (Item item : items) - { - sum += item.weight; - } - return sum / 5; - } -}; - -class KnifeShop : public Shop { - public: - std::vector knifes; - double GetAvgPrice() { - double sum = 0; - for (Item knife : knifes) - { - sum += knife.price; - } - return sum / 5; - } - - double GetAvgWeight() { - double sum = 0; - for (Item knife : knifes) - { - sum += knife.weight; - } - return sum / 5; - } -}; - -class ClothShop : public Shop { - public: - std::vector clothes; - double GetAvgPrice() { - double sum = 0; - for (Item Cloth : clothes) - { - sum += Cloth.price; - } - return sum / 5; - } - - double GetAvgWeight() { - double sum = 0; - for (Item Cloth : clothes) - { - sum += Cloth.weight; - } - return sum / 5; - } -}; - -class PaintShop : public Shop { - public: - std::vector paints; - double GetAvgPrice() { - double sum = 0; - for (Item Paint : paints) - { - sum += Paint.price; - } - return sum / 5; - } - - double GetAvgWeight() { - double sum = 0; - for (Item Paint : paints) - { - sum += Paint.weight; - } - return sum / 5; - } -}; - -KnifeShop knifeShop; -ClothShop clothShop; -PaintShop paintShop; - -void ReadFromFile() { - bool readKnifes, readClothes, readPaints; - readKnifes = readClothes = readPaints = false; - std::ifstream in; - in.open(path); - if (in.is_open()) { - std::string str; - std::string strSplit[5]; - for (int i = 0; getline(in, str); i++) - { - std::stringstream s(str); - int j = 0; - while (s.good() && j < 4) { - s >> strSplit[j]; - j++; - } - - if (strSplit[1] == "Knifes") { - readKnifes = true; - readClothes = false; - readPaints = false; - continue; - } - - if (strSplit[1] == "Clothes") { - readKnifes = false; - readClothes = true; - readPaints = false; - continue; - } - - if (strSplit[1] == "Paints") { - readKnifes = false; - readClothes = false; - readPaints = true; - continue; - } - - if (readKnifes) { - knifeShop.knifes.push_back(Knife(strSplit[0], stod(strSplit[1]), stod(strSplit[2]), stod(strSplit[3]))); - } - - if (readClothes) { - clothShop.clothes.push_back(Cloth(strSplit[0], stod(strSplit[1]), stod(strSplit[2]), strSplit[3])); - } - - if (readPaints) { - paintShop.paints.push_back(Paint(strSplit[0], stod(strSplit[1]), stod(strSplit[2]), strSplit[3])); - } - } - } - in.close(); -} - -int main() -{ - ReadFromFile(); - std::cout << "Knifes average price: " << knifeShop.GetAvgPrice() << std::endl; - std::cout << "Knifes average weight: " << knifeShop.GetAvgWeight() << std::endl; - std::cout << "Clothes average price: " << clothShop.GetAvgPrice() << std::endl; - std::cout << "Clothes average weight: " << clothShop.GetAvgWeight() << std::endl; - std::cout << "Paints average price: " << paintShop.GetAvgPrice() << std::endl; - std::cout << "Paints average weight: " << paintShop.GetAvgWeight() << std::endl; -} - - - - - diff --git a/sem1/KleynovMA/minihomework1/task_1.cpp b/sem1/KleynovMA/minihomework1/task_1.cpp deleted file mode 100644 index 56695c4a..00000000 --- a/sem1/KleynovMA/minihomework1/task_1.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -// task 1 - -double square_area(const double side) -{ - return side*side; -} - -int main() -{ - const int side = 5; - const double result = square_area(side); - - std::cout << "The area of a square is equal to " << result << '\n'; - return 0; -} diff --git a/sem1/KleynovMA/minihomework1/task_2.cpp b/sem1/KleynovMA/minihomework1/task_2.cpp deleted file mode 100644 index 3dcdd505..00000000 --- a/sem1/KleynovMA/minihomework1/task_2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -// task 2 - -double trapezoid_area(const double side_1, const double side_2, const double height) -{ - double result = (side_1 + side_2) / 2 * height; - return result; -} - -int main() -{ - const int side_1 = 4; - const int side_2 = 6; - const int height = 5; - const double result = trapezoid_area(side_1, side_2, height); - - std::cout << "The area of a trapezoid is equal to " << result << '\n'; - return 0; -} - - diff --git a/sem1/KleynovMA/minihomework1/task_3.cpp b/sem1/KleynovMA/minihomework1/task_3.cpp deleted file mode 100644 index c266763c..00000000 --- a/sem1/KleynovMA/minihomework1/task_3.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include - -// task 3 - -void fibonachi(const int n) -{ - const std::string continue_line = ", "; - int x_1 = 0; - int x_2 = 1; - - for (int i = 0; i < n; i++) - { - if (i == 0 or i == 1) - { - std::cout << i << continue_line; - } - else - { - int next = x_1 + x_2; - x_1 = x_2; - x_2 = next; - - std::cout << next << continue_line; - } - } - std::cout << '\n'; -} - -int main() -{ - - const std::string text = "Enter the number of elements in the sequence: "; - int n; - - std::cout << text; - std::cin >> n; - - fibonachi(n); - - std::cout << '\n'; - return 0; -} - - diff --git a/sem1/KleynovMA/minihomework1/task_4.cpp b/sem1/KleynovMA/minihomework1/task_4.cpp deleted file mode 100644 index 569f013d..00000000 --- a/sem1/KleynovMA/minihomework1/task_4.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include - -// task 4 - -int reverse_number(int num) { - int reversed = 0; - - while (num > 0) { - int lastDigit = num % 10; - reversed = reversed * 10 + lastDigit; - num /= 10; - } - return reversed; -} - -int main() { - const std::string text = "Enter the number: "; - int number; - - std::cout << text; - std::cin >> number; - - const bool is_negative = number < 0; - if (is_negative) { - number = -number; - } - - int reversedNumber = reverse_number(number); - - if (is_negative) { - reversedNumber = -reversedNumber; - } - - const std::string res_text = "Result is: "; - std::cout << res_text << reversedNumber << '\n'; - return 0; -} diff --git a/sem1/KleynovMA/minihomework2/task_1.cpp b/sem1/KleynovMA/minihomework2/task_1.cpp deleted file mode 100644 index 0bb10849..00000000 --- a/sem1/KleynovMA/minihomework2/task_1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include - - -std::string to_hex(const int x) { - std::stringstream ss; - ss << std::hex << x; - return ss.str(); - -} - -std::string to_oct(const int x) { - std::stringstream ss; - ss << std::oct << x; - return ss.str(); -} - -int main() { - int user_number; - - std::cout << "Enter the number: "; - std::cin >> user_number; - - const std::string hex = to_hex(user_number); - const std::string oct = to_oct(user_number); - - std::cout << "HEX: " << hex << '\n'; - std::cout << "OCT: " << oct << '\n'; - - /* Simple solution - std::cout << "HEX: " << std::hex << user_number << '\n'; - std::cout << "OCT: " << std::oct << user_number << '\n'; - */ - - return 0; -} \ No newline at end of file diff --git a/sem1/KleynovMA/minihomework2/task_2.cpp b/sem1/KleynovMA/minihomework2/task_2.cpp deleted file mode 100644 index 435139e2..00000000 --- a/sem1/KleynovMA/minihomework2/task_2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -bool check_syracuse_hypothesis(int n) { - - while (n != 1) { - if (n % 2 == 0) { - n /= 2; - } - else { - n = (n * 3 + 1) / 2; - } - - std::cout << "N = "<< n << '\n'; - } - - return true; -} - -int main() { - int user_number; - - std::cout << "Enter the number: "; - std::cin >> user_number; - - if (check_syracuse_hypothesis(user_number)) - { - std::cout << "The hypothesis is correct" << '\n'; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/Kombintsev Andrei/MiniHomework1/Task (1).cpp b/sem1/Kombintsev Andrei/MiniHomework1/Task (1).cpp deleted file mode 100644 index 1925a727..00000000 --- a/sem1/Kombintsev Andrei/MiniHomework1/Task (1).cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#include - - - -int area(int side) { - return side * side; -} - - - -int main() -{ - int side = 0; - std::cout << "Enter a side of square: "; - std::cin >> side; - std::cout << "area of square: " << area(side); -} - diff --git a/sem1/Kombintsev Andrei/MiniHomework1/Task (2).cpp b/sem1/Kombintsev Andrei/MiniHomework1/Task (2).cpp deleted file mode 100644 index 69fc02bb..00000000 --- a/sem1/Kombintsev Andrei/MiniHomework1/Task (2).cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include - - -int TrazArea(float a = 0, float b = 0, float h = 0) { - int i = 0; - while (i == 0) - { - std::cout << "Enter sides of trapezoid"; - - std::cin >> a; - std::cin >> b; - std::cout << "Enter trapezoid height"; - - std::cin >> h; - if (a != b) - { - i = 1; - } - else { - std::cout << "ERROR\n"; - return 0; - } - - } - - return(a + b) / 2.0 * h; -} - - - -int main() -{ - float a = 0; //Одно из оснований трапеции - float b = 0; //Другое основание трапеции - float h = 0; //высота - - std::cout << "Area of trapezoid" << TrazArea(a,b,h); -} \ No newline at end of file diff --git a/sem1/Kombintsev Andrei/MiniHomework1/Task (3).cpp b/sem1/Kombintsev Andrei/MiniHomework1/Task (3).cpp deleted file mode 100644 index 471cda14..00000000 --- a/sem1/Kombintsev Andrei/MiniHomework1/Task (3).cpp +++ /dev/null @@ -1,39 +0,0 @@ - -#include - - -int Fibon(int count) { - int Snumb = 1; //Second number - int Fnumb = 0; //First number - for (int i = 0; i < count; i++) { - if (i == 0) { - std::cout << Fnumb << " "; - } - if (i == 1) { - std::cout << Snumb << " "; - } - if (i % 2 == 0) { - Fnumb = Fnumb + Snumb; - std::cout << Fnumb << " "; - } - if (i % 2 != 0) { - Snumb = Fnumb + Snumb; - std::cout << Snumb << " "; - } - } - return 0; - -} - - -int main() -{ - int count = 0; - std::cout << "Enter yor count of numbers Fibanashi"; - std::cin >> count; - Fibon(count); - - - return 0; - -} \ No newline at end of file diff --git a/sem1/Kombintsev Andrei/MiniHomework1/Task (4).cpp b/sem1/Kombintsev Andrei/MiniHomework1/Task (4).cpp deleted file mode 100644 index f87c8c08..00000000 --- a/sem1/Kombintsev Andrei/MiniHomework1/Task (4).cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - - - -int turnnumb(int numb) { - int size = 0; - int numbL = numb; //Переменная которуюя буду мучать - while (numbL % 10 != 0) { - size += 1; - numbL /= 10; - - } - - int sizeL = 0;//Переменная которая поможет мне вывернуть число наоборот - for (int i = 0; i < size; i++) { - int a = pow(10, sizeL); - int b = pow(10, sizeL + 1); - std::cout << (numb % b) / a; - sizeL += 1; - //std::cout <<" "<< sizeL << " " << a << " "; // Проверка была - } - return 0; -}; - - - - - -int main() -{ - int numb = 0; - std::cout << "Enter your number "; - std::cin >> numb; - turnnumb(numb); - return 0; -} \ No newline at end of file diff --git a/sem1/KondyukovKR/class-derive.cpp b/sem1/KondyukovKR/class-derive.cpp deleted file mode 100644 index ff2c5232..00000000 --- a/sem1/KondyukovKR/class-derive.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - - -class Figure { -public: - int a = 10; -}; - -class Rectangle : public Figure { -public: - int b = 100; -}; - -int main() { - - Figure figure; - Rectangle rectangle; - - std::cout<<"figure.a " << figure.a << '\n'; - std::cout<<"rectangle.a " << rectangle.a; - std::cout<<"rectangle.b " << rectangle.b; - - return 0; -} \ No newline at end of file diff --git a/sem1/KondyukovKR/class-incapsulation.cpp b/sem1/KondyukovKR/class-incapsulation.cpp deleted file mode 100644 index 4319666e..00000000 --- a/sem1/KondyukovKR/class-incapsulation.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - - -class ReadOnly { -private: - std::string readonlyString = "важный текст"; -public: - std::string getString() {return readonlyString;} -}; - -int main() { - ReadOnly readOnly; - readOnly.getString() = "не очень важный бла бла"; - std::cout<<"readOnly " << readOnly.getString() << '\n'; - - return 0; -} \ No newline at end of file diff --git a/sem1/KondyukovKR/class.cpp b/sem1/KondyukovKR/class.cpp deleted file mode 100644 index 7ff23063..00000000 --- a/sem1/KondyukovKR/class.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -class CBase{ -private: - int privateBase; -protected: - int protBase; -public: - int pubBase; -}; - -class CDerived : public CBase{ // пробуем protected и private тут - public: - void updateDerived() { - privateBase=0; - protBase=0; - pubBase=0; - } -}; - - -int main() { - CDerived cDerived; - cDerived.updateDerived(); - std::cout<<"privateBase " << cDerived.privateBase << '\n'; - std::cout<<"protBase " << cDerived.protBase << '\n'; - std::cout<<"pubBase " << cDerived.pubBase << '\n'; - - return 0; -} -class Base { -public: - Base() {cout << "\nBase created\n";} - ~Base() {cout << "Base destroyed\n\n,"; } -}; -class D_class1(): public Base { -public: - D_class1() {cout << "D_class1 created\n";} - ~D_class1() {cout << "D_class1 destroyed\n "; } -}; -int main(){ - D_class1 d1; - return 0; -} -#include - -class Base { -public: - void b() {std::cout << "b\n";} - void b(int n) {std::cout << "b int \n";} - void b(std::string n) {std::cout << "b string \n";} -}; - -int main(){ - Base myB; - myB.b(); - myB.b(123213); - myB.b("sdufhudhsfuhdsui;fh"); - - return 0; -} \ No newline at end of file diff --git a/sem1/KondyukovKR/credentials_file.cpp b/sem1/KondyukovKR/credentials_file.cpp deleted file mode 100644 index c977aa67..00000000 --- a/sem1/KondyukovKR/credentials_file.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//Если надо считать всю строку целиком или все строки из файла, -//то лучше использовать ф - ю getline(), она принимает -//поток для чтения и переменную, в которую надо считать текст - -#include -#include -#include -#include // для std::getline -#include "conio.h" - -class Cred { -public: - int id; - std::string password; -}; - -int main() { - std::string line; - std::fstream stream("example.txt", std::ios_base::in); - std::vector creds; - - while (!stream.eof()) { - Cred cred; - stream >> cred.id >> cred.password; - creds.push_back(cred); - } - - stream.close(); // закрываем файл - - ///////////////////////////////////////////////////////////////////////////////////// - - for (Cred cred : creds) { - std::cout << cred.id << " " << cred.password << std::endl; - } - - _getch(); -} \ No newline at end of file diff --git a/sem1/KondyukovKR/credentials_random.cpp b/sem1/KondyukovKR/credentials_random.cpp deleted file mode 100644 index 70d76332..00000000 --- a/sem1/KondyukovKR/credentials_random.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Для записи в файл к объекту ofstream или fstream -// применяется оператор << (как и при выводе на консоль) : - -#include -#include -#include -#include "conio.h" -#include "math.h" - -class Cred{ -public: - int id; - std::string password; -}; - -int main() { - srand(time(NULL)); - - std::vector creds; - const int amountString = 1000; - const int stringLength = 10; - - for (int i = 0; i < amountString; i++) { - Cred tmpCred; - tmpCred.id = i; - for (int i = 0; i < stringLength; i++) { - tmpCred.password += (char) (rand() % 128 + 36); - } - creds.push_back(tmpCred); - } - - std::ofstream out; // поток для записи - out.open("example.txt"); // открываем файл для записи - - if (out.is_open()) { - for (Cred cred : creds) { - out << "id: " << cred.id << "; password: " << cred.password << std::endl; - } - std::cout << "File has been written" << std::endl; - } - else { - std::cout << "ERROR!!!!!" << std::endl; - } - - out.close(); - _getch(); -} \ No newline at end of file diff --git a/sem1/KondyukovKR/deque.cpp b/sem1/KondyukovKR/deque.cpp deleted file mode 100644 index ce538ac3..00000000 --- a/sem1/KondyukovKR/deque.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include - -class Node { -public: - Node(int curNum) { n = curNum; } - - int n; - Node* next; - Node* prev; -}; - -class SpecialList { -private: - int sizeCurrent; - Node* first; - Node* last; - Node* current; - -public: - SpecialList() { - first = new Node(0); - first->next = NULL; - first->prev = NULL; - last = first; - } - - void add() { - Node* node = new Node(last->n); - last->next = node; - node->prev = last; - node->next = NULL; - node->n++; - last = node; - - sizeCurrent++; - } - - void deleteFirst() { - first = first->next; - delete first->prev; - first->prev = NULL; - sizeCurrent--; - } - - void deleteLast() { - last = last->prev; - delete last->next; - last->next = NULL; - sizeCurrent--; - } - - void goForward() { - current = first; - while (current->next != NULL) { - std::cout << "Current node: " << current->n << std::endl; - current = current->next; - } - } - - void goBackwards() { - current = last; - while (current->prev != NULL) { - std::cout << "Current node: " << current->n << std::endl; - current = current->prev; - } - } - - Node* getFirst() { return first; } - Node* getLast() { return last; } - Node* getCurrent() { return current; } -}; - -int main() { - SpecialList list; - - int listSize = 10; - for (int i = 0; i < listSize - 1; i++) { // 10 элементов делаем - list.add(); - } - - std::cout << " >_< Hello, Kotik! ^_^ " << std::endl; - list.goForward(); - std::cout << "_^ " << std::endl; - list.goBackwards(); - std::cout << "_^ " << std::endl; - list.goForward(); - std::cout << "_^ " << std::endl; - list.goBackwards(); - std::cout << "_^ " << std::endl; - -} \ No newline at end of file diff --git a/sem1/KondyukovKR/example.cpp b/sem1/KondyukovKR/example.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/sem1/KondyukovKR/list.cpp b/sem1/KondyukovKR/list.cpp deleted file mode 100644 index b05b31fc..00000000 --- a/sem1/KondyukovKR/list.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include - -class ListNode { -public: - ListNode(int curNum) { n = curNum; } - - int n; - ListNode* next; - ListNode* prev; - ListNode* rand; -}; - -class List { -public: - List() { - first = new ListNode(0); - first->next = NULL; - first->prev = NULL; - last = first; - } - - ListNode* add() { - ListNode* node = new ListNode(last->n); - last->next = node; - node->prev = last; - node->next = NULL; - node->n++; - last = node; - return node; - } - - void goForward() { - while (first != NULL){ - std::cout << "Current number: " << first->n << std::endl; - first = first->next; - } - } - - void goBackwards() { - while (last != NULL) { - std::cout << "Current number: " << last->n << std::endl; - last = last->prev; - } - } - -private: - ListNode* first; - ListNode* last; -}; - -int main() { - List list; - - int listSize = 10; - for (int i = 0; i < listSize - 1; i++) { // 10 элементов делаем - list.add(); - } - - list.goBackwards(); -} \ No newline at end of file diff --git a/sem1/KondyukovKR/stack.cpp b/sem1/KondyukovKR/stack.cpp deleted file mode 100644 index 8d779d86..00000000 --- a/sem1/KondyukovKR/stack.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include - -class StackNode { -public: - StackNode(int curNum) { n = curNum; } - - int n; - StackNode* next; - StackNode* prev; -}; - -class Stack { -public: - Stack(int maxSize) { - sizeMax = maxSize; - - last = new StackNode(0); - last->next = NULL; - last->prev = NULL; - } - - void push() { - if (sizeCurrent >= sizeMax) { - std::cout << "Stack overflow!" << std::endl; - return; - } - - StackNode* node = new StackNode(last->n); - last->next = node; - node->prev = last; - node->next = NULL; - node->n++; - last = node; - - sizeCurrent++; - } - - void pop() { - last = last->prev; - delete last->next; - last->next = NULL; - sizeCurrent--; - } - - StackNode* peek() { - return last; - } - -private: - int sizeMax; - int sizeCurrent; - StackNode* last; -}; - -int main() { - Stack stack(10); - - int listSize = 10; - for (int i = 0; i < listSize - 1; i++) { // 10 элементов делаем - stack.push(); - } - - std::cout << "Current n: " << stack.peek()->n << std::endl; - stack.pop(); - std::cout << "Current n: " << stack.peek()->n << std::endl; - -} \ No newline at end of file diff --git a/sem1/KorolevaTaisiia/MiniHomeWork1/task1.cpp b/sem1/KorolevaTaisiia/MiniHomeWork1/task1.cpp deleted file mode 100644 index f2c7fc14..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -/*Task1: Реализовать функцию, которая возвращает подсчет площади квадрата.*/ - -double sqr_area(double square_side) { - return square_side * square_side; -} - -int main() { - double sqr_a; - std::cout << "Enter square side \n"; - std::cin >> sqr_a; - std::cout << "S = " << sqr_area(sqr_a) << std::endl; - return 0; -} diff --git a/sem1/KorolevaTaisiia/MiniHomeWork1/task2.cpp b/sem1/KorolevaTaisiia/MiniHomeWork1/task2.cpp deleted file mode 100644 index d1c11b43..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -/*Реализовать функцию, которая возвращает подсчет площади трапеции.*/ - - -double trapezoidArea(double base1, double base2, double height) { - return (base1 + base2) / 2 * height; -} - -int main() { - double base1, base2, height; - std::cout << "Enter bottom base length \n"; - std::cin >> base1; - std::cout << "Enter upper base length \n"; - std::cin >> base2; - std::cout << "Enter height length \n"; - std::cin >> height; - std::cout << trapezoidArea(base1, base2, height) << std::endl; - return 0; -} - - diff --git a/sem1/KorolevaTaisiia/MiniHomeWork1/task3.cpp b/sem1/KorolevaTaisiia/MiniHomeWork1/task3.cpp deleted file mode 100644 index 63bfdb10..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -/*Вывести на экран ряд чисел Фибоначчи, -состоящий из N элементов. -Значение N вводится пользователем с клавиатуры. -*/ - - - -void fibbonacci_print(int n) { - long long cur_num = 1; - long long prev_num = 0; - if (n > 0) { - std::cout << prev_num << " "; - } - if (n > 1) { - std::cout << cur_num << " "; - } - for (int i = 2; i < n; ++i) { - prev_num += cur_num; - std::cout << prev_num << " "; - std::swap(prev_num, - cur_num); - } -} - -int main() { - int n; - std::cout << "Enter how many Fibonacci numbers do you want to see \n"; - std::cin >> n; - //std::cout << '\n'; - fibbonacci_print(n); - return 0; -} diff --git a/sem1/KorolevaTaisiia/MiniHomeWork1/task4.cpp b/sem1/KorolevaTaisiia/MiniHomeWork1/task4.cpp deleted file mode 100644 index 81797e54..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include - -/*Пользователь вводит число. -Преобразовать его в другое число, -цифры которого будут следовать в обратном порядке по сравнению с введенным пользователем числом. -std::string пользоваться нельзя. -*/ - - - -int reverse_number(int number) { // Ведущие нули в новой версии числа не возвращаются - int reversed_number = 0; - while (number != 0) { - reversed_number *= 10; - reversed_number += number % 10; - number /= 10; - } - return reversed_number; -} - -int count_digits(int number) { - int digits = 0; - while (number != 0) { - number /= 10; - digits++; - } - return digits; -} - -void show_smart_reverse_number(int number) { // Вывод с ведущими нулями - int rev_num = reverse_number(number); - int how_many_zeroes = count_digits(number) - count_digits(rev_num); - - for (int i = 0; i < how_many_zeroes; ++i) { - std::cout << 0; - } - bool min = false; // Если бы стринги были разрешены, можно было бы сделать проще. - if (rev_num < 0) { - min = true; - rev_num = -rev_num; - } - std::cout << rev_num; - if (min) { - std::cout << "-"; - } - std::cout << "\n"; -} - -int main() { - int num; - std::cout << "Number that you want reversed \n"; - std::cin >> num; - - std::cout << "Version without leading zeroes and '-' afterwards: " << reverse_number(num) << '\n'; // если следовать ТЗ - std::cout << "Alternative version: "; - show_smart_reverse_number(num); - return 0; -} diff --git a/sem1/KorolevaTaisiia/MiniHomeWork2/task1.cpp b/sem1/KorolevaTaisiia/MiniHomeWork2/task1.cpp deleted file mode 100644 index 74acf446..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -/*Task1: Реализовать функцию преобразования из десятичного числа в шестнадцатеричную и восьмеричную систему.*/ - -#include -#include - -std::string toBase(long long decimalNumber, int base) { - std::string result; - const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - do { - result += digits[decimalNumber % base]; - decimalNumber /= base; - } while (decimalNumber != 0); - std::reverse(result.begin(), result.end()); - return result; -} - -int main() { - long long num; - std::cout << "Enter your number in a decimal numeral system: \n"; - std::cin >> num; - std::cout << "Std functions (For self check) \n"; - std::cout << "16-based numeral system " << std::hex << num << std::endl; - std::cout << "8-based numeral system " << std::oct << num << std::endl; - std::cout << "My function \n"; - std::cout << "16-based numeral system " << toBase(num, 16) << std::endl; - std::cout << "8-based numeral system " << std::oct << toBase(num, 8) << std::endl; - return 0; -} diff --git a/sem1/KorolevaTaisiia/MiniHomeWork2/task2.cpp b/sem1/KorolevaTaisiia/MiniHomeWork2/task2.cpp deleted file mode 100644 index 4184fd1f..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include - -/*Task2: Проверить гипотезу Сиракуз, также известную как гипотеза Коллатца.*/ -/*Для визуальной проверки данной гипотезы напишем программу, которая будет выводить сиракузскую последовательность - * заданного пользователем числа*/ - -#include -#include -#include - -long long collatz_function(const long long num) { - if (num % 2 == 0) { - return num / 2; - } else { - return num * 3 + 1; - } -} - -void collatz_conjecture(const long long num, std::vector &conjecture) { - long long num_cp = num; - while (num_cp != 1) { - conjecture.push_back(num_cp); - num_cp = collatz_function(num_cp); - } - conjecture.push_back(num_cp); // will be 1 -} - -int main() { - long long num; - std::cout << "Enter a beginning number for your collatz conjecture \n"; - std::cin >> num; - std::vector conjecture; - collatz_conjecture(num, conjecture); - for (auto i: conjecture) { - std::cout << i << ' '; - } - return 0; -} diff --git a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/main.cpp b/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/main.cpp deleted file mode 100644 index d75d390f..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/main.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#include -#include -#include "src/shops.h" -#include "src/StringUtils.h" - -void get_middle(std::string file_name, std::ostream &ostream, std::istream &istream, - std::vector *> cache); - -void add_product(std::string file_name, std::ostream &ostream, std::istream &istream, - std::vector *> cache); - -void add_shop(std::string &database_path, std::ostream &os, std::istream &is) { - os << "Welcome to shop creator!\n" - "1. Press 1 to create basic shop\n" - "2. Press 2 to create shop with sales\n" - "3. Press 3 to create shop with heavy packaging\n" - "4. Send anything else to exit\n"; - std::string x, name; - std::getline(is, x); - if (x != "1" && x != "2" && x != "3") { - return; - } - os << "Enter a name for your new shop\n"; - std::getline(is, name); - std::fstream fb; - fb.open(database_path, std::ios::out | std::ios::app); - - if (x == "1") { - auto shop = basic_shop(name); - fb << shop.present_itself(); - } - if (x == "2") { - auto shop = shop_with_sales(name); - fb << shop.present_itself(); - } - if (x == "3") { - fb << heavy_package_shop(name).present_itself(); - } - fb.close(); -} - - -void cache_data(std::string &database_path, std::vector *> &data) { - std::vector shop_data; - std::string line; - std::ifstream is(database_path); - while (std::getline(is, line)) { - trim(line); - if (!line.empty()) { - split_line(line, ' ', shop_data); - std::string class_name, name; - class_name = shop_data[0]; - name = shop_data[1]; - if (class_name == basic_shop::class_name()) { - auto *shop = new basic_shop(name); - data.push_back(shop); - } else if (class_name == shop_with_sales::class_name()) { - data.push_back(reinterpret_cast *>(new shop_with_sales(name))); - } else if (class_name == heavy_package_shop::class_name()) { - data.push_back(reinterpret_cast *>(new heavy_package_shop(name))); - } - //data.push_back(); - } - std::getline(is, line); - trim(line); - split_line(line, ' ', shop_data); - int how_much = std::stoi(shop_data[1]); - for (int i = 0; i < how_much; ++i) { - std::getline(is, line); - trim(line); - data.back()->parse_new_product(line); - } - } - is.close(); -} - -void show_data(std::string &database_path, - std::ostream &os, std::istream &is, std::vector *> &data) { - data.clear(); - cache_data(database_path, data); - for (auto &i: data) { - os << i->present_itself() << '\n'; - } -} - -void menu(std::string database_path, std::ostream &os, std::istream &is) { - std::vector *> cache; - //cache_data(database_path, cache); - while (true) { - std::cout << "Welcome to the simple shop database!\n" - "1. Press 1 to add new shops\n" - "2. Press 2 to get your current data presented\n" - "3. Press 3 to get middle cost/weight in shop\n" - "4. Press 4 to add new products\n"; - std::string x; - //is >> x; - std::getline(is, x); - trim(x); - if (x == "1") { - add_shop(database_path, os, is); - } else if (x == "2") { - show_data(database_path, os, is, cache); - } else if (x == "3") { - get_middle(database_path, os, is, cache); - } else if (x == "4") { - add_product(database_path, os, is, cache); - } else if (x.empty()) { - break; - } - } -} - -void add_product(std::string file_name, std::ostream &ostream, std::istream &istream, - std::vector *> cache) { - cache_data(file_name, cache); - int i = -2; - while (true) { - ostream << "Enter number of your shop of interest, or 0 to exit this menu \n"; - std::string output; - std::getline(istream, output); - trim(output); - if (!output.empty()) { - i = std::stoi(output); - i--; - if (i == -1) { - break; - } - shop_base *shop = cache[i]; - ostream << "Enter your product in format of: " + shop->ask_for_product() + '\n'; - std::string product; - std::getline(istream, product); - shop->parse_new_product(product); - } - } - std::ofstream out; // поток для записи - out.open(file_name); - for (auto k: cache) { - out << k->present_itself(); - } - out.close(); - -} - -void get_middle(std::string file_name, std::ostream &ostream, std::istream &istream, - std::vector *> cache) { - cache_data(file_name, cache); - ostream << "Enter number of your shop of interest\n"; - int i; - std::string input; - std::getline(istream, input); - i = std::stoi(input); - i--; - auto shop = cache[i]; - ostream << shop->present_itself(); - ostream << "middle cost " << shop->middle_cost() << '\n'; - ostream << "middle weight " << shop->middle_weight() << '\n'; -} - -int main() { - enum random_stuff { - CARROT, - MILK, - CHOCOLATE, - APPLES - }; - basic_shop basicShop("baba"); - shop_with_sales shopWithSales("beba"); - heavy_package_shop heavyPackageShop("buba"); - - basicShop.add_product(product("bip", 1, 4)); - basicShop.add_product(product("bop", 1, 4)); - shopWithSales.add_product(sales_product("bip", 1, 4, 0.8)); - - - //std::cout << basicShop.present_itself(); -// std::cout << shopWithSales.present_itself(); -// std::cout << heavyPackageShop.present_itself(); - menu("shops.txt", std::cout, std::cin); - return 0; -} diff --git a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/StringUtils.h b/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/StringUtils.h deleted file mode 100644 index 72a8e68c..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/StringUtils.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - - -#include -#include -#include -#include - - -inline void ltrim(std::string &s) { - s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) { - return !std::isspace(ch); - })); -} - -// trim from end (in place) -inline void rtrim(std::string &s) { - s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) { - return !std::isspace(ch); - }).base(), s.end()); -} - -inline void trim(std::string &s) { - ltrim(s); - rtrim(s); -} - -inline void split_line(const std::string &s, char delim, std::vector &result) { - result.clear(); - std::stringstream ss(s); - std::string item; - while (getline(ss, item, delim)) { - trim(item); - result.push_back(item); - } -} -inline void to_lower_case(std::string &string) { - std::transform(string.begin(), string.end(), string.begin(), ::tolower); -} -inline void centralize(std::string &string, size_t new_size) { - trim(string); - if (string.size() < new_size) { - string = std::string((new_size - string.size()) / 2, ' ') + string + - std::string(new_size - string.size() - ((new_size - string.size()) / 2), ' '); - } -} diff --git a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/products.h b/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/products.h deleted file mode 100644 index 8e67ba6d..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/products.h +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include - -class product { -protected: - std::string name; - float cost; - float weight; -public: - product(std::string name, float cost, float weight) : name(std::move(name)), cost(cost), weight(weight) { - - } - - virtual float get_cost() const { - return cost; - } - - virtual float get_weight() const { - return weight; - } - - virtual std::string present_itself() const { - return name + " " + std::to_string(get_cost()) + " " + std::to_string(get_weight()); - } -}; - -class sales_product : public product { -private: - float sale; -public: - sales_product(std::string name, float cost, float weight, float sale) : product(std::move(name), cost, weight), - sale(sale) { - } - - float get_cost() const override { - return cost * sale; - } - - std::string present_itself() const override { - return name + " " + std::to_string(get_true_cost()) - + " " + std::to_string(get_weight()) + " " + std::to_string(get_sale()); - } - - float get_sale() const { - return sale; - } - - float get_true_cost() const { - return cost; - } -}; - -class heavy_package_product : public product { -private: - float package_weight; -public: - heavy_package_product(std::string &name, float cost, float weight, float package_weight) : - product(name, cost, weight), package_weight(package_weight) {} - - float get_weight() const override { - return weight + package_weight; - } - - float get_package_weight() const { - return package_weight; - } - - std::string present_itself() const override { - return name + " " + std::to_string(get_cost()) + - +" " + std::to_string(get_weight() - get_package_weight()) - + " " + std::to_string(get_package_weight()); - } - - -}; \ No newline at end of file diff --git a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/shops.h b/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/shops.h deleted file mode 100644 index f546a8d8..00000000 --- a/sem1/KorolevaTaisiia/MiniHomeWork3/shop_project/src/shops.h +++ /dev/null @@ -1,161 +0,0 @@ -#include -#include -#include "products.h" -#include "StringUtils.h" - - - -template -class shop_base { -private: - std::string name; -protected: - std::vector products; -public: - virtual std::string ask_for_product() = 0; - shop_base() = delete; - - virtual void parse_new_product(std::string product_info) = 0; - virtual ~shop_base() = default; - - explicit shop_base(std::string name) : name(std::move(name)) {} - - virtual std::string present_itself() = 0; - - std::string get_product_presentation() { - std::string ans; - ans = " " + name + "\nItems " + std::to_string(products.size()) + "\n"; - for (const auto &p: products) { - ans += p.present_itself(); - ans += "\n"; - } - return ans; - }; - - virtual void add_product(T product) = 0; - - float middle_cost() const { - float x = 0; - if (products.empty()){ - return 0; - } - for (auto p: products) { - x += p.get_cost(); - } - return x / float(products.size()); - - // return get_middle_cost(pointers); - } - - float middle_weight() const { - float x = 0; - if (products.empty()){ - return 0; - } - for (auto p: products) { - x += p.get_weight(); - } - return x / float(products.size()); - //return get_middle_weight(pointers); - } - -}; - -class basic_shop : public shop_base { -public: - std::string ask_for_product() override{ - return "name cost weight"; - }; - void parse_new_product(std::string product_info) override { - std::vector shop_data; - split_line(product_info, ' ', shop_data); - std::string name = shop_data[0]; - float cost = std::stof(shop_data[1]); - float weight = std::stof(shop_data[2]); - product pr(name, cost, weight); - products.push_back(pr); - - - } - explicit basic_shop(std::string name) : shop_base(std::move(name)) {}; - - static std::string class_name() { - return "basic_shop"; - } - - virtual void add_product(product pr) override { - products.push_back(pr); - } - - - virtual std::string present_itself() override { - return class_name() + get_product_presentation(); - - } -}; - -class shop_with_sales : public shop_base { -public: - std::string ask_for_product() override{ - return "name cost weight sale"; - }; - void parse_new_product(std::string product_info) override { - std::vector shop_data; - split_line(product_info, ' ', shop_data); - std::string name = shop_data[0]; - float cost = std::stof(shop_data[1]); - float weight = std::stof(shop_data[2]); - float sale = std::stof(shop_data[3]); - sales_product pr(name, cost, weight,sale); - products.push_back(pr); - - } - explicit shop_with_sales(std::string name) : shop_base(std::move(name)) {}; - - static std::string class_name() { - return "shop_with_sales"; - } - - - std::string present_itself() override { - return class_name() + get_product_presentation(); - } - - void add_product(sales_product product) override { - products.push_back(product); - } - - -}; - -class heavy_package_shop : shop_base { -public: - explicit heavy_package_shop(std::string name) : shop_base(std::move(name)) {}; - std::string ask_for_product() override{ - return "name cost weight package_weight"; - }; - void parse_new_product(std::string product_info) override { - std::vector shop_data; - split_line(product_info, ' ', shop_data); - std::string name = shop_data[0]; - float cost = std::stof(shop_data[1]); - float weight = std::stof(shop_data[2]); - float pcg_weight = std::stof(shop_data[3]); - heavy_package_product pr(name, cost, weight, pcg_weight); - products.push_back(pr); - - } - static std::string class_name() { - return "shop_with_packages"; - } - - std::string present_itself() override { - return class_name() + get_product_presentation(); - } - - void add_product(heavy_package_product product) override { - products.push_back(product); - } - - -}; \ No newline at end of file diff --git a/sem1/KorolevaTaisiia/README.md b/sem1/KorolevaTaisiia/README.md deleted file mode 100644 index 23bb66e9..00000000 --- a/sem1/KorolevaTaisiia/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Домашние задания по C++ (1 семестр, 1 курс, ШРВ) - -**Автор:** Королева Таисия Дмитриевна, 334912 - -**Группа:** J3102 - -**Условия МиниДЗ:** -1. [МиниДЗ№1](https://docs.google.com/presentation/d/1zTwnpUmJ-ZjpZu3GUVhNhUZJYsOWeT6IcZT08CU-PTE/edit) -2. [МиниДЗ№2](https://docs.google.com/presentation/d/18SFBxaxdisEuhMudIPOm8MLtvXiJ2-O0xs-1SLgHrK4/edit#slide=id.p) -3. [МиниДЗ№3](https://docs.google.com/presentation/d/18SFBxaxdisEuhMudIPOm8MLtvXiJ2-O0xs-1SLgHrK4/edit#slide=id.p) - - -**Основные ДЗ:** -1. [ДЗ1, Базы Данных](https://docs.google.com/presentation/d/1k8GMO1jgq-M5V9RyUbHU2Qt1E0Y2WmGUzmV6_5t7EFI/edit#slide=id.p) - выполнена в отдельном [приватном проекте](). -2. [ДЗ2, Очереди](https://docs.google.com/presentation/d/1k8GMO1jgq-M5V9RyUbHU2Qt1E0Y2WmGUzmV6_5t7EFI/edit#slide=id.p) - выполнена в отдельном [приватном проекте](). \ No newline at end of file diff --git a/sem1/KravtsovaMary/MiniHomework1/task1.cpp b/sem1/KravtsovaMary/MiniHomework1/task1.cpp deleted file mode 100644 index 845b523f..00000000 --- a/sem1/KravtsovaMary/MiniHomework1/task1.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -int sqs(int a) { - return a * a; -} -int main() { - int side; - std::cin >> side; - int res = sqs(side); - std::cout << res; -} \ No newline at end of file diff --git a/sem1/KravtsovaMary/MiniHomework1/task2.cpp b/sem1/KravtsovaMary/MiniHomework1/task2.cpp deleted file mode 100644 index 3ac7eeec..00000000 --- a/sem1/KravtsovaMary/MiniHomework1/task2.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -int strap(int a, int b, int h) { - return (a + b) / 2 * h; -} -int main() { - int side1, side2, hight; - std::cin >> side1 >> side2 >> hight; - int res = strap(side1, side2, hight); - std::cout << res; -} \ No newline at end of file diff --git a/sem1/KravtsovaMary/MiniHomework1/task3.cpp b/sem1/KravtsovaMary/MiniHomework1/task3.cpp deleted file mode 100644 index b76a4378..00000000 --- a/sem1/KravtsovaMary/MiniHomework1/task3.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int main() { - int n; - std::cin >> n; - int a1 = 0; - int a2 = 1; - for (int i = 0; i < n; i++) { - std::cout << a1 << ' '; - a1 = a1 + a2; - a2 = a1 - a2; - } -} \ No newline at end of file diff --git a/sem1/KravtsovaMary/MiniHomework1/task4.cpp b/sem1/KravtsovaMary/MiniHomework1/task4.cpp deleted file mode 100644 index 250dc0ad..00000000 --- a/sem1/KravtsovaMary/MiniHomework1/task4.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main() { - int n; - std::cin >> n; - while (n > 0) { - std::cout << n % 10; - n = n / 10 - } -} \ No newline at end of file diff --git a/sem1/KravtsovaMary/MiniHomework2/task1.cpp b/sem1/KravtsovaMary/MiniHomework2/task1.cpp deleted file mode 100644 index 24099db0..00000000 --- a/sem1/KravtsovaMary/MiniHomework2/task1.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -void trans(int a) { - if (a == 0) { - std::cout << "0"; - } - int a10 = a; - int a16, a8; - std::string s8; - std::string s16; - if (a > 0) { - while (a10 > 0) { - s8 = std::to_string(a10 % 8) + s8; - a10 = a10 / 8; - } - a8 = std::stoi(s8); - std::cout << a8 << std::endl; - a10 = a; - while (a10 > 0) { - s16 = std::to_string(a10 % 16) + s16; - a10 = a10 / 16; - } - a16 = std::stoi(s16); - std::cout << a16; - } - if (a < 0) { - a10 = a * -1; - while (a10 > 0) { - s8 = std::to_string(a10 % 8) + s8; - a10 = a10 / 8; - } - a8 = std::stoi(s8); - std::cout << a8 * -1 << std::endl; - a10 = a * -1; - while (a10 > 0) { - s16 = std::to_string(a10 % 16) + s16; - a10 = a10 / 16; - } - a16 = std::stoi(s16); - std::cout << a16 * -1; - } -} -int main() { - int n; - std::cin >> n; - trans(n); -} \ No newline at end of file diff --git a/sem1/KravtsovaMary/MiniHomework2/task2.cpp b/sem1/KravtsovaMary/MiniHomework2/task2.cpp deleted file mode 100644 index 190d5ec1..00000000 --- a/sem1/KravtsovaMary/MiniHomework2/task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -void sir(int a) { - if (a < 0) { - std::cout << " "; - return; - } - while (a > 1) { - if (a % 2 == 0) { - a = a / 2; - std::cout << a << std::endl; - } - else { - a = a * 3; - a++; - a = a / 2; - std::cout << a << std::endl; - } - } -} -int main() { - int n; - std::cin >> n; - sir(n); -} \ No newline at end of file diff --git a/sem1/KungurtsevMaxim/minihw1/minihw1(1).cpp b/sem1/KungurtsevMaxim/minihw1/minihw1(1).cpp deleted file mode 100644 index 80bea0ce..00000000 --- a/sem1/KungurtsevMaxim/minihw1/minihw1(1).cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -//задание 1 -int main() { - setlocale(LC_ALL, "RU"); - std::cout << "Введите длинну стороны квадрата"; - float side; - std::cin >> side; - std::cout << side * side; - return 0; -} \ No newline at end of file diff --git a/sem1/KungurtsevMaxim/minihw1/minihw1(2).cpp b/sem1/KungurtsevMaxim/minihw1/minihw1(2).cpp deleted file mode 100644 index 8acc22ff..00000000 --- a/sem1/KungurtsevMaxim/minihw1/minihw1(2).cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -//задание 2 -int main() { - std::cout << "Введите длинну одного основания: \n"; - float base1; - std::cin >> base1; - std::cout << Второго: \n"; - float base2; - std::cin >> base2; - std::cout << и высоту: \n"; - float height; - std::cin >> height; - std::cout <<"площадь:"<< (base1 + base2) / 2 * height; - return 0; -} diff --git a/sem1/KungurtsevMaxim/minihw1/minihw1(3).cpp b/sem1/KungurtsevMaxim/minihw1/minihw1(3).cpp deleted file mode 100644 index 7780ea31..00000000 --- a/sem1/KungurtsevMaxim/minihw1/minihw1(3).cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -//задание 3 -int main() { - setlocale(LC_ALL, "RU"); - std::cout << "Введите необходимое количество чисел:"; - int count; - int fib1 = 1; - int fib2 = 0; - std::cin >> count; - for (int i = 0; i < count; i++) { - if (i % 2 == 0) { - std::cout << fib1 << "; "; - fib2 = fib1 + fib2; - } - else { - std::cout << fib2 << "; "; - fib1 = fib1 + fib2; - } - - } - return 0; -} diff --git a/sem1/KungurtsevMaxim/minihw1/minihw1(4).cpp b/sem1/KungurtsevMaxim/minihw1/minihw1(4).cpp deleted file mode 100644 index 0b2bc1a0..00000000 --- a/sem1/KungurtsevMaxim/minihw1/minihw1(4).cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -//task 4 -int main() { - setlocale(LC_ALL, "RU"); - std::cout << "input a number to reverse"; - int ToCountLenght; - std::cin >> ToCountLenght; - int ToReverse = ToCountLenght; - int len = 0; - do { - len++; - } while (ToCountLenght /= 10); - int result = 0; - for (int i = 0; i < len; i++) { - std::cout << ToReverse / int(pow(10, len - i - 1)) % 10 << "\n"; - result += ToReverse / int(pow(10, len - i - 1)) % 10 * pow(10, i); - } - std::cout << "reversed number is:"< -//задание 1 -int main() { - setlocale(LC_ALL, "RU"); - std::cout << "Введите число:" << "\n"; - int number; - std::cin >> number; - std::cout << "Ваше число в 16-ричной системе:" << "\n"; - std::cout << std::hex << number << "\n"; - std::cout << "Ваше число в 8-ричной системе:" << "\n"; - std::cout << std::oct << number << "\n"; - return 0; - -} \ No newline at end of file diff --git a/sem1/KungurtsevMaxim/minihw2/minihw2(2).cpp b/sem1/KungurtsevMaxim/minihw2/minihw2(2).cpp deleted file mode 100644 index 038a2923..00000000 --- a/sem1/KungurtsevMaxim/minihw2/minihw2(2).cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -//task 2 -int main() { - setlocale(LC_ALL, "RU"); - std::cout << "input an natural number:" << "\n"; - int number; - std::cin >> number; - while (number != 1) { - std::cout << "Your number:" < -#include -#include -//items are stored in a doubly linked list -class item { -public: - int price; - int mass; - int characteristic; // any other characteristic what exactly is this depends on type of shop - item* next; - item* prev; - item(int price, int mass, int characteristic) { - this->price = price; - this-> mass = mass; - this->characteristic = characteristic; - next = nullptr; - prev = nullptr; - } -}; -void add(item*& head, int price, int mass, int characteristic) { - item* newitem = new item(price, mass, characteristic); - if (head == nullptr) { - head = newitem; - return; - } - item* temp = head; - while (temp->next != nullptr) { - temp = temp->next; - } - temp->next = newitem; - newitem->prev = temp; -}; -class shopbase { -public: - item* itemZero = new item(0,0,0);// make first item for all shops, so i don't have to make an exception for the first item - int massAll; - int priceAll; - int countMass(int itemamount) { - item* current = itemZero; - for (int i=-1; i < itemamount; i++) { - massAll += current->mass; - current = current->next; - - } - return massAll; - } - int countprice(int itemamount) { - item* current = itemZero; - for (int i= -1; i < itemamount; i++) { - priceAll += current->price; - current = current->next; - } - return priceAll; - } -}; - -class CARshop:public shopbase { -public: - int Allmaxspeed = 1; - float findMaxspeed(int itemamount) { - item* current = itemZero; - for (int i= -1; i < itemamount; i++) { - if (current->characteristic > Allmaxspeed){ - Allmaxspeed = current->characteristic; - } - current = current->next; - } - return Allmaxspeed; - } -}; -class ROCKSshop :public shopbase { -public: - int densitySum = 0; - float meandensity(int itemamount) { - item* current = itemZero; - for (int i= -1; i < itemamount; i++) { - if (current->characteristic!=0){ - densitySum += (current->mass / (current->characteristic)); - } - current = current->next; - } - - return densitySum/itemamount; - } -}; -class PCshop :public shopbase { -public: - int fpsAll = 0; - int meanfps(int itemamount) { - item* current = itemZero; - for (int i= -1; i < itemamount; i++) { - fpsAll += current->characteristic; - current = current->next; - } - return fpsAll / itemamount; - } - -}; -int main() { - CARshop carshop; - int carsAmount; - ROCKSshop rocksshop; - int rocksAmount; - PCshop pcshop; - int pcsAmount; - // making a list in file - std::remove("shops.txt"); - std::ofstream out; - out.open("shops.txt", std::ios::app); - if (out.is_open()) { - out << "PCshop" << '\n' << "items 5" << '\n' << "pc1 1 1 fps 1" << '\n' << "pc2 2 2 fps 2" << '\n' << "pc3 3 3 fps 3" << '\n' << "pc4 4 4 fps 4" << '\n' << "pc5 5 5 fps 5" << '\n'; - out << "ROCKSshop" << '\n' << "items 5" << '\n' << "rock1 1 1 volume 1" << '\n' << "rock2 2 2 volume 2" << '\n' << "rock3 3 3 volume 3" << '\n' << "rock4 4 4 volume 4" << '\n' << "rock5 5 5 volume 5" << '\n'; - out << "CARshop" << '\n' << "items 5" << '\n' << "car1 1 1 speed 1" << '\n' << "car2 2 2 speed 2" << '\n' << "car3 3 3 speed 3" << '\n' << "car4 4 4 speed 4" << '\n' << "car5 5 5 speed 5" << '\n'; - } - out.close(); - - //parsing it - std::string line; - std::ifstream in("shops.txt"); - if (in.is_open()) - { // 3 times to do all 3 shops - for (int i = 0; i < 3; i++) { - //depending on which shop first creating it - std::getline(in, line); - if (line == "PCshop") { - // extracting amount of items - std::getline(in, line); - pcsAmount = std::stoi(line.substr(line.find(" ") + 1, line.length())); - for (int i = 0; i < pcsAmount; i++) { - // extracting mass, price and characteristic - std::getline(in, line); - std::string itemarray[5] = {" ", " ", " ", " ", " "}; - int ind = 0; - int prev = 0; - for (int i = 0; i < line.length(); i++) { - if (line[i] == ' ') { - itemarray[ind] = line.substr(prev, i - prev); - prev = i + 1; - ind++; - } - } - itemarray[ind] = line.substr(prev, line.length()); - // adding an item - add(pcshop.itemZero, std::stoi(itemarray[1]), std::stoi(itemarray[2]), std::stoi(itemarray[4])); - } - } - // all the same for two other shops - else if (line == "ROCKSshop") { - std::getline(in, line); - rocksAmount = std::stoi(line.substr(line.find(" ") + 1, line.length())); - for (int i = 0; i < rocksAmount; i++) { - std::getline(in, line); - std::string itemarray[5] = { " ", " ", " ", " ", " " }; - int ind = 0; - int prev = 0; - for (int i = 0; i < line.length(); i++) { - if (line[i] == ' ') { - itemarray[ind] = line.substr(prev, i - prev); - prev = i + 1; - ind++; - } - } - itemarray[ind] = line.substr(prev, line.length()); - add(rocksshop.itemZero, std::stoi(itemarray[1]), std::stoi(itemarray[2]), std::stoi(itemarray[4])); - } - } - else{ - std::getline(in, line); - carsAmount = std::stoi(line.substr(line.find(" ") + 1, line.length())); - for (int i = 0; i < carsAmount; i++) { - std::getline(in, line); - std::string itemarray[5] = { " ", " ", " ", " ", " " }; - int ind = 0; - int prev = 0; - for (int i = 0; i < line.length(); i++) { - if (line[i] == ' ') { - itemarray[ind] = line.substr(prev, i - prev); - prev = i + 1; - ind++; - } - } - itemarray[ind] = line.substr(prev, line.length()); - add(carshop.itemZero, std::stoi(itemarray[1]), std::stoi(itemarray[2]), std::stoi(itemarray[4])); - } - } - } - } - in.close(); - std::cout << "cars mass:" << carshop.countMass(carsAmount)<<'\n'; - std::cout << "cars price:" << carshop.countprice(carsAmount) << '\n'; - std::cout << "pcs mass:" << pcshop.countMass(pcsAmount) << '\n'; - std::cout << "pcs price:" << pcshop.countprice(pcsAmount) << '\n'; - std::cout << "rocks mass:" << rocksshop.countMass(rocksAmount) << '\n'; - std::cout << "rocks price:" << rocksshop.countprice(rocksAmount) << '\n'; - std::cout << "cars max speed:" << carshop.findMaxspeed(carsAmount) << '\n'; - std::cout << "pcs mean fps:" << pcshop.meanfps(pcsAmount) << '\n'; - std::cout << "rocks mean density:" << rocksshop.meandensity(rocksAmount) << '\n'; -/**/ - return 0; - -} \ No newline at end of file diff --git a/sem1/KuznecovGrigory/MiniHomeWork1/HW1.cpp b/sem1/KuznecovGrigory/MiniHomeWork1/HW1.cpp deleted file mode 100644 index 506744e7..00000000 --- a/sem1/KuznecovGrigory/MiniHomeWork1/HW1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -int SquareArea(int SideSize) -{ - return SideSize * SideSize; -} -int main() -{ - setlocale(LC_ALL, "Russian"); - int SquareSide; - std::cout << "Введите сторону квадрата:"; - std::cin >> SquareSide; - std::cout << "Площадь квадрата:" << SquareArea(SquareSide) << '\n'; - return 0; -} \ No newline at end of file diff --git a/sem1/KuznecovGrigory/MiniHomeWork1/HW2.cpp b/sem1/KuznecovGrigory/MiniHomeWork1/HW2.cpp deleted file mode 100644 index 4997830b..00000000 --- a/sem1/KuznecovGrigory/MiniHomeWork1/HW2.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -int TrapezoidArea(int basis1, int basis2, int height) -{ - return (basis1 + basis2) * height / 2; -} -int main() -{ - setlocale(LC_ALL, "Russian"); - int TrapezoidSide1, TrapezoidSide2, TrapezoidHeight; - std::cout << "Введите длину оснований и высоту трапеции:"; - std::cin >> TrapezoidSide1 >> TrapezoidSide2 >> TrapezoidHeight; - std::cout << "Площадь трапеции:" << TrapezoidArea(TrapezoidSide1, TrapezoidSide2, TrapezoidHeight) << '\n'; - return 0; -} \ No newline at end of file diff --git a/sem1/KuznecovGrigory/MiniHomeWork1/HW3.cpp b/sem1/KuznecovGrigory/MiniHomeWork1/HW3.cpp deleted file mode 100644 index 4ece5faa..00000000 --- a/sem1/KuznecovGrigory/MiniHomeWork1/HW3.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include -int FibonacciElements(int FirstElement, int PreviousElement) -{ - int NextElement; - NextElement = FirstElement + PreviousElement; - return NextElement; -} -int main() -{ - setlocale(LC_ALL, "Russian"); - int NumberOfElements, PreviousElement1 = 1, PreviousElement2 = 1, a = 0; - std::cout << "Введите колличество элементов ряда Фибоначи:"; - std::cin >> NumberOfElements; - if (NumberOfElements > 0) - { - std::cout << 1 << ", "; - NumberOfElements -= 1; - std::cout << 1 << ", "; - NumberOfElements -= 1; - while (NumberOfElements > 0) - { - std::cout << FibonacciElements(PreviousElement1, PreviousElement2) << ", "; - a = PreviousElement2; - PreviousElement2 = FibonacciElements(PreviousElement1, PreviousElement2); - PreviousElement1 = a; - NumberOfElements -= 1; - } - } - else - { - if (NumberOfElements < 0) - { - std::cout << "Вы ввели число меньше 0"; - return 0; - } - } - return 0; -} \ No newline at end of file diff --git a/sem1/KuznecovGrigory/MiniHomeWork1/HW4.cpp b/sem1/KuznecovGrigory/MiniHomeWork1/HW4.cpp deleted file mode 100644 index 4e6d8c6e..00000000 --- a/sem1/KuznecovGrigory/MiniHomeWork1/HW4.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -int main() -{ - setlocale(LC_ALL, "Russian"); - int Number, ReversedNumber = 0; - std::cout << "Введите число:"; - std::cin >> Number; - while (Number > 0) - { - ReversedNumber = ReversedNumber * 10 + Number % 10; - Number = Number / 10; - } - std::cout << "Ваше число перевернуто:" << ReversedNumber; - return 0; -} \ No newline at end of file diff --git a/sem1/LaineAnnaMaria/MiniHomeWork1/task1.cpp b/sem1/LaineAnnaMaria/MiniHomeWork1/task1.cpp deleted file mode 100644 index 5bb2c40d..00000000 --- a/sem1/LaineAnnaMaria/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main() -{ - int input = 0; - std::cout << "Enter square side "; - std::cin >> input; - std::cout << "Square area: " << input * input; -} diff --git a/sem1/LaineAnnaMaria/MiniHomeWork1/task2.cpp b/sem1/LaineAnnaMaria/MiniHomeWork1/task2.cpp deleted file mode 100644 index 64a89919..00000000 --- a/sem1/LaineAnnaMaria/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() -{ - float A = 0; - float B = 0;; - float h = 0; - std::cout << "Enter base a "; - std::cin >> A; - std::cout << "Enter base b "; - std::cin >> B; - std::cout << "Enter height "; - std::cin >> h; - std::cout << "Area of trapezium = " << (A + B) * h * 0.5; -} diff --git a/sem1/LaineAnnaMaria/MiniHomeWork1/task3.cpp b/sem1/LaineAnnaMaria/MiniHomeWork1/task3.cpp deleted file mode 100644 index 35234122..00000000 --- a/sem1/LaineAnnaMaria/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int main() -{ - int a = 0; - int b = 1; - int c; - int input; - std::cout << "Enter sequence length "; - std::cin >> input; - std::cout << 1 << " "; - for (int i = 0; i < input - 1; i++) { - c = a + b; - a = b; - b = c; - std::cout << c << " "; - } -} \ No newline at end of file diff --git a/sem1/LaineAnnaMaria/MiniHomeWork1/task4.cpp b/sem1/LaineAnnaMaria/MiniHomeWork1/task4.cpp deleted file mode 100644 index 841a2b9f..00000000 --- a/sem1/LaineAnnaMaria/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() -{ - int input = 0; - int reverse = 0; - std::cout << "Enter a number here, please: "; - std::cin >> input; - while (input > 0) { - reverse = reverse * 10; - reverse += input % 10; - input = input / 10; - } - std::cout << "Reversed number: " << reverse; -} \ No newline at end of file diff --git a/sem1/LaineAnnaMaria/MiniHomeWork2/task1.cpp b/sem1/LaineAnnaMaria/MiniHomeWork2/task1.cpp deleted file mode 100644 index 28b93832..00000000 --- a/sem1/LaineAnnaMaria/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -std::string Converter(int number, int base) { - if (number < 0) { return ""; } - if (base < 2 || base > 16) { return ""; } - if (number == 0) { return "0"; } - - int new_number_length = ceil(log(number) / log(base)); // длина числа после перевода в заданную систему счисления - - std::string new_number(new_number_length, ' '); - - for (int i = new_number_length; i > 0; --i) { - int leftover = number % base; - new_number[i - 1] = char((leftover < 10) ? '0' + leftover : 'A' + leftover - 10); - number /= base; - } - - return new_number; -} - -int main() { - int n, base; - std::cin >> n >> base; - - std::cout << Converter(n, base); -} \ No newline at end of file diff --git a/sem1/LaineAnnaMaria/MiniHomeWork2/task2.cpp b/sem1/LaineAnnaMaria/MiniHomeWork2/task2.cpp deleted file mode 100644 index 268397df..00000000 --- a/sem1/LaineAnnaMaria/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -bool CheckHypothesis(int number) { - while (number != 1) { - number = (number % 2 == 0) ? number / 2 : (number * 3 + 1) / 2; - } - - return number == 1; -} - -int main() { - std::cout - << "Enter interval:" - << "\n"; - - int begin, end; - std::cin >> begin >> end; - - if (begin > end) { return 1; } - - bool hypothesis = true; - for (int i = begin; i <= end && hypothesis; ++i) { - hypothesis = CheckHypothesis(i); - } - - if (hypothesis) { - std::cout << "The Syracuse hypothesis is CORRECT for this interval" << '\n'; - } - else { - std::cout << "The Syracuse hypothesis is INCORRECT for this interval" << '\n'; - } -} \ No newline at end of file diff --git a/sem1/LoginovaAN/mini_homework_1/task1.cpp b/sem1/LoginovaAN/mini_homework_1/task1.cpp deleted file mode 100644 index 76fe691f..00000000 --- a/sem1/LoginovaAN/mini_homework_1/task1.cpp +++ /dev/null @@ -1,7 +0,0 @@ -# include - -int main() { - int num; - std::cin >> num; - std::cout << num * num; -} \ No newline at end of file diff --git a/sem1/LoginovaAN/mini_homework_1/task2.cpp b/sem1/LoginovaAN/mini_homework_1/task2.cpp deleted file mode 100644 index 89396dc3..00000000 --- a/sem1/LoginovaAN/mini_homework_1/task2.cpp +++ /dev/null @@ -1,10 +0,0 @@ -# include - -int main() { - int a, b, h; - std::cin >> a; - std::cin >> b; - std::cin >> h; -std::cout << double (a + b) / 2 * h; - return 0; -} \ No newline at end of file diff --git a/sem1/LoginovaAN/mini_homework_1/task3.cpp b/sem1/LoginovaAN/mini_homework_1/task3.cpp deleted file mode 100644 index 205944b9..00000000 --- a/sem1/LoginovaAN/mini_homework_1/task3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -# include - -int main() { - int n; - int num1 = 0; - int num2 = 1; - int num3; - std::cin >> n; - if (n == 1) { - std::cout << num1 << " "; - } - if (n == 2) { - std::cout << num1 << " "; - std::cout << num2 << " "; - } - else { - std::cout << num1 << " "; - std::cout << num2 << " "; - for (int i = 0; i < n - 2; i++) { - num3 = num1 + num2; - std::cout << num3 << " "; - num1 = num2; - num2 = num3; - } - } - return 0; -} \ No newline at end of file diff --git a/sem1/LoginovaAN/mini_homework_1/task4.cpp b/sem1/LoginovaAN/mini_homework_1/task4.cpp deleted file mode 100644 index d4ea83b2..00000000 --- a/sem1/LoginovaAN/mini_homework_1/task4.cpp +++ /dev/null @@ -1,13 +0,0 @@ -# include - -int main() { - int n; - std::cin >> n; - int res = 0; - while (n) { - res = res * 10 + n % 10; - n /= 10; - } - std::cout << res; - return 0; -} \ No newline at end of file diff --git a/sem1/MakashovGO/MiniHW2/task1.cpp b/sem1/MakashovGO/MiniHW2/task1.cpp deleted file mode 100644 index 5b622340..00000000 --- a/sem1/MakashovGO/MiniHW2/task1.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include - -std::string numsys16() -{ - int num; - std::cout << "Enter number: "; - std::cin >> num; - std::string val = "0123456789ABCDEF"; - std::string a = ""; - while (num != 0) - { - a = val[num % 16] + a; - num /= 16; - } - return a; -} - -std::string numsys8() -{ - int num; - std::cout << "Enter number: "; - std::cin >> num; - std::string a = ""; - while (num != 0) - { - a = std::to_string(num % 8) + a; - num /= 8; - } - return a; -} - - -int main() -{ - printf("Functions:\n" - "1. conversion to the octal numsys\n" - "2. conversion to hexadecimal numsys\n"); - std::cout << "Choose one of the suggested option (enter number): "; - int n; - std::cin >> n; - switch (n) - { - case (1): - std::cout << numsys8(); - break; - case (2): - std::cout << numsys16(); - break; - default: - std::cout << "select a function only from the suggested ones"; - break; - } -} \ No newline at end of file diff --git a/sem1/MakashovGO/MiniHW2/task2.cpp b/sem1/MakashovGO/MiniHW2/task2.cpp deleted file mode 100644 index 46a739ad..00000000 --- a/sem1/MakashovGO/MiniHW2/task2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - - -int main() -{ - int n; - std::cout << "to test the hypothesis, enter a number: "; - std::cin >> n; - if (n <= 0) - { - std::cout << "The number must be natural"; - } - else - { - std::cout << n << ' '; - while (n != 1) - { - if (n % 2 == 0) - { - n /= 2; std::cout << n << ' '; - } - else - { - n = (3 * n + 1) / 2; std::cout << n << ' '; - } - } - } -} \ No newline at end of file diff --git a/sem1/MakashovGO/MiniHW3/Source1.cpp b/sem1/MakashovGO/MiniHW3/Source1.cpp deleted file mode 100644 index c90b661b..00000000 --- a/sem1/MakashovGO/MiniHW3/Source1.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase -{ -public: - std::string name; - int price; - int weight; - - void setItem(const std::string& itemData) - { - std::istringstream iss(itemData); - iss >> name >> price >> weight; - } - - // - void readShopData(std::ifstream& file, std::string& store_name, std::vector& items) - { - std::string line; - - while (std::getline(file, line)) - { - if (line.substr(0, 4) == "Shop") - { - store_name = line.substr(4); - } - else if (line.substr(0, 5) == "items") - { - int val = std::stoi(line.substr(5)); - for (int i = 0; i < val; ++i) - { - if (std::getline(file, line)) - { - ItemBase item; - item.setItem(line); - items.push_back(item); // - } - } - break; // - } - } - } -}; - -class Shop -{ -protected: - std::string store_name; - std::vector items; - double average_price = 0.0; // - double average_weight = 0.0; // - -public: - void addItem(const ItemBase& item) - { - items.push_back(item); - calculateAverage(); // - } - - void calculateAverage() - { - if (items.empty()) return; // - - double total_price = 0; - double total_weight = 0; - - for (const auto& item : items) - { - total_price += item.price; - total_weight += item.weight; - } - - average_price = total_price / items.size(); - average_weight = total_weight / items.size(); - } - - void displayAverage() const - { - std::cout << " : " << store_name << std::endl; - std::cout << " : " << average_price << std::endl; - std::cout << " : " << average_weight << std::endl; - } - - void setStoreName(const std::string& name) - { - store_name = name; - } -}; - -class Shop_Vegetables : public Shop -{ -public: - void readShopData(std::ifstream& file) - { - ItemBase item; - item.readShopData(file, store_name, items); // - calculateAverage(); // - } -}; - -class Shop_Coffee : public Shop -{ -public: - void readShopData(std::ifstream& file) - { - ItemBase item; - item.readShopData(file, store_name, items); // - calculateAverage(); // - } -}; - -class Shop_TableGame : public Shop -{ -public: - void readShopData(std::ifstream& file) - { - ItemBase item; - item.readShopData(file, store_name, items); // - calculateAverage(); // - } -}; - -int main() -{ - setlocale(0, ""); - // . - std::ifstream file("C:/Users/Makas/OneDrive/ /.txt"); - - if (!file.is_open()) - { - std::cerr << " !" << std::endl; - return 1; // . - } - - Shop_Vegetables vegetableShop; - vegetableShop.readShopData(file); // - - Shop_Coffee coffeeShop; - coffeeShop.readShopData(file); // - - Shop_TableGame tableGameShop; - tableGameShop.readShopData(file); // - - file.close(); // . - - // - vegetableShop.displayAverage(); - coffeeShop.displayAverage(); - tableGameShop.displayAverage(); - - return 0; -} \ No newline at end of file diff --git "a/sem1/MakashovGO/MiniHW3/\320\234\320\260\320\263\320\260\320\267\320\270\320\275\321\213.txt" "b/sem1/MakashovGO/MiniHW3/\320\234\320\260\320\263\320\260\320\267\320\270\320\275\321\213.txt" deleted file mode 100644 index 7f6e1828..00000000 --- "a/sem1/MakashovGO/MiniHW3/\320\234\320\260\320\263\320\260\320\267\320\270\320\275\321\213.txt" +++ /dev/null @@ -1,23 +0,0 @@ -Shop Vegetables -items 6 -carrot 50 30 -eggplant 80 100 -tomato 60 24 -cucumber 25 63 -corn 25 75 -potato 52 37 -Shop Coffee -items 5 -moccachino 200 125 -American 230 125 -latte 210 125 -espresso 140 100 -macchiato 210 125 -Shop Table_Game -items 5 -monopoly 1000 300 -cards 120 30 -Dixie 550 200 -D&D 4000 180 -scrabble 1500 300 - diff --git a/sem1/Malinovskii Stepan/Minihomework3/Data.txt b/sem1/Malinovskii Stepan/Minihomework3/Data.txt deleted file mode 100644 index 44ab1af6..00000000 --- a/sem1/Malinovskii Stepan/Minihomework3/Data.txt +++ /dev/null @@ -1,28 +0,0 @@ -Shop dnsShop -Items 2 -cpu 2 -Intel_7 12 12500 1 -Intel_9 32 125000 5 -gpu 3 -Invidia_5090RTX 5000 50000 4 -Invidia_4090RTX 4000 40000 6 -Invidia_3090RTX 3000 30000 3 -Shop patorochkaShop -Item 2 -egg 3 -SpbEgg 10 500 1 -SpbEgg 15 350 2 -MscEgg 2 1000 0 -bottel 3 -Coca 2 80 3 -Coca 1 100 1 -Sprite 2 150 3 -Shop avtoShop -Item 2 -car 3 -Mazerati blue 10000000 1000 -Valborgini red 1000000 800 -BMW black 100 10000 -bike 2 -Yamaha 1000 1000000 300 -Uaz 1 1 100000 \ No newline at end of file diff --git a/sem1/Malinovskii Stepan/Minihomework3/MiniHM3.cpp b/sem1/Malinovskii Stepan/Minihomework3/MiniHM3.cpp deleted file mode 100644 index f12c5e23..00000000 --- a/sem1/Malinovskii Stepan/Minihomework3/MiniHM3.cpp +++ /dev/null @@ -1,427 +0,0 @@ - #include -#include -#include -#include -#include - -enum Enum -{ - dnsShop, patorochkaShop, avtoShop, - bottel, egg, car, bike, gpu, cpu -}; - -class BaseShop; -std::map mapping; -std::vector shops; - -class BaseItem -{ -public: - int price; - int weight; - std::string name; - - BaseItem(int _price, int _weight, std::string _name) - { - price = _price; - weight = _weight; - name = _name; - } - - virtual void showharacter() - { - std::cout << "Name: " + name + " " + "Price: " + std::to_string(price) + "Weight: " + std::to_string(weight) << std::endl; - } -}; - -class BaseShop -{ -public: - std::string name; - std::vector productList; - - void addNewProduct(BaseItem *item) - { - productList.push_back(item); - } - - void midleWeight() - { - std::cout << name << std::endl; - float sum = 0; - for (auto i : productList) - { - sum += i->weight; - } - std::string result = std::to_string(roundf((float)sum / productList.size()*100)/100); - std::cout << "Weight: "+result.substr(0,result.find('.')+2) << std::endl; - } - - void midlePrice() - { - std::cout << name << std::endl; - float sum = 0; - for (auto i : productList) - { - sum += i->price; - } - std::string result = std::to_string(roundf((float)sum / productList.size() * 100) / 100); - std::cout<< "Price: " +result.substr(0, result.find('.') + 2) << std::endl; - } - - void showProduct() - { - std::cout << name << std::endl; - for (auto i: productList) - { - i->showharacter(); - } - } -}; - -class GPU : public BaseItem -{ -public: - int power; - - GPU(int _price, int _weight, int _power, std::string _name) : BaseItem(_price, _weight, _name) - { - power = _power; - } - - void showharacter() - { - std::cout << "Name: " + name + " |||" + " Power: " + std::to_string(power) + " |||" + " Price: " + std::to_string(price) + " |||" + " Weight: " + std::to_string(weight) << std::endl; - } -}; -class CPU : public BaseItem -{ -public: - int countCores; - - CPU(int _price, int _weight, int _countCores, std::string _name) : BaseItem(_price, _weight, _name) - { - countCores = _countCores; - } - - void showharacter() - { - std::cout << "Name: " + name + " |||" + " Number of cores: " + std::to_string(countCores) + " |||" + " Price: " + std::to_string(price) + " |||" + " Weight: " + std::to_string(weight) << std::endl; - } -}; - -class DnsShop : public BaseShop -{ -public: - DnsShop() - { - name = "DnsShop"; - } -}; - -class Bottel : public BaseItem -{ -public: - int volume; - - Bottel(int _price, int _weight, int _volume, std::string _name) : BaseItem(_price, _weight, _name) - { - volume = _volume; - } - - void showharacter() - { - std::cout << "Name: " + name + " |||" + " Volume: " + std::to_string(volume) + " |||" + " Price: " + std::to_string(price) + " |||" + " Weight: " + std::to_string(weight) << std::endl; - } -}; - -class Egg : public BaseItem -{ -public: - int count; - - Egg(int _price, int _weight, int _count, std::string _name) : BaseItem(_price, _weight, _name) - { - count = _count; - } - - void showharacter() - { - std::cout << "Name: " + name + " |||" + " Count eggs: " + std::to_string(count) + " |||" + " Price: " + std::to_string(price) + " |||" + " Weight: " + std::to_string(weight) << std::endl; - } -}; - -class PatorochkaShop : public BaseShop -{ -public: - PatorochkaShop() - { - name = "PatorochkaShop"; - } -}; - -class Bike : public BaseItem -{ -public: - int power; - - Bike(int _price, int _weight, int _power, std::string _name) : BaseItem(_price, _weight, _name) - { - power = _power; - } - - void showharacter() - { - std::cout << "Name: " + name + " |||" + " Power: " + std::to_string(power) + " |||" + " Price: " + std::to_string(price) + " |||" + " Weight: " + std::to_string(weight) << std::endl; - } -}; - -class Car : public BaseItem -{ -public: - std::string color; - - Car(int _price, int _weight, std::string _color, std::string _name) : BaseItem(_price, _weight, _name) - { - color = _color; - } - - void showharacter() - { - std::cout << "Name: " + name + " |||" + " Color: " + color + " |||" + " Price: " + std::to_string(price) + " |||" + " Weight: " + std::to_string(weight) << std::endl; - } -}; - -class AvtoShop : public BaseShop -{ -public: - AvtoShop() - { - name = "AvtoShop"; - } -}; - -void divide(std::string line, std::vector* sLine) -{ - int l = 0; - for (int i = 0;i < line.size();i++) - { - while (line[i] == ' ' ) - { - sLine->push_back(line.substr(l, i - l)); - l = i + 1; - break; - } - if (i + 1 == line.size()) sLine->push_back(line.substr(l, i - l+1)); - } -} - - -void reader() -{ - std::string line; - std::vector sLine; - std::ifstream file("Data.txt"); - while (std::getline(file, line)) - { - divide(line, &sLine); - if (sLine[0] == "Shop") - { - switch (mapping[sLine[1]]) - { - case (dnsShop): - { - DnsShop shop = DnsShop(); - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - int n = std::stoi(sLine[1]); - for (int i = 0; i < n;i++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - switch (mapping[sLine[0]]) - { - case(cpu): - { - int nn = std::stoi(sLine[1]); - for (int j = 0;j < nn;j++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - CPU *cpu = new CPU(std::stof(sLine[2]), std::stof(sLine[3]), std::stof(sLine[1]), sLine[0]); - shop.addNewProduct(cpu); - } - break; - } - case(gpu): - { - int nn = std::stoi(sLine[1]); - for (int j = 0;j < nn;j++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - GPU *gpu = new GPU(std::stof(sLine[2]), std::stof(sLine[3]), std::stof(sLine[1]), sLine[0]); - shop.addNewProduct(gpu); - } - break; - } - } - } - shops.push_back(shop); - break; - } - case (avtoShop): - { - AvtoShop shop = AvtoShop(); - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - int n = std::stoi(sLine[1]); - for (int i = 0; i < n;i++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - switch (mapping[sLine[0]]) - { - case(bike): - { - int nn = std::stoi(sLine[1]); - for (int j = 0;j < nn;j++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - Bike *bike = new Bike(std::stof(sLine[2]), std::stof(sLine[3]), std::stof(sLine[1]), sLine[0]); - shop.addNewProduct(bike); - } - break; - } - case(car): - { - int nn = std::stoi(sLine[1]); - for (int j = 0;j < nn;j++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - Car *car = new Car(std::stof(sLine[2]), std::stof(sLine[3]), sLine[1], sLine[0]); - shop.addNewProduct(car); - } - break; - } - } - } - shops.push_back(shop); - break; - } - case (patorochkaShop): - { - PatorochkaShop shop = PatorochkaShop(); - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - int n = std::stoi(sLine[1]); - for (int i = 0; i < n;i++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - switch (mapping[sLine[0]]) - { - case(egg): - { - int nn = std::stoi(sLine[1]); - for (int j = 0;j < nn;j++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - Egg *egg = new Egg(std::stof(sLine[2]), std::stof(sLine[3]), std::stof(sLine[1]), sLine[0]); - shop.addNewProduct(egg); - } - break; - } - case(bottel): - { - int nn = std::stoi(sLine[1]); - for (int j = 0;j < nn;j++) - { - std::getline(file, line); - sLine.clear(); - divide(line, &sLine); - Bottel *bottel = new Bottel(std::stof(sLine[2]), std::stof(sLine[3]), std::stof(sLine[1]), sLine[0]); - shop.addNewProduct(bottel); - } - break; - } - } - } - shops.push_back(shop); - break; - } - } - } - sLine.clear(); - } - file.close(); -}; - -void menu() -{ - while (true) - { - int selected; - std::cout << "Menu+\n1 - Show assortment of stores3\n2 - Show midle weight\n3 - Show midle price\n4 - exit\n"; - std::cout << "Select option: "; - std::cin >> selected; - system("cls"); - switch (selected) - { - case(1): - for (auto i : shops) - i.showProduct(); - break; - case(2): - for (auto i : shops) - i.midleWeight(); - break; - case(3): - for (auto i : shops) - i.midlePrice(); - break; - case(4): - exit(5); - break; - } - system("pause"); - system("cls"); - } -} - -void start() -{ - mapping["gpu"] = gpu; - mapping["cpu"] = cpu; - mapping["dnsShop"] = dnsShop; - - mapping["egg"] = egg; - mapping["bottel"] = bottel; - mapping["patorochkaShop"] = patorochkaShop; - - mapping["car"] = car; - mapping["bike"] = bike; - mapping["avtoShop"] = avtoShop; - - reader(); - menu(); -} - -int main() -{ - start(); -} \ No newline at end of file diff --git a/sem1/Mambetov Aslan/MiniHomeWork1/task1.cpp b/sem1/Mambetov Aslan/MiniHomeWork1/task1.cpp deleted file mode 100644 index 367e5c9c..00000000 --- a/sem1/Mambetov Aslan/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include - - -double calcSqrAreaBySide(double sqrSide) { - return sqrSide * sqrSide; -} - -double calcQuadrangleAreaByCoord(std::pair point1, - std::pair point2, - std::pair point3, - std::pair point4) { - return abs(point1.first * point2.second + point2.first * point3.second + point3.first * point4.second + point4.first * point1.second - - point1.second * point2.first - point2.second * point3.first - point3.second * point4.first - point4.second * point1.first) / 2; -} - - - -int main() { - setlocale(LC_ALL, "Russian"); - - int mode; - std::cout << "Как вы хотите узнать площадь квадрата? \n Введите 1, если по стороне \n Введите 2, если по координатам вершин \n"; - std::cin >> mode; - - if (mode == 1) { - double side; - std::cout << "\nВведите сторону квадрата: "; - std::cin >> side; - std::cout << "\nПлощадь заданного квадрата: " << calcSqrAreaBySide(side) << "\n"; - } - else if (mode == 2) { - double x1, y1, x2, y2, x3, y3, x4, y4; - std::cout << "Введите координаты x и y вершин квадрата (по 2 числа на каждой строчке):\n"; - std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; - std::cout << "\nПлощадь заданного квадрата: " << calcQuadrangleAreaByCoord({ x1, y1 }, { x2, y2 }, { x3, y3 }, { x4, y4 }) << "\n"; - } - else { - std::cout << "\nНекорректный режим\n"; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/Mambetov Aslan/MiniHomeWork1/task2.cpp b/sem1/Mambetov Aslan/MiniHomeWork1/task2.cpp deleted file mode 100644 index 2e1d93e9..00000000 --- a/sem1/Mambetov Aslan/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include - - - -double calcTrapezoidAreaByHeightAndBases(int height, int firstBase, int secondBase) { - return (firstBase + secondBase) / 2 * height; -} - -double calcQuadrangleAreaByCoord(std::pair point1, - std::pair point2, - std::pair point3, - std::pair point4) { - return abs(point1.first * point2.second + point2.first * point3.second + point3.first * point4.second + point4.first * point1.second - - point1.second * point2.first - point2.second * point3.first - point3.second * point4.first - point4.second * point1.first) / 2; -} - - - - -int main() { - setlocale(LC_ALL, "Russian"); - - int mode; - std::cout << "Как вы хотите узнать площадь трапеции? \n Введите 1, если по высоте и основаниям \n Введите 2, если по координатам вершин \n"; - std::cin >> mode; - - if (mode == 1) { - double height, firstBase, secondBase; - std::cout << "Введите высоту: "; - std::cin >> height; - std::cout << "\nВведите первое основание: "; - std::cin >> firstBase; - std::cout << "\nВведите второе основание: "; - std::cin >> secondBase; - std::cout << "\nПлощадь заданной трапеции: " << calcTrapezoidAreaByHeightAndBases(height, firstBase, secondBase) << "\n"; - } - else if (mode == 2) { - double x1, y1, x2, y2, x3, y3, x4, y4; - std::cout << "Введите координаты x и y вершин трапеции (по 2 числа на каждой строчке):\n"; - std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; - std::cout << "\nПлощадь заданной трапеции: " << calcQuadrangleAreaByCoord({ x1, y1 }, { x2, y2 }, { x3, y3 }, { x4, y4 }) << "\n"; - } - else { - std::cout << "\nНекорректный режим\n"; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/Mambetov Aslan/MiniHomeWork1/task3.cpp b/sem1/Mambetov Aslan/MiniHomeWork1/task3.cpp deleted file mode 100644 index 2e30cad9..00000000 --- a/sem1/Mambetov Aslan/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -int main() { - setlocale(LC_ALL, "Russian"); - - std::cout << "Введите количество чисел Фибоначчи: "; - int n; std::cin >> n; - int prev = 0; - int cur = 1; - - std::cout << 0 << ' '; - - for (int i = 0; i < n; ++i) { - int tmp = prev; - - std::cout << cur << ' '; - prev = cur; - cur += tmp; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/Mambetov Aslan/MiniHomeWork1/task4.cpp b/sem1/Mambetov Aslan/MiniHomeWork1/task4.cpp deleted file mode 100644 index 012cb2f3..00000000 --- a/sem1/Mambetov Aslan/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include - - -int main() { - setlocale(LC_ALL, "Russian"); - - std::cout << "Введите число которое хотите перевернуть: "; - long long n; std::cin >> n; - long long tmp = n; - long long l = 1, r = 10; - long long result = 0; - - while (tmp > 0) { - tmp /= 10; - l *= 10; - } - while (l > 1) { - result += ((n % r) / (r / 10)) * l; - l /= 10; - r *= 10; - } - result /= 10; - std::cout << result; - return 0; -} \ No newline at end of file diff --git a/sem1/MatyukhinAlexey/Mini_Homework_1/task1.cpp b/sem1/MatyukhinAlexey/Mini_Homework_1/task1.cpp deleted file mode 100644 index cad5a38b..00000000 --- a/sem1/MatyukhinAlexey/Mini_Homework_1/task1.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// - -// - -#include "iostream" - -float squareArea(const float side) { - return side * side; -} - -int main() { - float side; - - std::cout << "Enter the side of the square: "; - std::cin >> side; - - const float area = squareArea(side); - std::cout << "Area of the square: " << area << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/MatyukhinAlexey/Mini_Homework_1/task2.cpp b/sem1/MatyukhinAlexey/Mini_Homework_1/task2.cpp deleted file mode 100644 index 154e7e95..00000000 --- a/sem1/MatyukhinAlexey/Mini_Homework_1/task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// - -// - -#include "iostream" - -float trapezoidzArea(const float base0, const float base1, const float height) { - return (base0 + base1) * 0.5f * height; -} - -int main() { - float base0, base1, height; - - std::cout << "Enter the bases of the trapezoid: "; - std::cin >> base0 >> base1; - - std::cout << "Enter the height of the trapezoid: "; - std::cin >> height; - - const float area = trapezoidzArea(base0, base1, height); - std::cout << "Area of the trapezoid: " << area << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/MatyukhinAlexey/Mini_Homework_1/task3.cpp b/sem1/MatyukhinAlexey/Mini_Homework_1/task3.cpp deleted file mode 100644 index a0c91587..00000000 --- a/sem1/MatyukhinAlexey/Mini_Homework_1/task3.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -// - -// - -#include "iostream" - -void n_fibonacci(const int n) { - long long int* fibonacci = new long long int[std::max(n, 0)]; - - if (n >= 1) { - fibonacci[0] = 0; - std::cout << fibonacci[0] << std::endl; - } - if (n >= 2) { - fibonacci[1] = 1; - std::cout << fibonacci[1] << std::endl; - } - - for (int i = 2; i < n; i++) { - fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2]; - std::cout << fibonacci[i] << std::endl; - } - - delete[] fibonacci; -} - -int main() { - int n; - - std::cout << "Enter the number of terms in the fibonacci sequence: "; - std::cin >> n; - - n_fibonacci(n); - - return 0; -} \ No newline at end of file diff --git a/sem1/MatyukhinAlexey/Mini_Homework_1/task4.cpp b/sem1/MatyukhinAlexey/Mini_Homework_1/task4.cpp deleted file mode 100644 index 3d5c15d6..00000000 --- a/sem1/MatyukhinAlexey/Mini_Homework_1/task4.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -// - -// - -#include "iostream" - -int revert_number(int number) { - int revert_number = 0; - - while (number != 0) { - revert_number = revert_number * 10 + number % 10; - number /= 10; - } - - return revert_number; -} - -int main() { - int n; - - std::cout << "Enter a number: "; - std::cin >> n; - - const int reverted_n = revert_number(n); - std::cout << "Reverted number: " << reverted_n << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/MatyukhinAlexey/Mini_Homework_2/task1.cpp b/sem1/MatyukhinAlexey/Mini_Homework_2/task1.cpp deleted file mode 100644 index 896d7a75..00000000 --- a/sem1/MatyukhinAlexey/Mini_Homework_2/task1.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// -// - -// - -#include "iostream" - -char* to_base_n(const int number, const int base) { - if (base < 2 || base > 16) { - return nullptr; - } - - int n = number; - int length = 0; - while (n != 0) { - n /= base; - length++; - } - - char* result = new char[length + 1]; - result[length] = '\0'; - - n = number; - for (int i = length - 1; i >= 0; i--) { - const int digit = n % base; - result[i] = digit < 10 ? '0' + digit : 'A' + digit - 10; - n /= base; - } - - return result; -} - -void print_num_in_base(const int number, const int base) { - char* result = to_base_n(number, base); - if (result == nullptr) { - std::cout << "Invalid base" << std::endl; - } - else { - std::cout << "Number in base " << base << ": " << result << std::endl; - delete[] result; - } -} - -int main() { - int mode; - std::cout << "Enter the mode (1 - decimal to custom (2-16), 2 - decimal to octal, 3 - decimal to hexadecimal): "; - std::cin >> mode; - - switch (mode) { - case 1: { - std::cout << "Selected custom base" << std::endl; - - int number, base; - std::cout << "Enter the number: "; - std::cin >> number; - - std::cout << "Enter the base: "; - std::cin >> base; - - print_num_in_base(number, base); - break; - } - case 2: { - std::cout << "Selected octal base" << std::endl; - - int number; - std::cout << "Enter the number: "; - std::cin >> number; - - print_num_in_base(number, 8); - break; - } - case 3: { - int number; - std::cout << "Selected hexadecimal base" << std::endl; - std::cout << "Enter the number: "; - std::cin >> number; - - print_num_in_base(number, 16); - break; - } - default: { - std::cout << "Invalid mode" << std::endl; - break; - } - } -} \ No newline at end of file diff --git a/sem1/MatyukhinAlexey/Mini_Homework_2/task2.cpp b/sem1/MatyukhinAlexey/Mini_Homework_2/task2.cpp deleted file mode 100644 index 32f31fdc..00000000 --- a/sem1/MatyukhinAlexey/Mini_Homework_2/task2.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// - -// - -#include "iostream" - -bool check_syracuse_sequence(const int n) { - int number = n; - - while (number > 1) { - number = number % 2 == 0 ? number / 2 : (number * 3 + 1) / 2; - } - - if (number == 1) { - std::cout << "The Syracuse sequence for " << n << " converges to 1" << std::endl; - } - else { - std::cout << "The Syracuse sequence for " << n << " does not converge to 1" << std::endl; - } - - return number == 1; -} - -int main() { - - int start_number, end_number; - std::cout << "Enter the start number: "; - std::cin >> start_number; - - std::cout << "Enter the end number: "; - std::cin >> end_number; - - if (start_number > end_number) { - std::cout << "The start number must be less than or equal to the end number" << std::endl; - return 1; - } - - bool is_converging = true; - for (int i = start_number; i <= end_number && is_converging; i++) { - is_converging = check_syracuse_sequence(i); - } - - if (is_converging) { - std::cout << "All numbers in the interval converge to 1" << std::endl; - } - else { - std::cout << "Not all numbers in the interval converge to 1" << std::endl; - } -} \ No newline at end of file diff --git a/sem1/Mikhail Volkov/hw1.cpp b/sem1/Mikhail Volkov/hw1.cpp deleted file mode 100644 index fd319217..00000000 --- a/sem1/Mikhail Volkov/hw1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -int main() -{ - int peps; - std::cout<<"Enter the side of square:"; - std::cin>> peps; - - std::cout<< pow(peps,2); - - return 0; -} diff --git a/sem1/Mikhail Volkov/hw2.cpp b/sem1/Mikhail Volkov/hw2.cpp deleted file mode 100644 index 5d0401d1..00000000 --- a/sem1/Mikhail Volkov/hw2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -int main() -{ - int peps; - std::cout<<"Enter the first side of trapezoid: "; - std::cin>> peps; - int pops; - std::cout<<"Enter the second side of trapezoid: "; - std::cin>> pops; - int cocs; - std::cout<<"Enter the height of the trapezoid: "; - std::cin>> cocs; - - int sps = (peps*pops)/2*cocs; - std::cout< - -int main() -{ - int pp1 = 0; - int pp2 = 1; - int nextpp; - int termP; - - std::cout <<"Enter the Fibonnachi elements: "; - std::cin >> termP; - - for(int hhd = 1; hhd < termP; hhd++) - { - if (hhd == 1) - { - std::cout<< pp1 << ".."; - } - if ( hhd == 2) - { - std::cout<< pp2 << ".."; - } - else { - - nextpp = pp1 + pp2; - pp1 = pp2; - pp2 = nextpp; - - std::cout << nextpp << ".."; - } - } - - return 0; -} diff --git a/sem1/Mikhail Volkov/hw4.cpp b/sem1/Mikhail Volkov/hw4.cpp deleted file mode 100644 index 50c13a2e..00000000 --- a/sem1/Mikhail Volkov/hw4.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int main() { - int nmbr; - int rvrsdNmbr = 0; - - std::cout << "Enter a number to reverse: "; - std::cin >> nmbr; - - while (nmbr != 0) - { - rvrsdNmbr *= 10; - rvrsdNmbr += nmbr % 10; - nmbr /= 10; - } - - std::cout << rvrsdNmbr; - -} diff --git a/sem1/MikhaylovaAnastasia/minihomework3/minihomework3.cpp b/sem1/MikhaylovaAnastasia/minihomework3/minihomework3.cpp deleted file mode 100644 index bc1fc0ec..00000000 --- a/sem1/MikhaylovaAnastasia/minihomework3/minihomework3.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include -#include -#include -#include -#include - -class Product { -public: - std::string name; - double price; - double weight; - - Product(const std::string& name, double price, double weight) - : name(name), price(price), weight(weight) {} - - virtual void display() const { - std::cout << "Product: " << name << ", Price: $" << price - << ", Weight: " << weight << " kg\n"; - } - - virtual ~Product() = default; -}; - -class Shop { -public: - std::string shopName; - std::vector products; - - ~Shop() { - for (Product* product : products) { - delete product; - } - } - - void addProduct(Product* product) { - products.push_back(product); - } - - double calculateAveragePrice() const { - if (products.empty()) return 0.0; - - double total = 0.0; - for (const Product* product : products) { - total += product->price; - } - return total / products.size(); - } - - double calculateAverageWeight() const { - if (products.empty()) return 0.0; - - double totalWeight = 0.0; - for (const Product* product : products) { - totalWeight += product->weight; - } - return totalWeight / products.size(); - } - - void displayAll() const { - std::cout << "Shop: " << shopName << "\n"; - for (const Product* product : products) { - product->display(); - } - std::cout << "Average Price: $" << calculateAveragePrice() << "\n"; - std::cout << "Average Weight: " << calculateAverageWeight() << " kg\n"; - } -}; - -class Fruit : public Product { -public: - std::string origin; - - Fruit(const std::string& name, double price, double weight, const std::string& origin) - : Product(name, price, weight), origin(origin) {} - - void display() const override { - std::cout << "Fruit: " << name << ", Price: $" << price - << ", Weight: " << weight << " kg, Origin: " << origin << "\n"; - } -}; - -void loadShopsFromFile(const std::string& filename, std::vector& shops) { - std::ifstream file(filename); - if (!file.is_open()) { - std::cerr << "Error: Could not open file.\n"; - return; - } - - std::string line; - while (std::getline(file, line)) { - std::istringstream iss(line); - std::string shopType; - iss >> shopType; - - Shop* shop = new Shop(); - shop->shopName = line; - - int itemCount = 0; - if (std::getline(file, line)) { - std::istringstream issCount(line); - std::string itemsLabel; - issCount >> itemsLabel >> itemCount; - } - else { - std::cerr << "Error: Unable to read item count for " << shop->shopName << ".\n"; - delete shop; - continue; - } - - for (int i = 0; i < itemCount; ++i) { - if (std::getline(file, line)) { - std::istringstream issProduct(line); - std::string name; - double price, weight; - - if (issProduct >> name >> price >> weight) { - if (shopType == "ShopFruits") { - std::string origin; - issProduct >> origin; - shop->addProduct(new Fruit(name, price, weight, origin)); - } - else { - shop->addProduct(new Product(name, price, weight)); - } - } - else { - std::cerr << "Error reading product data: " << line << "\n"; - } - } - else { - std::cerr << "Error: Not enough lines to read products for " << shop->shopName << ".\n"; - break; - } - } - shops.push_back(shop); - } - - file.close(); -} - -int main() { - setlocale(LC_ALL, "RUS"); - std::vector shops; - loadShopsFromFile("shop_data.txt", shops); - for (const auto& shop : shops) { - shop->displayAll(); - std::cout << "\n"; - } - for (auto shop : shops) { - delete shop; - } - return 0; -} \ No newline at end of file diff --git a/sem1/MikhaylovaAnastasia/minihomework3/shop_data.txt b/sem1/MikhaylovaAnastasia/minihomework3/shop_data.txt deleted file mode 100644 index 51a0fb92..00000000 --- a/sem1/MikhaylovaAnastasia/minihomework3/shop_data.txt +++ /dev/null @@ -1,7 +0,0 @@ -Shop ShopPC -Items 2 -CPU 100 1.5 -GPU 150 1.0 -Shop ShopFruits -Items 1 -Apple 2.0 0.2 USA \ No newline at end of file diff --git a/sem1/MikhnevVM/MiniHM3/MiniHomework_3.cpp b/sem1/MikhnevVM/MiniHM3/MiniHomework_3.cpp deleted file mode 100644 index c61088ff..00000000 --- a/sem1/MikhnevVM/MiniHM3/MiniHomework_3.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase { -public: - virtual double getPrice() const = 0; - virtual double getWeight() const = 0; - virtual ~ItemBase() {} -}; - -class Item : public ItemBase { -private: - std::string name; - double price; - double weight; - -public: - Item(const std::string name, double price, double weight) - : name(name), price(price), weight(weight) {} - - double getPrice() const override { - return price; - } - - double getWeight() const override { - return weight; - } -}; - -class Shop { -private: - std::string name; - std::vector items; - -public: - Shop(const std::string name) : name(name) {} - - void addItem(const Item item) { - items.push_back(item); - } - - double averagePrice() const { - if (items.empty()) return 0; - double total = 0; - for (const auto item : items) { - total += item.getPrice(); - } - return total / items.size(); - } - - double averageWeight() const { - if (items.empty()) return 0; - double total = 0.0; - for (const auto& item : items) { - total += item.getWeight(); - } - return total / items.size(); - } - - const std::string& getName() const { - return name; - } -}; - -std::vector parseFile(const std::string filePath) { - std::vector shops; - std::ifstream file(filePath); - std::string line; - - while (std::getline(file, line)) { - if (line.find("Shop") == 0) { - std::string shopName = line.substr(5); - Shop shop(shopName); - - std::getline(file, line); - int itemsCount = std::stoi(line.substr(6)); - - for (int i = 0; i < itemsCount; ++i) { - std::getline(file, line); - std::istringstream iss(line); - std::string itemName; - double itemPrice, itemWeight; - - iss >> itemName >> itemPrice >> itemWeight; - shop.addItem(Item(itemName, itemPrice, itemWeight)); - } - shops.push_back(shop); - } - } - return shops; -} - -int main() { - std::vector shops = parseFile("shops.txt"); - - for (const auto shop : shops) { - double avgPrice = shop.averagePrice(); - double avgWeight = shop.averageWeight(); - std::cout << "Shop: " << shop.getName() - << ", Average Price: " << avgPrice - << ", Average Weight: " << avgWeight << std::endl; - } - - return 0; -} diff --git a/sem1/MikhnevVM/MiniHM3/shops.txt.txt b/sem1/MikhnevVM/MiniHM3/shops.txt.txt deleted file mode 100644 index de35ec93..00000000 --- a/sem1/MikhnevVM/MiniHM3/shops.txt.txt +++ /dev/null @@ -1,21 +0,0 @@ -Shop Electronics -Items 5 -Laptop 1200 2.5 -Smartphone 800 0.2 -Tablet1 400 0.5 -Tablet2 500 0.5 -Tablet 600 0.5 -Shop Groceries -Items 5 -Apple 3000 0.1 -Banana 0.5 0.15 -Orange 0.8 0.2 -Mango 30 1 -Painapple 400 2 -Shop Furniture -Items 5 -Chair 50 5 -Table 150 15 -Sofa 300 30 -mirror 400 1 -closet 600 10 \ No newline at end of file diff --git a/sem1/MikhnevVM/MiniHomeWork1/task1.cpp b/sem1/MikhnevVM/MiniHomeWork1/task1.cpp deleted file mode 100644 index 711820b2..00000000 --- a/sem1/MikhnevVM/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int area_of_a_square(int a) -{ - return a*a; -} - -int main() -{ - int side_of_the_square; - std::cout << "Введите длинну стороны квадрата:" << "\n"; - std::cin >> side_of_the_square; - - std::cout << "Площадь квадрата = " << area_of_a_square(side_of_the_square); -} \ No newline at end of file diff --git a/sem1/MikhnevVM/MiniHomeWork1/task2.cpp b/sem1/MikhnevVM/MiniHomeWork1/task2.cpp deleted file mode 100644 index d53c194a..00000000 --- a/sem1/MikhnevVM/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -double area_of_a_trapezoid(double a, double b, double h) -{ - return (a+b)/2*h; -} - -int main() -{ - double base_a, base_b, heigh_of_trapezoid; - std::cout << "Введите длинну меньшего основания трапеции:" << "\n"; - std::cin >> base_a; - std::cout << "Введите длинну большего основания трапеции:" << "\n"; - std::cin >> base_b; - std::cout << "Введите длинну высоу трапеции:" << "\n"; - std::cin >> heigh_of_trapezoid; - - std::cout << "Площадь трапеции = " << area_of_a_trapezoid(base_a, base_b, heigh_of_trapezoid); -} \ No newline at end of file diff --git a/sem1/MikhnevVM/MiniHomeWork1/task3.cpp b/sem1/MikhnevVM/MiniHomeWork1/task3.cpp deleted file mode 100644 index b4482e49..00000000 --- a/sem1/MikhnevVM/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - - -int main() -{ - int fib1, fib2, n, storage; - fib1 = 0; - fib2 = 1; - std::cout << "Введите любимое число больше 0 и я выведу ряд чисел Фибоначчи:" << "\n"; - std::cin >> n; - while (n <= 0){ - std::cout << "Прошлое число не больше 0, введите пожалуйста любое число больше 0:" << "\n"; - std::cin >> n; - } - if (n == 1){ - std::cout << 0; - } - else if (n == 2) - { - std::cout << "0 1"; - } - else - { - for(int i = 0; i < n; i++) - { - std::cout << fib1 << " "; - storage = fib2; - fib2 += fib1; - fib1 = storage; - } - - } - - -} \ No newline at end of file diff --git a/sem1/MikhnevVM/MiniHomeWork1/task4.cpp b/sem1/MikhnevVM/MiniHomeWork1/task4.cpp deleted file mode 100644 index b09f4309..00000000 --- a/sem1/MikhnevVM/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int main() -{ - int number, revers_number,cnt; - cnt = 0; - revers_number = 0; - std::cout << "Введите число и я переверну его цифры:"; - std::cin >> number; - while (number > 0){ - if(number%10 == 0){ - cnt+=1; - - } - revers_number += number%10; - number/=10; - revers_number*=10; - } - if (cnt > 0){ - std::cout << '0' << revers_number/10; - }else{ - std::cout << revers_number/10; - } -} \ No newline at end of file diff --git a/sem1/MikhnevVM/MiniHomeWork2/task1.cpp b/sem1/MikhnevVM/MiniHomeWork2/task1.cpp deleted file mode 100644 index cfbe7121..00000000 --- a/sem1/MikhnevVM/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - - -int main() -{ - int number, operatoin; - std::cout<<"Введите число, котрое вы хотите перевести в другую сиситему счисления:" << '\n'; - std::cin >> number; - std::cout<< '\n'; - std::cout<<"Если Вы хотите перевести число в 8СС, введите 1. " << '\n'; - std::cout<<"Если Вы хотите перевести в 16СС, введите 2 " << '\n'; - std::cin >> operatoin; - std::cout<< '\n'; - while(operatoin != 1 and operatoin != 2) - { - std::cout<<"ВЫ ВВЕЛИ НЕ КОРЕКТНУЮ ОПЕРАЦИЮ, ПОВТОРИТЕ ПОПЫТКУ!!!"<< '\n'; - std::cout << '\n'; - std::cout<<"Если Вы хотите перевести число в 8СС, введите 1. " << '\n'; - std::cout<<"Если Вы хотите перевести в 16СС, введите 2 "<< '\n'; - std::cin >> operatoin; - std::cout<< '\n'; - - } - if (operatoin == 1) - { - std::cout<<"Ваше число в 8СС равно: "<< std::oct << number; - } - else - { - std::cout<<"Ваше число в 16СС равно: "<< std::hex << number; - } - -} ` \ No newline at end of file diff --git a/sem1/MikhnevVM/MiniHomeWork2/task2_2.cpp b/sem1/MikhnevVM/MiniHomeWork2/task2_2.cpp deleted file mode 100644 index a0480a94..00000000 --- a/sem1/MikhnevVM/MiniHomeWork2/task2_2.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -#include - -int main() -{ - int number, main_menu; - while (1==1) - { - std::cout << "Введите число и я проверю для него гипотезу Сиракуз" << '\n'; - std::cin >> number; - while (number != 1) - { - if (number%2==0) - { - number/=2; - std::cout << number << '\n'; - }else - { - number = (number * 3 + 1)/2; - std::cout << number << '\n'; - } - - } - std::cout << '\n'; - std::cout << "Для этого числа теория Сиракуз работает" << '\n'; - std::cout << "Если вы хотите завершить работу программы введите 0, иначе введите 1" << '\n'; - std::cin >> main_menu; - if (main_menu == 0) - { - break; - } - - - } -} \ No newline at end of file diff --git a/sem1/Moshchanetskaya Maria/task2.1.cpp b/sem1/Moshchanetskaya Maria/task2.1.cpp deleted file mode 100644 index 2dafee45..00000000 --- a/sem1/Moshchanetskaya Maria/task2.1.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// task2.1.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// - -#include -#include -using std::string; -using std::endl; -using std::to_string; - -int main() -{ - setlocale(LC_ALL, "Russian"); - int number10; - int number10_copy; - string remainder = ""; - string number16 = ""; - string number8 = ""; - std::cout << "введите натуральное число" << endl ; - std::cin >> number10; - number10_copy = number10; - char variable; - - - while (number10 > 0) - { - if (number10 % 16 < 10) - { - remainder = to_string(number10 % 16); - } - else - { - variable = number10%16 + 55; - remainder = variable; - } - number16 = remainder + number16; - number10 = number10 / 16; - } - - while (number10_copy > 0) - { - number8 = to_string(number10_copy % 8) + number8; - number10_copy = number10_copy / 8; - } - std::cout <<" в шестнадцатиричной системе = " < "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/sem1/Moshchanetskaya Maria/task2.2.cpp b/sem1/Moshchanetskaya Maria/task2.2.cpp deleted file mode 100644 index 6688c325..00000000 --- a/sem1/Moshchanetskaya Maria/task2.2.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// task2.2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// - -#include - -long long number; -int main() -{ - setlocale(LC_ALL, "Russian"); - std::cout << "введите натуральное число " << std::endl; - std::cin >> number; - while (number > 1) - { - if (number % 2 == 0) - { - number = number / 2; - } - else - { - number = (number * 3 + 1) / 2; - } - } - std::cout << number << std:: endl; - if (number == 1) - { - std::cout << "что и требовалось доказать"; - } - else - { - std::cout << "опровергнуто"; - } -} - - - -// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. diff --git a/sem1/Muhamed Muratdurdyyev/dz1.cpp b/sem1/Muhamed Muratdurdyyev/dz1.cpp deleted file mode 100644 index dbd179a6..00000000 --- a/sem1/Muhamed Muratdurdyyev/dz1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int main() -{ - int cup; - - std::cout<<"Side of a square: "; - std::cin>> cup ; - - std::cout<< "Area:"< - - -int main() -{ - int pl1 = 0 ; - int pl2 = 1 ; - int nextPl; - int plN; - - std::cout << "Vvedite kol-vo cifr "; - std::cin >> plN; - - for (int pl = 1; pl < plN; ++pl) - { - if (pl == 1) - { - std::cout << pl1 << ":" ; - } - if (pl == 2) - { - std::cout << pl2 << ":" ; - } - else { - nextPl = pl1 + pl2 ; - pl1 = pl2; - pl2 = nextPl; - - std::cout<< nextPl << ":" ; - - } - } - -} - - - - - diff --git a/sem1/Muhamed Muratdurdyyev/dz3.cpp b/sem1/Muhamed Muratdurdyyev/dz3.cpp deleted file mode 100644 index dbd179a6..00000000 --- a/sem1/Muhamed Muratdurdyyev/dz3.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int main() -{ - int cup; - - std::cout<<"Side of a square: "; - std::cin>> cup ; - - std::cout<< "Area:"< -using namespace std; - -int main() { - int nm, reverse = 0, rem; - cout << "Enter a number: "; - cin >> nm; - while (nm > 0) { - rem = nm % 10; - reverse = reverse * 10 + rem; - nm /= 10; - } - cout << "Reversed Number: " << reverse << endl; - return 0; -} diff --git a/sem1/MusikhinIgor/MiniHomeWork1/Task1.cpp b/sem1/MusikhinIgor/MiniHomeWork1/Task1.cpp deleted file mode 100644 index 5b592de1..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int SquareArea(int Length) { - return Length * Length; -} - -int main() { - int InputSide; - std::cout << "Enter the side length of the square: "; - std::cin >> InputSide; - - int Area = SquareArea(InputSide); - std::cout << "Square area: " << Area; - - return 0; -} \ No newline at end of file diff --git a/sem1/MusikhinIgor/MiniHomeWork1/Task2.cpp b/sem1/MusikhinIgor/MiniHomeWork1/Task2.cpp deleted file mode 100644 index b5943360..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -static float TrapezoidArea(float UpperSide, float LowerSide, float Height) { - return ((UpperSide+LowerSide)*Height)/2; -} - -int main() { - int InputUpperSide; - int InputLowerSide; - int Height; - std::cout << "Enter the length of the upper base of the trapezoid: "; - std::cin >> InputUpperSide; - std::cout << "Enter the length of the lower base of the trapezoid: "; - std::cin >> InputLowerSide; - std::cout << "Enter the height of the trapezoid: "; - std::cin >> Height; - - float Area = TrapezoidArea(InputUpperSide, InputLowerSide, Height); - std::cout << "Trapezoid area: " << Area; - - return 0; -} \ No newline at end of file diff --git a/sem1/MusikhinIgor/MiniHomeWork1/Task3.cpp b/sem1/MusikhinIgor/MiniHomeWork1/Task3.cpp deleted file mode 100644 index ce2df5c8..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int main() { - int N; - std::cout << "Enter the number of elements of the Fibonacci series: "; - std::cin >> N; - int a = 0; - int b = 1; - int buffer; - - for (int i = 0; i < N; ++i) { - if (i == 0) { - std::cout << a << " "; - continue; - } - if (i == 1) { - std::cout << b << " "; - continue; - } - buffer = a + b; - a = b; - b = buffer; - std::cout << buffer << " "; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/MusikhinIgor/MiniHomeWork1/Task4.cpp b/sem1/MusikhinIgor/MiniHomeWork1/Task4.cpp deleted file mode 100644 index 5f27a9d6..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int main() { - int Number = 0; - int ReversedNumber = 0; - std::cout << "Enter number: "; - std::cin >> Number; - - while (Number != 0) { - int Digit = Number % 10; - ReversedNumber = ReversedNumber * 10 + Digit; - Number = Number / 10; - } - - std::cout << "Reversed: " << ReversedNumber << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/MusikhinIgor/MiniHomeWork2/Task1.cpp b/sem1/MusikhinIgor/MiniHomeWork2/Task1.cpp deleted file mode 100644 index fd1d2f27..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork2/Task1.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include - -std::string DecimalToHex(int num) { - std::string hexDigits = "0123456789ABCDEF"; - std::string hexResult = ""; - - if (num == 0) { - return "0"; - } - - while (num > 0) { - int remainder = num % 16; - hexResult = hexDigits[remainder] + hexResult; - num /= 16; - } - - return hexResult; -} - -std::string DecimalToOct(int num) { - std::string octResult = ""; - - if (num == 0) { - return "0"; - } - - while (num > 0) { - int remainder = num % 8; - octResult = std::to_string(remainder) + octResult; - num /= 8; - } - - return octResult; -} - -int main() { - int decimalNumber; - - std::cout << "Enter a decimal number: "; - std::cin >> decimalNumber; - - std::cout << "Hexadecimal number system: " << DecimalToHex(decimalNumber) << std::endl; - std::cout << "Octal number system: " << DecimalToOct(decimalNumber) << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/MusikhinIgor/MiniHomeWork2/Task2.cpp b/sem1/MusikhinIgor/MiniHomeWork2/Task2.cpp deleted file mode 100644 index 67158f40..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork2/Task2.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -int main() { - int number; - - do { - std::cout << "Enter a natural number: "; - std::cin >> number; - - if (number <= 0) { - std::cout << "Wrong" << std::endl; - } - } while (number <= 0); - - while (number != 1) { - std::cout << number << " "; - - if (number % 2 == 0) { - number = number / 2; - } - else { - number = (3 * number + 1) / 2; - } - } - - std::cout << number << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/MusikhinIgor/MiniHomeWork3/MiniHomeWork3.cpp b/sem1/MusikhinIgor/MiniHomeWork3/MiniHomeWork3.cpp deleted file mode 100644 index 978056b5..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork3/MiniHomeWork3.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include -#include -#include -#include - -class ItemBase { -public: - virtual ~ItemBase() {} -}; - -class Item : public ItemBase { -public: - std::string name; - double price; - double weight; - - Item(std::string _name, double _price, double _weight) - : name(_name), price(_price), weight(_weight) {} -}; - -class Shop { -public: - std::string name; - std::vector items; - - Shop(std::string _name) : name(_name) {} - - void addItem(const Item& item) { - items.push_back(item); - } - - // - double averagePrice() const { - double total = 0; - for (const auto& item : items) { - total += item.price; - } - return (items.size() > 0) ? total / items.size() : 0; - } - - // - double averageWeight() const { - double total = 0; - for (const auto& item : items) { - total += item.weight; - } - return (items.size() > 0) ? total / items.size() : 0; - } -}; - -std::vector File(const std::string& filename) { - std::ifstream file(filename); // - std::vector shops; // - std::string line; // - - while (std::getline(file, line)) { - if (line.find("Shop") != std::string::npos) { - std::stringstream ss(line); - std::string shopLabel; - std::string shopName; - ss >> shopLabel >> shopName; - - Shop shop(shopName); - - std::getline(file, line); // - int itemCount = 0; - std::stringstream(line) >> shopLabel >> itemCount; // - - // - for (int i = 0; i < itemCount; ++i) { - std::getline(file, line); - std::stringstream itemStream(line); - std::string itemName; - double itemPrice, itemWeight; - itemStream >> itemName >> itemPrice >> itemWeight; - - Item item(itemName, itemPrice, itemWeight); // - shop.addItem(item); // - } - - shops.push_back(shop); // - } - } - - return shops; // -} - -int main() { - std::string filename = "stores.txt"; - std::vector shops = File(filename); - - for (const auto& shop : shops) { - std::cout << "---------------------------------" << std::endl; - std::cout << "Shop: " << shop.name << std::endl; - std::cout << "Average Price: " << shop.averagePrice() << std::endl; - std::cout << "Average Weight: " << shop.averageWeight() << std::endl; - std::cout << "---------------------------------" << std::endl; - std::cout << std::endl; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/MusikhinIgor/MiniHomeWork3/stores.txt b/sem1/MusikhinIgor/MiniHomeWork3/stores.txt deleted file mode 100644 index 466b6fe9..00000000 --- a/sem1/MusikhinIgor/MiniHomeWork3/stores.txt +++ /dev/null @@ -1,23 +0,0 @@ -Shop Electronics -Items 5 -Laptop 1000 2 -Smartphone 500 0.5 -Tablet 300 0.7 -Headphones 100 0.2 -Smartwatch 200 0.1 - -Shop Grocery -Items 5 -Apples 1 0.1 -Bananas 2 0.15 -Oranges 2 0.2 -Milk 3 1 -Bread 2 0.5 - -Shop Books -Items 5 -Novel 10 0.3 -Biography 15 0.4 -Textbook 20 1.0 -Comics 5 0.2 -Magazine 7 0.25 \ No newline at end of file diff --git a/sem1/NagornevVladimir/MiniHomeWork1/task_1.cpp b/sem1/NagornevVladimir/MiniHomeWork1/task_1.cpp deleted file mode 100644 index 2c6a0e8d..00000000 --- a/sem1/NagornevVladimir/MiniHomeWork1/task_1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int func_area_square(int a, int b) { - std::cout << "Area square = " << a * b; - return a * b; -} - -int main() { - int side_1, side_2; - std::cout << "Enter first side: "; - std::cin >> side_1; - std::cout << "Enter second side: "; - std::cin >> side_2; - func_area_square(side_1, side_2); -} \ No newline at end of file diff --git a/sem1/NagornevVladimir/MiniHomeWork1/task_2.cpp b/sem1/NagornevVladimir/MiniHomeWork1/task_2.cpp deleted file mode 100644 index d19d26e5..00000000 --- a/sem1/NagornevVladimir/MiniHomeWork1/task_2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -float func_area_trapeze(float a, float b, float c) { - std::cout << "Area trapeze = " << (a + b) / 2 * c; - return 1; -} - -int main() { - float side_1, side_2, hight; - std::cout << "Enter first side: "; - std::cin >> side_1; - std::cout << "Enter second side: "; - std::cin >> side_2; - std::cout << "Enter hight: "; - std::cin >> hight; - func_area_trapeze(side_1, side_2, hight); -} diff --git a/sem1/NagornevVladimir/MiniHomeWork1/task_3.cpp b/sem1/NagornevVladimir/MiniHomeWork1/task_3.cpp deleted file mode 100644 index 68d95b1d..00000000 --- a/sem1/NagornevVladimir/MiniHomeWork1/task_3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -using namespace std; - -int fibonachi(int n, int t1, int t2, int next) { - for (int i = 1; i <= n; i++) { - if (i == 1) { - cout << t1 << ", "; - } - if (i == 2) { - cout << t2 << ", "; - } - next = t1 + t2; - t1 = t2; - t2 = next; - - cout << next << ", "; - } - return 1; -} - -int main() { - int n, number_1 = 0, number_2 = 1, next_number = 0; - cout << "Enter N: "; - cin >> n; - cout << "Fibonacci Series: "; - cout << fibonachi(n, number_1, number_2, next_number); -} diff --git a/sem1/NagornevVladimir/MiniHomeWork1/task_4.cpp b/sem1/NagornevVladimir/MiniHomeWork1/task_4.cpp deleted file mode 100644 index 39826eef..00000000 --- a/sem1/NagornevVladimir/MiniHomeWork1/task_4.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -using namespace std; - -int main() -{ - int n; - int rev_n = 0; - cout << "Enter a number: "; - cin >> n; - - while (n) - { - rev_n = rev_n * 10 + (n % 10); - n /= 10; - } - - cout << "inverted number: " << rev_n; -} \ No newline at end of file diff --git a/sem1/NemtsevLev/MiniHomework1/1task.cpp b/sem1/NemtsevLev/MiniHomework1/1task.cpp deleted file mode 100644 index 7744940c..00000000 --- a/sem1/NemtsevLev/MiniHomework1/1task.cpp +++ /dev/null @@ -1,13 +0,0 @@ -//1 задача - -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a; - - std::cout << "Сторона квадрата" << std::endl; - std::cin >> a; - std::cout << a * a; -} diff --git a/sem1/NemtsevLev/MiniHomework1/2task.cpp b/sem1/NemtsevLev/MiniHomework1/2task.cpp deleted file mode 100644 index 73571405..00000000 --- a/sem1/NemtsevLev/MiniHomework1/2task.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//2 задача - -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a, b, h; - - std::cout << "Нижнее основание" << std::endl; - std::cin >> a; - - std::cout << "Верхнее основание" << std::endl; - std::cin >> b; - - std::cout << "Высота" << std::endl; - std::cin >> h; - - std::cout << (a + b) / 2 * h; -} \ No newline at end of file diff --git a/sem1/NemtsevLev/MiniHomework1/3task.cpp b/sem1/NemtsevLev/MiniHomework1/3task.cpp deleted file mode 100644 index f6b1018b..00000000 --- a/sem1/NemtsevLev/MiniHomework1/3task.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//3 задача - -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int a = 0; int b = 1; int c; int x; - - std::cout << "Сколько чисел Фибоначчи вывести" << std::endl; - std::cin >> x; - - std::cout << 1 << " "; - - for (int i = 0; i < x - 1; i++) - { - c = a + b; - a = b; - b = c; - std::cout << c << " "; - } -} \ No newline at end of file diff --git a/sem1/NemtsevLev/MiniHomework1/4task.cpp b/sem1/NemtsevLev/MiniHomework1/4task.cpp deleted file mode 100644 index 2184c233..00000000 --- a/sem1/NemtsevLev/MiniHomework1/4task.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//4 задача - -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a, b = 0; - std::cout << "Введите число" << std::endl; - std::cin >> a; - - while (a > 0) - { - b *= 10; - b += a % 10; - a /= 10; - } - - std::cout << b; -} diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task1.cpp b/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task1.cpp deleted file mode 100644 index a1ab9bb1..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -double SquareArea(double squareSide); - -int main() -{ - setlocale(LC_ALL, "RU"); - double squareSide; - std::cout << " : "; - std::cin >> squareSide; - double squareArea = SquareArea(squareSide); - std::cout << " : " << squareArea; - return 0; -} - -double SquareArea(double squareSide) -{ - return squareSide * squareSide; -} \ No newline at end of file diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task2.cpp b/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task2.cpp deleted file mode 100644 index 7d821840..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -#include - -double TrapezoidArea(double upSide, double downSide, double height); - -int main() -{ - setlocale(LC_ALL, "RU"); - double upSide, downSide, height; - std::cout << "Введите размер верхнего основания трапеции: "; - std::cin >> upSide; - std::cout << "Введите размер нижнего основания трапеции: "; - std::cin >> downSide; - std::cout << "Введите размер высоты трапеции: "; - std::cin >> height; - double trapezoidArea = TrapezoidArea(upSide,downSide,height); - std::cout << "Площадь трапеции равна: " << trapezoidArea; - return 0; -} - -double TrapezoidArea(double upSide, double downSide, double height) -{ - return (upSide + downSide)/2 * height; -} - - diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task3.cpp b/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task3.cpp deleted file mode 100644 index fc3d872c..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -void PrintFibNum(int num); - -int main() -{ - setlocale(LC_ALL, "RU"); - int userInput; - std::cout << "Сколько чисел Фибоначчи вывести?: "; - std::cin >> userInput; - PrintFibNum(userInput); - return 0; -} - -void PrintFibNum(int num) -{ - long long int fib1 = 0; - long long int fib2 = 1; - long long int temp = 0; - for (int i = 0; i < num; ++i) - { - std::cout << fib1 << " "; - temp = fib1; - fib1 = fib2; - fib2 = temp + fib1; - } -} - diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task4.cpp b/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task4.cpp deleted file mode 100644 index 192f012a..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include - -int main () -{ - setlocale(LC_ALL, "RU"); - long long int userInput; - long long int transformedNumber = 0; - int num = 0; - std::cout << "Введите число, которое хотите преобразовать: "; - std::cin >> userInput; - while(userInput > 0) - { - num = userInput % 10; - userInput = (userInput - num)/10; - transformedNumber = transformedNumber * 10 + num; - } - std::cout << "Преобразованное число: " << transformedNumber; -} - -/* Вывод числа с нулями в начале: - -int main() -{ - setlocale(LC_ALL, "RU"); - long long int userInput; - long long int transformedNumber = 0; - int num = 0; - std::cout << "Введите число, которое хотите преобразовать: "; - std::cin >> userInput; - std::cout << "Преобразованное число: "; - while (userInput > 0) - { - num = userInput % 10; - userInput = (userInput - num) / 10; - std::cout << num; - } -} - -*/ diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork2/MHW2Task1.cpp b/sem1/NikitaMeshcheryakov/MiniHomeWork2/MHW2Task1.cpp deleted file mode 100644 index f92ab874..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork2/MHW2Task1.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include - -void Int10ToInt8(long long number); -void Int10ToInt16(long long number); - -int main() -{ - setlocale(LC_ALL, "RU"); - - std::cout << "Введите число: "; - long long number1; - std::cin >> number1; - - std::cout << "Число в 8 - ричной системе записывается как: "; - Int10ToInt8(number1); - - std::cout << "Введите число: "; - long long number2; - std::cin >> number2; - - std::cout << "Число в 16 - ричной системе записывается как: "; - Int10ToInt16(number2); -} - -void Int10ToInt8(long long num) -{ - std::stack numStack; - int temp = 0; - - do - { - temp = num % 8; - num = (num - temp) / 8; - numStack.push(temp); - - } while (num != 0); - - while (!numStack.empty()) - { - std::cout << numStack.top(); - numStack.pop(); - } - - std::cout << std::endl; -} - -void Int10ToInt16(long long number) -{ - std::stack numStack; - int temp = 0; - char nums[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - - do - { - temp = number % 16; - number = (number - temp) / 16; - numStack.push(temp); - - } while (number != 0); - - while (!numStack.empty()) - { - std::cout << nums[numStack.top()]; - numStack.pop(); - } - - std::cout << std::endl; -} - - diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork2/MHW2Task2.cpp b/sem1/NikitaMeshcheryakov/MiniHomeWork2/MHW2Task2.cpp deleted file mode 100644 index 5aa59110..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork2/MHW2Task2.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include - -void SirakuzHyp(long long number); - -int main() -{ - setlocale(LC_ALL, "RU"); - - std::cout << "Введите число: "; - long long number; - std::cin >> number; - - SirakuzHyp(number); -} - -void SirakuzHyp(long long number) -{ - long long n = number; - int i = 0; - do - { - if (number % 2 == 0) - { - number /= 2; - std::cout << number << std::endl; - ++i; - } - else - { - number *= 3; - ++number; - std::cout << number << std::endl; - ++i; - } - - } while (number != 1); - - std::cout << "Для числа " << n << " потребовалось операций: " << i; -} - - diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork3/MHW3.cpp b/sem1/NikitaMeshcheryakov/MiniHomeWork3/MHW3.cpp deleted file mode 100644 index 9961b94f..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork3/MHW3.cpp +++ /dev/null @@ -1,291 +0,0 @@ -#include -#include -#include -#include - -const std::string Path = "Shops.txt"; -void SepString(std::string line, char sep, std::vector& words); - -class Item -{ -private: - std::string Name; - double Price; - double Weight; - -public: - Item(std::string name, double price, double weight) - { - Name = name; - Price = price; - Weight = weight; - } - - double GetWeight() - { - return Weight; - } - - double GetPrice() - { - return Price; - } -}; - -class Shop -{ -protected: - std::string Name; - std::vector Goods; - -public: - - Shop() {} - - Shop(std::string name) - { - Name = name; - } - - virtual void WriteFromFileToShop() - { - std::vector stringShopInfo; - std::string line; - int pos = 0; - bool flag = false; - - std::ifstream in; - in.open(Path); - - if (in.is_open()) - { - while (std::getline(in, line)) - { - if (flag) - { - pos = line.find("Shop"); - - if (pos == 0) - { - break; - } - - stringShopInfo.push_back(line); - } - - if (line == "Shop " + Name) - { - flag = true; - } - } - } - in.close(); - - for (int i = 1; i < stringShopInfo.size(); ++i) - { - if (stringShopInfo[i] == "") - { - continue; - } - - std::vector words; - SepString(stringShopInfo[i], ' ', words); - Item item(words[0], std::stod(words[1]), std::stod(words[2])); - Goods.push_back(item); - } - } - - double CalculateAvgPrice() - { - int SumPrice = 0; - - for (int i = 0; i < Goods.size(); ++i) - { - SumPrice += Goods[i].GetPrice(); - } - - return SumPrice / Goods.size(); - } - - double CalculateAvgWeight() - { - int SumWeight = 0; - - for (int i = 0; i < Goods.size(); ++i) - { - SumWeight += Goods[i].GetWeight(); - } - - return SumWeight / Goods.size(); - } - - virtual void ShowInfo() - { - std::cout << "Магазин " << Name << std::endl; - std::cout << "Средняя цена по магазину: " << CalculateAvgPrice() <<" рублей." << std::endl; - std::cout << "Средний вес по магазину: " << CalculateAvgWeight() << " грамм." << std::endl; - } -}; - -class ElectronicShop : public Shop -{ -public: - ElectronicShop(std::string name) : Shop(name) {} - - ElectronicShop() : Shop() {} - - //void WriteFromFileToShop() override - // { - // Переопределение парсинга; - // } - - //void ShowInfo() override - // { - // Переопределение сводки по магазину; - // } - -}; - -class VegetablesShop : public Shop -{ -public: - VegetablesShop(std::string name) : Shop(name) {} - - VegetablesShop() : Shop() {} - - //void WriteFromFileToShop() override - // { - // Переопределение парсинга; - // } - - //void ShowInfo() override - // { - // Переопределение сводки по магазину; - // } -}; - -class HouseholdStore : public Shop -{ -public: - HouseholdStore(std::string name) : Shop(name) {} - - HouseholdStore() : Shop() {} - - //void WriteFromFileToShop() override - // { - // Переопределение парсинга; - // } - - //void ShowInfo() override - // { - // Переопределение сводки по магазину; - // } -}; - -class ShopBase -{ -private: - std::vector Shops; - std::string BasePath; - -public: - ShopBase(std::string basePath) - { - BasePath = basePath; - } - - void DefineTypesOfShops() - { - std::string line; - int pos = 0; - - std::ifstream in; - in.open(Path); - - if (in.is_open()) - { - while (std::getline(in, line)) - { - pos = line.find("Shop"); - - if (pos == 0) - { - std::string shopName = line.substr(5); - if (shopName == "MVideo") - { - ElectronicShop shop(shopName); - Shops.push_back(shop); - } - else if (shopName == "FruitsAndVegetables") - { - VegetablesShop shop(shopName); - Shops.push_back(shop); - } - else if(shopName == "Polaris") - { - HouseholdStore shop(shopName); - Shops.push_back(shop); - } - else - { - Shop shop(shopName); - Shops.push_back(shop); - } - } - } - } - in.close(); - } - - void DefineShopsStats() - { - for(int i = 0; i < Shops.size(); ++i) - { - Shops[i].WriteFromFileToShop(); - } - } - - void ShowAllInfo() - { - for (int i = 0; i < Shops.size(); ++i) - { - Shops[i].ShowInfo(); - std::cout << std::endl; - } - } -}; - -int main() -{ - setlocale(LC_ALL, "RU"); - ShopBase shops("Path"); - - shops.DefineTypesOfShops(); - - shops.DefineShopsStats(); - - shops.ShowAllInfo(); -} - -void SepString(std::string line, char sep, std::vector& words) -{ - int i = 0; - std::string tmp = ""; - - while (i <= line.size()) - { - while (line[i] != sep && i != line.size()) - { - tmp += line[i]; - ++i; - } - - words.push_back(tmp); - ++i; - tmp = ""; - } -} - - - - diff --git a/sem1/NikitaMeshcheryakov/MiniHomeWork3/Shops.txt b/sem1/NikitaMeshcheryakov/MiniHomeWork3/Shops.txt deleted file mode 100644 index dc254b12..00000000 --- a/sem1/NikitaMeshcheryakov/MiniHomeWork3/Shops.txt +++ /dev/null @@ -1,26 +0,0 @@ -Shop MVideo -Items 5 -Iphone 30000 700 -Xiaomi 20000 600 -Redmi 15000 650 -LGMobile 12000 800 -ChinaFon 123456 2000 -Shop FruitsAndVegetables -Items 5 -Apple 20 50 -Orange 50 100 -Cucumber 30 70 -Pineapple 70 100 -Watermellon 100 1000 -Shop Polaris -Items 5 -VacuumCleaner 20000 2000 -Grill 5000 500 -CoffeeMachine 10000 2000 -WashingMachine 30000 7000 -Humidifier 7000 1000 - - - - - diff --git a/sem1/NikitaPoloskov/minihomework1/task1.cpp b/sem1/NikitaPoloskov/minihomework1/task1.cpp deleted file mode 100644 index 4860d972..00000000 --- a/sem1/NikitaPoloskov/minihomework1/task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -double square_area(double x) -{ - return x * x; -} - -int main() -{ - double sq_side = 9.5; - std::cout << square_area(sq_side) << std::endl; - - return 0; -} diff --git a/sem1/NikitaPoloskov/minihomework1/task2.cpp b/sem1/NikitaPoloskov/minihomework1/task2.cpp deleted file mode 100644 index fcef3c1f..00000000 --- a/sem1/NikitaPoloskov/minihomework1/task2.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -double trapezoid_area(double base_a, double base_b, double height) -{ - return (base_a + base_b) / 2 * height; -} - -int main() -{ - double first_base = 5.3, second_base = 12.4, height = 4.1; - - std::cout << trapezoid_area(first_base, second_base, height) << std::endl; - - return 0; -} diff --git a/sem1/NikitaPoloskov/minihomework1/task3.cpp b/sem1/NikitaPoloskov/minihomework1/task3.cpp deleted file mode 100644 index 31da198c..00000000 --- a/sem1/NikitaPoloskov/minihomework1/task3.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int main() -{ - int n; - std::cin >> n; - - int second_last = 1, first_last = 1; - for (int i = 0; i < n; i++) - { - if (i <= 1) - { - std::cout << 1 << " "; - continue; - } - int next = first_last + second_last; - second_last = first_last; - first_last = next; - - std::cout << next << " "; - } - - return 0; -} diff --git a/sem1/NikitaPoloskov/minihomework1/task4.cpp b/sem1/NikitaPoloskov/minihomework1/task4.cpp deleted file mode 100644 index fa33c465..00000000 --- a/sem1/NikitaPoloskov/minihomework1/task4.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int main() -{ - int number; - std::cin >> number; - - if (number < 0) - { - std::cout << "-"; - number *= -1; - } - - do - { - std::cout << number%10; - number /= 10; - } while (number); -} \ No newline at end of file diff --git a/sem1/NikitaPoloskov/minihomework2/task1.cpp b/sem1/NikitaPoloskov/minihomework2/task1.cpp deleted file mode 100644 index d94b9fdd..00000000 --- a/sem1/NikitaPoloskov/minihomework2/task1.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include - -int digits[36]; - -void to_sys(int number, int base) -{ - if (base < 2 || base > 36) - { - std::cout << "Bad base value!" << std::endl; - return; - } - - std::cout << number << " in " << base << " base is "; - - std::vector result; - while (number != 0) - { - result.push_back(digits[number % base]); - number /= base; - } - for (int i = result.size()-1; i >= 0; i--) - std::cout << result[i]; - std::cout << std::endl; -} - -void help() -{ - std::cout << "Hello, user! This program can convert numbers from dec system to another (from 2 to 36).\n" - << "You can run this commands:\n" - << "h - show this message\n" << "c - start converter\n" << "e - close program\n"; -} - -int main() -{ - help(); - - for (int i = 0; i < 10; i++) digits[i] = '0' + i; - for (int i = 10; i < 36; i++) digits[i] = 'A' - 10 + i; - - char command; - int num, base; - while (true) - { - std::cout << "Type command: "; - std::cin >> command; - - switch (command) - { - case 'h': - help(); - break; - case 'c': - std::cout << "Enter number (in dec sys): "; - std::cin >> num; - std::cout << "Enter base: "; - std::cin >> base; - to_sys(num, base); - break; - case 'e': - return 0; - default: - std::cout << "Unknown command!" << std::endl; - } - } -} diff --git a/sem1/NikitaPoloskov/minihomework2/task2.cpp b/sem1/NikitaPoloskov/minihomework2/task2.cpp deleted file mode 100644 index a8c9fa9e..00000000 --- a/sem1/NikitaPoloskov/minihomework2/task2.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -int main() -{ - std::cout << "Let's check the Syracuse hypothesis!" << std::endl; - - int num; - while (true) - { - std::cout << "Enter any integer (type 1 for exit): "; - std::cin >> num; - - if (num == 1) - return 0; - - while (num != 1) - { - if (num % 2 == 0) - num /= 2; - else - num = (num * 3 + 1) / 2; - } - - std::cout << "Wow! It's work!" << std::endl; - } -} \ No newline at end of file diff --git a/sem1/NovikovAM/MiniHomeWork1/Task1.cpp b/sem1/NovikovAM/MiniHomeWork1/Task1.cpp deleted file mode 100644 index c686e6cb..00000000 --- a/sem1/NovikovAM/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -#include - -int quadro(int a); - -int main() -{ - int a; - std::cout << "Input side: \n"; - std::cin >> a; - std::cout << "S = " << quadro(a); - return 0; -} - -int quadro(int a) { - return a * a; -} \ No newline at end of file diff --git a/sem1/NovikovAM/MiniHomeWork1/Task2.cpp b/sem1/NovikovAM/MiniHomeWork1/Task2.cpp deleted file mode 100644 index 0a9d3ae5..00000000 --- a/sem1/NovikovAM/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int trapeze(int a, int b, int h); - -int main() { - int a, b, h; - std::cout << "Input up side: \n"; - std::cin >> a; - std::cout << "Input down side: \n"; - std::cin >> b; - std::cout << "Input height: \n"; - std::cin >> h; - std::cout << trapeze(a, b, h); - return 0; -} - -int trapeze(int a, int b, int h) { - return ((a + b) / 2) * h; -} \ No newline at end of file diff --git a/sem1/NovikovAM/MiniHomeWork1/Task3.cpp b/sem1/NovikovAM/MiniHomeWork1/Task3.cpp deleted file mode 100644 index 15508bf8..00000000 --- a/sem1/NovikovAM/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int main() { - int a = 0, b = 1, l = 0, c = 0; - std::cout << "Input number cicle: "; - std::cin >> l; - std::cout << 1 << " "; - for (int i = l; i > 0; --i) { - c = a + b; - a = b; - b = c; - - std::cout << c << " "; - } - -} \ No newline at end of file diff --git a/sem1/NovikovAM/MiniHomeWork1/Task4.cpp b/sem1/NovikovAM/MiniHomeWork1/Task4.cpp deleted file mode 100644 index b67a734c..00000000 --- a/sem1/NovikovAM/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main() { - int g; - std::cout << "Input your number: "; - std::cin >> g; - - - - while (g != 0) { - std::cout << g%10; - g /= 10; - } -} \ No newline at end of file diff --git a/sem1/OlegShulyak/MiniHomework2/1.cpp b/sem1/OlegShulyak/MiniHomework2/1.cpp deleted file mode 100644 index 5baf191d..00000000 --- a/sem1/OlegShulyak/MiniHomework2/1.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -long long eighth(int n){ - if(n > 7){ - return (eighth((n-(n%8))/8)*10) + n%8; - }else{ - return n; - } -} -int main() -{ - setlocale(LC_ALL, "RUS"); - std::cout<<"Введите ваше имя, пользователь" << std::endl; - std::string name; - std::cin >> name; - std::cout<<"Приятного пользования," << name << std::endl; - std::cout<< name << ",Выберите программу которой вы бы хотели воспользоваться" << std::endl; - std::cout<<"1 - перевод числа из десятичной в восьмиричную систему" << std::endl; - std::cout<<"2 - перевод числа из десятичной в шестнадцатеричную систему" << std::endl; - int l = 0; - std::cin >> l; - while(l != 1 && l != 2){ - std::cout<< name << ",Формат введенных данных не отвечает возможностям системы. Попробуйте еще раз!" << std::endl; - std::cin >> l; - } - std::cout<<"Благодарим," << name << ".Теперь введите число от -2147483648 до 2147483647" << std::endl; - std::string number = ""; - std::cin >> number; - bool meaning = false; - int k = 0; - while(meaning == false){ - for(int i = 0; i < number.length(); i++){ - if(isdigit(number[i])){ - k++; - }else if(i == 0 && number[i] == '-'){ - k++; - } - } - if(number.length() == k && number.length() < 13){ - if(stoll(number) <= 2147483647 && stoll(number) >= -2147483648){ - meaning = true; - } - } - if(meaning == false){ - std::cout<< name << ",Формат введенных данных не отвечает возможностям системы. Попробуйте еще раз!" << std::endl; - std::cin >> number; - k = 0; - } - } - int n = stoi(number); - if(l == 1){ - if(n >= 0){ - std::cout << eighth(n); - }else{ - std::cout<< name << ",К сожалению операции над отрицательными числами в разработке. Можем уверить что эта функция скоро станет доступна!" << std::endl; - } - }else if(n >= 0){ - std::string ans = ""; - while(n != 0){ - std::string stri = std::__cxx11::to_string(n%16); - ans = stri + " " + ans; - n = (n - (n%16)) / 16; - } - std::cout << ans; - }else{ - std::cout<< name << ",К сожалению операции над отрицательными числами в разработке. Можем уверить что эта функция скоро станет доступна!" << std::endl; - } - return 0; -} \ No newline at end of file diff --git a/sem1/OlegShulyak/MiniHomework2/2.cpp b/sem1/OlegShulyak/MiniHomework2/2.cpp deleted file mode 100644 index f79ed107..00000000 --- a/sem1/OlegShulyak/MiniHomework2/2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int main() -{ - long long n = 1; - bool t = true; - while(n < 10000000){ - long long i = n; - while(i != 1){ - if(i%2 == 0){ - i = i / 2; - }else{ - i = i * 3; - i++; - i = i / 2; - } - } - n++; - } - std::cout << "Function finished => Sirakuz hyphotesys works for all numbers up to 10000000"; - return 0; -} \ No newline at end of file diff --git a/sem1/Panikarsky Ivan/minihomework1/Task1.cpp b/sem1/Panikarsky Ivan/minihomework1/Task1.cpp deleted file mode 100644 index b3e0111a..00000000 --- a/sem1/Panikarsky Ivan/minihomework1/Task1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -using namespace std; - -int main() -{ - setlocale(LC_ALL, "Rus"); - int SizeSquar, SquareArea; - cout << "Введите длину стороны квадрата:"; - cin >> SizeSquar; - SquareArea = SizeSquar * SizeSquar; - cout << "Площадь Вашего квадрата:" << SquareArea; -} \ No newline at end of file diff --git a/sem1/Panikarsky Ivan/minihomework1/Task2.cpp b/sem1/Panikarsky Ivan/minihomework1/Task2.cpp deleted file mode 100644 index d44ef9a0..00000000 --- a/sem1/Panikarsky Ivan/minihomework1/Task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -using namespace std; - -int main() -{ - setlocale(LC_ALL, "Rus"); - float UpperSideTrapezoid, LowerSideTrapezoid, TrapezoidHeight, HalfSumBases, TrapezoidArea; - cout << "Введите длину верхнего основания Вашей трапеции:"; - cin >> UpperSideTrapezoid; - cout << "Введите длину нижнего основания Вашей трапеции:"; - cin >> LowerSideTrapezoid; - cout << "Введите высоту Вашей трапеции:"; - cin >> TrapezoidHeight; - HalfSumBases = (UpperSideTrapezoid + LowerSideTrapezoid) / 2; - TrapezoidArea = HalfSumBases * TrapezoidHeight; - cout << "Площадь Вашей трапеции:" << TrapezoidArea; -} \ No newline at end of file diff --git a/sem1/Panikarsky Ivan/minihomework1/Task3.cpp b/sem1/Panikarsky Ivan/minihomework1/Task3.cpp deleted file mode 100644 index 067fe368..00000000 --- a/sem1/Panikarsky Ivan/minihomework1/Task3.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -using namespace std; - -int main() -{ - setlocale(LC_ALL, "rus"); - int N, Nmax, Cnt, digitsFIB, digitsFIB_bag, digitsFIB_result; - bool Check; - digitsFIB = 0; - digitsFIB_bag = 0; - digitsFIB_result = 0; - cout << "\t\t\t\tВведите количество чисел Фибоначчи, которые Вы хотите узнать:"; - cin >> Nmax; - cout << "\n\n"; - N = Nmax; - Cnt = 0; - Check = ((N == Nmax) == 1); - - switch (Check) - { - case 1: - cout << Cnt++ << " Число Фибоначчи: " << digitsFIB << "\n\n"; - N--; - digitsFIB++; - - case 0: - for (int i = 1; N != 0; N--) - { - digitsFIB_result = digitsFIB + digitsFIB_bag; - cout << Cnt++ << " Число Фибоначчи: " << digitsFIB_result << "\n\n"; - digitsFIB = digitsFIB_bag; - digitsFIB_bag = digitsFIB_result; - } - break; - } -} \ No newline at end of file diff --git a/sem1/Panikarsky Ivan/minihomework1/Task4.cpp b/sem1/Panikarsky Ivan/minihomework1/Task4.cpp deleted file mode 100644 index b74e7e0f..00000000 --- a/sem1/Panikarsky Ivan/minihomework1/Task4.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -using namespace std; - -int main() -{ - setlocale(LC_ALL, "ru"); - int number, digit, number_bag, cnt, number_bag1; - cout << "Введите Ваше число:"; - cin >> number; - cout << "\n"; - cnt = 0; - number_bag = number; - for (; number > 0; ) - { - number /= 10; - cnt++; - } - cout << "Ваше число в обратном порядке:"; - for (; cnt > 0; cnt--) - { - switch (number_bag % 10) - { - case 0: - cout << "0"; - number_bag /= 10; - break; - case 1: - cout << "1"; - number_bag /= 10; - break; - case 2: - cout << "2"; - number_bag /= 10; - break; - case 3: - cout << "3"; - number_bag /= 10; - break; - case 4: - cout << "4"; - number_bag /= 10; - break; - case 5: - cout << "5"; - number_bag /= 10; - break; - case 6: - cout << "6"; - number_bag /= 10; - break; - case 7: - cout << "7"; - number_bag /= 10; - break; - case 8: - cout << "8"; - number_bag /= 10; - break; - case 9: - cout << "9"; - number_bag /= 10; - break; - } - } - cout << "\n"; -} \ No newline at end of file diff --git a/sem1/PavelFedotow/MiniHomeWork1/task1.cpp b/sem1/PavelFedotow/MiniHomeWork1/task1.cpp deleted file mode 100644 index 90abd397..00000000 --- a/sem1/PavelFedotow/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int side; - std::cout << "Введ: " ; - std::cin >> side; - std::cout << "Площадь квадрата: " << pow(side, 2) << std::endl; - -} \ No newline at end of file diff --git a/sem1/PavelFedotow/MiniHomeWork1/task2.cpp b/sem1/PavelFedotow/MiniHomeWork1/task2.cpp deleted file mode 100644 index 291f6f07..00000000 --- a/sem1/PavelFedotow/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - - float UpperBase; - float LowerBase; - float Height; - - std::cout << "Укажите длину верхнего основания трапеции: "; - std::cin >> UpperBase; - - std::cout << "Укажите длину нижнего основания трапеции: "; - std::cin >> LowerBase; - - std::cout << "Укажите длину высоты трапеции: "; - std::cin >> Height; - - std::cout << "Площадь вашей трапеции: " << (UpperBase + LowerBase) / 2 * Height; \ No newline at end of file diff --git a/sem1/PavelFedotow/MiniHomeWork1/task3.cpp b/sem1/PavelFedotow/MiniHomeWork1/task3.cpp deleted file mode 100644 index 10ce96e0..00000000 --- a/sem1/PavelFedotow/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int numberOfElements; - int firstNumber = 0; - int secondNumber = 1; - int currentNumber; - while (true) - { - - std::cout << "Введите желаемое число элементов ряда Фибоначчи: "; - std::cin >> numberOfElements; - - if (numberOfElements <= 0) - std::cout << "Неверное число элементов :(" << std::endl; - else - { - std::cout << "Ваш ряд: " << 1 << " "; - for (int x = 0; x < numberOfElements - 1; ++x) - { - currentNumber = firstNumber + secondNumber; - firstNumber = secondNumber; - secondNumber = currentNumber; - std::cout << currentNumber << " "; - } - break; - } - } -} \ No newline at end of file diff --git a/sem1/PavelFedotow/MiniHomeWork1/task4.cpp b/sem1/PavelFedotow/MiniHomeWork1/task4.cpp deleted file mode 100644 index b7a1ad5f..00000000 --- a/sem1/PavelFedotow/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int chosenNumber; - int reversedNumber = 0; - - std::cout << "Введите ваше число: "; - std::cin >> chosenNumber; - - while (chosenNumber) - { - reversedNumber = reversedNumber * 10 + chosenNumber % 10; - chosenNumber /= 10; - } - - std::cout << "Развернутое число: " << reversedNumber; -} \ No newline at end of file diff --git a/sem1/PavelFedotow/MiniHomeWork2/task1.cpp b/sem1/PavelFedotow/MiniHomeWork2/task1.cpp deleted file mode 100644 index 99ae26d6..00000000 --- a/sem1/PavelFedotow/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include - -void clear_screen() { -#if defined _WIN32 - system("cls"); -#elif defined (__LINUX__) || defined(__gnu_linux__) || defined(__linux__) - system("clear"); -#elif defined (__APPLE__) - system("clear"); -#endif -} - -char* to_base_n(int chosenNumber, int base) { - - int tempNumber = chosenNumber; - int length = 0; - while (tempNumber > 0) { - tempNumber /= base; - length++; - } - - char* finalNumber = new char[length + 1]; - finalNumber[length] = '\0'; - - tempNumber = chosenNumber; - for (int i = length - 1; i >= 0; i--) { - const int digit = tempNumber % base; - tempNumber /= base; - if (digit < 10) - finalNumber[i] = '0' + digit; - else - finalNumber[i] = 'A' + digit - 10; - } - - return finalNumber; -} - - -void menu() { - setlocale(LC_ALL, "Russian"); - - bool isWorking = true; - while (isWorking) { - int chosenOption; - clear_screen(); - std::cout << "Добро пожаловать в мега преобразователь 2015\nВ какую систему счисления вы хотите перевести число?\ - \n1 - шестнадцатиричная система\n2 - восьмиричная система\n3 - ни в какую! Дайте выйти из программы!\n\nВаш вариант: "; - std::cin >> chosenOption; - clear_screen(); - - if (std::cin.fail()) { - std::cout << "Я вижу ты еще новичок, я попросил у тебя ввести цифу, а ты ввел букву. Цифры находятся сверху от букв, больше не ошибайся" << std::endl; - std::cin.clear(); - std::cin.ignore(2, '\n'); - std::cin.get(); - chosenOption = -1; - continue; - } - - - int x; - switch (chosenOption) { - case 1: - std::cout << "Введите число, которое надо преобразовать: "; - std::cin >> x; - std::cout << "Ваше число в шестнадцатиричной системе: " << to_base_n(x, 16) << std::endl; - std::cin.ignore(1, '\n'); std::cin.get(); - break; - case 2: - std::cout << "Введите число, которое надо преобразовать: "; - std::cin >> x; - std::cout << "Ваше число в восьмиричной системе: " << to_base_n(x, 8) << std::endl; - std::cin.ignore(1, '\n'); std::cin.get(); - break; - case 3: - std::cout << "Ну ладно, пока"; - std::cin.ignore(1, '\n'); std::cin.get(); - isWorking = false; - break; - default: - std::cout << "Введена неверная комманда, попробуйте еще раз" << std::endl; - std::cin.ignore(1, '\n'); std::cin.get(); - - break; - } - } - - return; -} - -int main() -{ - - - menu(); -} \ No newline at end of file diff --git a/sem1/PavelFedotow/MiniHomeWork2/task2.cpp b/sem1/PavelFedotow/MiniHomeWork2/task2.cpp deleted file mode 100644 index 08bddb19..00000000 --- a/sem1/PavelFedotow/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include - -bool hypotesisChecker(int value) { - int number = value; - while (number > 1) { - if (number % 2 == 0) { - std::cout << number << " - чётное число. Делим на 2" << std::endl; - number = number / 2; - } - else { - std::cout << number << " - нечётное число. Умножаем на 3, прибавляем единицу и делим на 2" << std::endl; - number = (number * 3 + 1) / 2; - } - } - - std::cout << "Конечное число: " << number << std::endl; - - if (number == 1) { - std::cout << "Гипотеза Сиракуза работает для числа " << value; - } - else { - std::cout << "Гипотеза Сиракуза не работает для числа " << value; - } - - return number == 1; -} - -void clear_screen() { -#if defined _WIN32 - system("cls"); -#elif defined (__LINUX__) || defined(__gnu_linux__) || defined(__linux__) - system("clear"); -#elif defined (__APPLE__) - system("clear"); -#endif -} - -int main() { - setlocale(LC_ALL, "Russian"); - - bool isWorking = true; - - - while (isWorking) { - std::cout << "Программа проверки гипотезы Сиракуза" << std::endl; - std::cout << "Введите любое натуральное число, которое хотите проверить на соответствие гипотезе: "; - - int chosenNumber; - std::cin >> chosenNumber; - - if (std::cin.fail()) { - std::cout << "Ошибка, введено неверное значение для натурального числа" << std::endl; - std::cout << "Нажмите enter, чтобы продолжить"; - std::cin.clear(); - std::cin.ignore(2, '\n'); - std::cin.get(); - clear_screen(); - continue; - } - - if (chosenNumber < 1) { - std::cout << "Ошибка, число не натуральное. Попробуйте снова." << std::endl; - std::cin.ignore(100, '\n'); - std::cout << "Нажмите enter, чтобы продолжить"; - std::cin.get(); - clear_screen(); - } - else { - hypotesisChecker(chosenNumber); - isWorking = false; - std::cin.get(); - } - } - -} \ No newline at end of file diff --git a/sem1/PavelFedotow/MiniHomeWork3/list.txt b/sem1/PavelFedotow/MiniHomeWork3/list.txt deleted file mode 100644 index c0584cf7..00000000 --- a/sem1/PavelFedotow/MiniHomeWork3/list.txt +++ /dev/null @@ -1,21 +0,0 @@ -Shop ForPCs -Items 5 -RTX4060ti 40000.0 1.5 240 FPS -GTX1030 5000.0 1.2 40 FPS -RTX2060super 17000.0 1.3 144 FPS -GTX1050ti 8000.0 1.2 80 FPS -GT710 1500.0 1.0 10 FPS -Shop Fruits -Items 5 -apple 10.0 0.5 "Vitamin C" -banana 5.0 0.2 "Potassium" -qiwi 12.0 0.1 "Vitamin C" -lemon 7.0 0.1 "Vitamin C" -peach 11.0 0.7 "Vitamin A" -Shop Clothes -Items 5 -tshirt 25.0 0.3 size M -longsleeve 100.0 0.5 size XL -cap 15.0 0.1 size ALL -Crocs 150.0 0.6 size L -shirt 30.0 0.4 size XXL diff --git a/sem1/PavelFedotow/MiniHomeWork3/task.cpp b/sem1/PavelFedotow/MiniHomeWork3/task.cpp deleted file mode 100644 index 35f63240..00000000 --- a/sem1/PavelFedotow/MiniHomeWork3/task.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -class ItemBase { -public: - virtual ~ItemBase() = default; - virtual double getPrice() const = 0; - virtual double getWeight() const = 0; - virtual std::string getInfo() const = 0; - virtual std::string getName() const = 0; -}; - -class Item : public ItemBase { -protected: - std::string name; - double price; - double weight; - std::string info; - -public: - Item(const std::string& name, double price, double weight, std::string info) - : name(name), price(price), weight(weight), info(info) {} - - double getPrice() const override { return price; } - double getWeight() const override { return weight; } - std::string getName() const { return name; } - std::string getInfo() const override { return info; } -}; - -class ForPCs : public Item { -public: - ForPCs(const std::string& name, double price, double weight, std::string fps) - : Item(name, price, weight, fps) {} -}; - -class Fruits : public Item { -public: - Fruits(const std::string& name, double price, double weight, std::string vitamins) - : Item(name, price, weight, vitamins) {} -}; - -class Clothes : public Item { -public: - Clothes(const std::string& name, double price, double weight, std::string size) - : Item(name, price, weight, size) {} -}; - -class Shop { - std::string name; - std::vector> items; - -public: - Shop(const std::string& name) : name(name) {} - - void addItem(std::shared_ptr item) { - items.push_back(item); - } - - double avgPrice() const { - if (items.empty()) - return 0.0; - double total = 0.0; - for (auto& item : items) { - total += item->getPrice(); - } - return total / items.size(); - } - - double avgWeight() const { - if (items.empty()) - return 0.0; - double total = 0.0; - for (auto& item : items) { - total += item->getWeight(); - } - return total / items.size(); - } - - void printItemsInfo() const { - std::cout << "Shop: " << name << ":\n"; - for (auto& item : items) { - std::cout << "Item: " << item->getName() - << ", Price: " << item->getPrice() - << ", Weight: " << item->getWeight() - << ", Info: " << item->getInfo() << std::endl; - } - } -}; - -std::vector getFromFile(const std::string& path) { - std::ifstream file(path); - std::vector shops; - std::string line, word; - Shop* currentShop = nullptr; - - while (std::getline(file, line)) { - std::istringstream iss(line); - iss >> word; - - if (line.rfind("Shop", 0) == 0) { // Проверка на начало строки "Shop" - std::string shopName = line.substr(5); // Извлекаем имя магазина после "Shop" - Shop shop(shopName); - - // Читаем строку с количеством товаров - std::getline(file, line); - int itemCount; - iss.clear(); - iss.str(line); - iss >> word >> itemCount; - - // Чтение каждого товара в магазине - for (int i = 0; i < itemCount; i++) { - std::getline(file, line); - std::istringstream itemStream(line); - std::string name, info; - double price, weight; - - itemStream >> name >> price >> weight; - std::getline(itemStream, info); // Ожидаем, что остальная строка — это информация о товаре - - if (shopName == "ForPCs") { - shop.addItem(std::make_shared(name, price, weight, info)); - } - else if (shopName == "Fruits") { - shop.addItem(std::make_shared(name, price, weight, info)); - } - else if (shopName == "Clothes") { - shop.addItem(std::make_shared(name, price, weight, info)); - } - } - - shops.push_back(shop); - } - } - return shops; -} - -int main() { - std::vector shops = getFromFile("list.txt"); - - // Печать информации о каждом магазине и его товарах - for (const auto& shop : shops) { - shop.printItemsInfo(); - } - - return 0; -} diff --git a/sem1/PereverzevMA/minihomework1/task1.cpp b/sem1/PereverzevMA/minihomework1/task1.cpp deleted file mode 100644 index 24ed210e..00000000 --- a/sem1/PereverzevMA/minihomework1/task1.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -int main() -{ - int a; - std::cin >> a; - std::cout << a * a; - -} \ No newline at end of file diff --git a/sem1/PereverzevMA/minihomework1/task2.cpp b/sem1/PereverzevMA/minihomework1/task2.cpp deleted file mode 100644 index c1d46478..00000000 --- a/sem1/PereverzevMA/minihomework1/task2.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -int main() -{ - int a; - int b; - int h; - std::cin >> a; - std::cin >> b; - std::cin >> h; - std::cout << (a + b) / 2.0 * h; - -} \ No newline at end of file diff --git a/sem1/PereverzevMA/minihomework1/task3.cpp b/sem1/PereverzevMA/minihomework1/task3.cpp deleted file mode 100644 index c663469d..00000000 --- a/sem1/PereverzevMA/minihomework1/task3.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -int main() -{ - int a = 0; - int b = 1; - int c; - int N; - std::cout << "number of elements" << std::endl; - std::cin >> N; - std::cout << 1 << " "; - for (int i = 0; i < N - 1; ++i) { - c = a + b; - a = b; - b = c; - std::cout << c << " "; - } -} \ No newline at end of file diff --git a/sem1/PereverzevMA/minihomework1/task4.cpp b/sem1/PereverzevMA/minihomework1/task4.cpp deleted file mode 100644 index 77c3e2b0..00000000 --- a/sem1/PereverzevMA/minihomework1/task4.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -int main() -{ - int a; - int b = 0; - std::cin >> a; - while (a > 0) { - b *= 10; - b += a % 10; - a /= 10; - } - std::cout << b; -} \ No newline at end of file diff --git a/sem1/PereverzevMA/minihomework2/task1.cpp b/sem1/PereverzevMA/minihomework2/task1.cpp deleted file mode 100644 index 22472108..00000000 --- a/sem1/PereverzevMA/minihomework2/task1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include ; -int main() -{ - int x; - std::cout << "enter the number to convert to 16 and 8 system"; - std::cin >> x; - std::cout << std::hex << x << std::endl; - std::cout << std::oct << x << std::endl; - return 0; - -} diff --git a/sem1/PereverzevMA/minihomework2/task2.cpp b/sem1/PereverzevMA/minihomework2/task2.cpp deleted file mode 100644 index e3e2f503..00000000 --- a/sem1/PereverzevMA/minihomework2/task2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -int main() -{ - int x; - std::cout << "enter a number" << std::endl; - std::cin >> x; - while (x != 1) { - if (x % 2 == 0) { - x = x /= 2; - } - else { - x = ((x * 3) + 1); - } - - } - if (x == 1) { - std::cout << "confirmed"; -} -} \ No newline at end of file diff --git a/sem1/PestriakovVitya/MiniHomeWork1/task1.cpp b/sem1/PestriakovVitya/MiniHomeWork1/task1.cpp deleted file mode 100644 index 7aa132cb..00000000 --- a/sem1/PestriakovVitya/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -float area_square(float side) { - return side * side; -} - - float main() { // Площадь квадрата - setlocale(LC_ALL, "Russian"); - std::cout << "Введите одну из сторон квадрата:" << std::endl; - int side; - std::cin >> side; - std::cout << area_square(side) << std::endl; - return 0; -} diff --git a/sem1/PestriakovVitya/MiniHomeWork1/task2.cpp b/sem1/PestriakovVitya/MiniHomeWork1/task2.cpp deleted file mode 100644 index 393e1b6e..00000000 --- a/sem1/PestriakovVitya/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -float area_trapeze(float first_side, float second_side, float hight) { - return (first_side + second_side) / 2 * hight; -} - -int main() { // - setlocale(LC_ALL, "Russian"); - float first_side, second_side, hight; - std::cout << " :" << std::endl; - std::cin >> first_side; - std::cout << " :" << std::endl; - std::cin >> second_side; - std::cout << " :" << std::endl; - std::cin >> hight; - - std::cout << ":" << std::endl; - std::cout << area_trapeze(first_side, second_side,hight) << std::endl; - return 0; - -} \ No newline at end of file diff --git a/sem1/PestriakovVitya/MiniHomeWork1/task3.cpp b/sem1/PestriakovVitya/MiniHomeWork1/task3.cpp deleted file mode 100644 index a3c9f17c..00000000 --- a/sem1/PestriakovVitya/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -int main() { // - setlocale(LC_ALL, "Russian"); - int N, a, b, c; - std::cout << " :"; - std::cin >> N; - a = 0; - b = 1; - c = 0; - std::cout << b << std::endl; - for (int i = 1; i < N; i++) { - c = a + b; - std::cout << c << std::endl; - a = b; - b = c; - } - return 0; -} \ No newline at end of file diff --git a/sem1/PestriakovVitya/MiniHomeWork1/task4.cpp b/sem1/PestriakovVitya/MiniHomeWork1/task4.cpp deleted file mode 100644 index 39b66e0d..00000000 --- a/sem1/PestriakovVitya/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -int main() { - setlocale(LC_ALL, "Russian"); - std::cout << " :"; - int N, N_reversed, memory; - N_reversed = 0; - std::cin >> N; - while (N != 0) { - memory = N % 10; - N_reversed = N_reversed * 10 + memory; - N = N / 10; - } - std::cout << " :" << N_reversed << std::endl; - return 0; - -} \ No newline at end of file diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task1.cpp b/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task1.cpp deleted file mode 100644 index d6d3df67..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - cout << " " << endl; - int cat_storona_squad; // - cin >> cat_storona_squad; - cout << cat_storona_squad * cat_storona_squad; // -} \ No newline at end of file diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task2.cpp b/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task2.cpp deleted file mode 100644 index 5229cb93..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main2() // -{ - setlocale(LC_ALL, "Russian"); - int cat_base1; // _ - int cat_base2; // _ - int high_cat; // _ - cout << " " << endl; - cin >> cat_base1; - cout << " " << endl; - cin >> cat_base2; - cout << " " << endl; - cin >> high_cat; - cout << ((cat_base1 + cat_base2) / 2) * high_cat; -} \ No newline at end of file diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task3.cpp b/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task3.cpp deleted file mode 100644 index b0ebee38..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() // -{ - setlocale(LC_ALL, "Russian"); - int cata = 0; // - int catb = 1; //___ - int catc; //_ - int catx; //_ - cout << " " << endl; - cin >> catx; - cout << 1 << " "; - for (int i = 0; i < catx - 1; ++i) { - catc = cata + catb; - cata = catb; - catb = catc; - cout << catc << " "; - } -} - \ No newline at end of file diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task4.cpp b/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task4.cpp deleted file mode 100644 index 4c55981e..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() // -{ - setlocale(LC_ALL, "Russian"); - cout << " " << endl; - int cat; - int dog = 0; - cin >> cat; - while (cat > 0) { // - dog *= 10; // 10 - dog += cat % 10; // - cat /= 10; // - } - cout << dog; // -} diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork2/MiniHomework2_Task1.1.cpp b/sem1/PetkoEgorAndreevich/MiniHomeWork2/MiniHomework2_Task1.1.cpp deleted file mode 100644 index 06c87e1f..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork2/MiniHomework2_Task1.1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; -using std::oct; -using std::hex; -using std::dec; - - -int main() -{ - setlocale(LC_ALL, "Russian"); - int chislo; - cout << " 10- " << endl; - cin >> chislo; - cout << "8- 16- " << endl; - cout << oct << chislo << dec << hex << " " << chislo; -} \ No newline at end of file diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork2/MiniHomework2_Task2.cpp b/sem1/PetkoEgorAndreevich/MiniHomeWork2/MiniHomework2_Task2.cpp deleted file mode 100644 index 2e78c230..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork2/MiniHomework2_Task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - int chislo; - cout << " . " << endl; - cin >> chislo; - - while (chislo != 1) { - if (chislo % 2 == 0){ - chislo = chislo / 2; - } else { - chislo = (chislo * 3 + 1) / 2; - } - } - cout << " " << endl; - cout << chislo; -} \ No newline at end of file diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork3/MiniHomeWork3.cpp b/sem1/PetkoEgorAndreevich/MiniHomeWork3/MiniHomeWork3.cpp deleted file mode 100644 index 544bf237..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork3/MiniHomeWork3.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include -#include -#include -#include -using std::cout; -using std::endl; -using std::string; -using std::vector; -using std::ifstream; -using std::ofstream; -using std::stringstream; -using std::getline; - -class ItemBase { -protected: - string category; -public: - ItemBase(string category) : category(category) {} - virtual ~ItemBase() {} - string getCategory() const { return category; } -}; - -class Item : public ItemBase { -private: - string name; - float price; - float weight; - -public: - Item(string name, float price, float weight, string category) - : ItemBase(category), name(name), price(price), weight(weight) {} - - string getName() const { return name; } - float getPrice() const { return price; } - float getWeight() const { return weight; } -}; - -class Shop { -private: - string name; - vector items; - -public: - Shop(string name) : name(name) {} - - void addItem(const Item& item) { - items.push_back(item); - } - - float averagePrice() const { - if (items.empty()) return 0; - float totalPrice = 0; - for (const auto& item : items) { - totalPrice += item.getPrice(); - } - return totalPrice / items.size(); - } - - float averageWeight() const { - if (items.empty()) return 0; - float totalWeight = 0; - for (const auto& item : items) { - totalWeight += item.getWeight(); - } - return totalWeight / items.size(); - } - - void printShopInfo() const { - cout << "Shop: " << name << ", Average price: " << averagePrice() - << ", Average weight: " << averageWeight() << endl; - } -}; - -void loadShopsFromFile(const string& filename, vector& shops) { - ifstream file(filename); - - string line; - while (getline(file, line)) { - stringstream ss(line); - string shopName; - ss >> shopName; - - if (shopName == "Shop") { - string shopTitle; - ss >> shopTitle; - Shop shop(shopTitle); - - getline(file, line); - stringstream ssItems(line); - string itemsLabel; - int itemCount; - ssItems >> itemsLabel >> itemCount; - - for (int i = 0; i < itemCount; ++i) { - string name, category; - float price, weight; - string extra; - - getline(file, line); - stringstream itemStream(line); - itemStream >> name >> price >> weight >> category; - - if (itemStream >> extra) { - category += " " + extra; - } - - Item item(name, price, weight, category); - shop.addItem(item); - } - - shops.push_back(shop); - } - } -} - -int main() { - vector shops; - - loadShopsFromFile("WhatICanBuy.txt", shops); - - for (const auto& shop : shops) { - shop.printShopInfo(); - } - - return 0; -} \ No newline at end of file diff --git a/sem1/PetkoEgorAndreevich/MiniHomeWork3/WhatICanBuy.txt b/sem1/PetkoEgorAndreevich/MiniHomeWork3/WhatICanBuy.txt deleted file mode 100644 index eed79800..00000000 --- a/sem1/PetkoEgorAndreevich/MiniHomeWork3/WhatICanBuy.txt +++ /dev/null @@ -1,21 +0,0 @@ -Shop Fruits -Items 5 -Apple 52 20 -Avocado 30 23 -Banana 25 53 -Orange 50 35 -Pineapple 666 666 -Shop Vegetables -Items 5 -Carrot 50 10 -Cucumber 65 99 -Eggplant 666 666 -Onion 1 -Potato 300 -Shop Flowers -Items 5 -Chrysanthemum 21 55 -Lily 52 18 -Pion 33 15 -Rose 666 666 -Tulip 77 30 \ No newline at end of file diff --git a/sem1/PolinaShumilina/MiniHomeWork1/Task1.cpp b/sem1/PolinaShumilina/MiniHomeWork1/Task1.cpp deleted file mode 100644 index 68732b32..00000000 --- a/sem1/PolinaShumilina/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main() -{ - int n; - std::cout << "Enter the side of the square - "; - std::cin >> n; - std::cout << n * n; -} diff --git a/sem1/PolinaShumilina/MiniHomeWork1/Task2.cpp b/sem1/PolinaShumilina/MiniHomeWork1/Task2.cpp deleted file mode 100644 index c356d1af..00000000 --- a/sem1/PolinaShumilina/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() -{ - int a; - std::cout << "Enter the upper base of the trapezoid - "; - std::cin >> a; - int b; - std::cout << "Enter the lower base of the trapezoid - "; - std::cin >> b; - int h; - std::cout << "Enter the hight of the trapezoid - "; - std::cin >> h; - std::cout << (a + b) / 2 * h; -} diff --git a/sem1/PolinaShumilina/MiniHomeWork1/Task3.cpp b/sem1/PolinaShumilina/MiniHomeWork1/Task3.cpp deleted file mode 100644 index 211ea842..00000000 --- a/sem1/PolinaShumilina/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int main() -{ - int x = 0; - int y = 1; - int z; - int n; - std::cout << "Enter the number of elements - "; - std::cin >> n; - std::cout << 1 << " "; - for (int i = 0; i < n - 1;++i) { - z = x + y; - x = y; - y = z; - std::cout << z << " "; - } -} diff --git a/sem1/PolinaShumilina/MiniHomeWork1/Task4.cpp b/sem1/PolinaShumilina/MiniHomeWork1/Task4.cpp deleted file mode 100644 index 5b391df3..00000000 --- a/sem1/PolinaShumilina/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main() -{ - int x; - std::cout << "Enter a number - "; - std::cin >> x; - int y = 0; - while (x > 0) { - y = y * 10 + x % 10; - x = x / 10; - } - std::cout << y; -} diff --git a/sem1/PolinaShumilina/MiniHomeWork2/Task1.cpp b/sem1/PolinaShumilina/MiniHomeWork2/Task1.cpp deleted file mode 100644 index 9913ca13..00000000 --- a/sem1/PolinaShumilina/MiniHomeWork2/Task1.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int main() -{ - int n; - std::cout << "Enter the number - "; - std::cin >> n; - int x; - std::cout << "Enter the number system: 16 or 8 - "; - std::cin >> x; - if (x == 16) { - std::cout << std::hex << n; - } - if (x == 8) { - std::cout << std::oct << n; - } - if (x != 16 and x != 8) { - std::cout << "we can't do anything((("; - } -} diff --git a/sem1/PolinaShumilina/MiniHomeWork2/Task2.cpp b/sem1/PolinaShumilina/MiniHomeWork2/Task2.cpp deleted file mode 100644 index 77f5341f..00000000 --- a/sem1/PolinaShumilina/MiniHomeWork2/Task2.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -int main() -{ - int n; - std::cout << "Enter the number - "; - std::cin >> n; - if (n > 0) { - while (n != 1) { - if (n % 2 == 0) { - n = n / 2; - } - else { - n = ((n * 3) + 1) / 2; - } - } - std::cout << "The resulting number - " << n << std::endl; - std::cout << "Syracuse's hypothesis verified!"; - } - else { - std::cout << "You entered a non-natural number"; - } -} \ No newline at end of file diff --git a/sem1/RebrovaEkaterina/MiniHomeWork1/1zadacha.cpp b/sem1/RebrovaEkaterina/MiniHomeWork1/1zadacha.cpp deleted file mode 100644 index 2eeaa1e8..00000000 --- a/sem1/RebrovaEkaterina/MiniHomeWork1/1zadacha.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -using std::cout; -using std::cin; - -int main() -{ - int a; - cin >> a; - cout << a * a; -} \ No newline at end of file diff --git a/sem1/RebrovaEkaterina/MiniHomeWork1/2zadacha.cpp b/sem1/RebrovaEkaterina/MiniHomeWork1/2zadacha.cpp deleted file mode 100644 index cb5a29ca..00000000 --- a/sem1/RebrovaEkaterina/MiniHomeWork1/2zadacha.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - double a; - double b; - double h; - - cout << "Введите нижнюю сторону: "; - cin >> a; - cout << "Введите верхнюю сторону: "; - cin >> b; - cout << "Введите высоту: "; - cin >> h; - - double area = (a + b) / 2 * h; - - cout << "Площадь трапеции: " << area << endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/RebrovaEkaterina/MiniHomeWork1/3zadacha.cpp b/sem1/RebrovaEkaterina/MiniHomeWork1/3zadacha.cpp deleted file mode 100644 index c2f978c7..00000000 --- a/sem1/RebrovaEkaterina/MiniHomeWork1/3zadacha.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - setlocale(LC_ALL, "Russian"); - int a = 0; int b = 1; int c; int x; - cout << "Введите кол-во элементов" << endl; - cin >> x; - cout << 1 << " "; - for (int i = 0; i < x - 1; ++i) { - c = a + b; - a = b; - b = c; - cout << c << " "; - } -} diff --git a/sem1/RebrovaEkaterina/MiniHomeWork1/4zadacha.cpp b/sem1/RebrovaEkaterina/MiniHomeWork1/4zadacha.cpp deleted file mode 100644 index c02b79f3..00000000 --- a/sem1/RebrovaEkaterina/MiniHomeWork1/4zadacha.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - int a, b = 0; - cin >> a; - while (a > 0) { - b *= 10; - b += a % 10; - a /= 10; - } - cout << b; -} diff --git a/sem1/ReshetnikovEgor/MiniHomeWork1/Task1.cpp b/sem1/ReshetnikovEgor/MiniHomeWork1/Task1.cpp deleted file mode 100644 index 4746f1b3..00000000 --- a/sem1/ReshetnikovEgor/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int Square(int numb) { - return numb * numb; -} - -int main() { - setlocale(LC_ALL, "Russian"); - int input; - std::cout << "Введите сторону квадрата: "; - std::cin >> input; - std::cout << "Площадь квадрата равна: " << Square(input) << std::endl; -} diff --git a/sem1/ReshetnikovEgor/MiniHomeWork1/Task2.cpp b/sem1/ReshetnikovEgor/MiniHomeWork1/Task2.cpp deleted file mode 100644 index a01b0eea..00000000 --- a/sem1/ReshetnikovEgor/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int Trapez(int base1, int base2, int height) { - return (base1 + base2) / 2 * height; -} -int main() { - setlocale(LC_ALL, "Russian"); - int input_1, input_2, input_3; - td::cout << "Введите нижнее и верхнее основание трапеции: "; - std::cin >> input_1 >> input_2; - std::cout << "Введите высоту трапеции: "; - std::cin >> input_3; - std::cout << "Площадь трапеции равна: " << Trapez(input_1, input_2, input_3) << std::endl; -} diff --git a/sem1/ReshetnikovEgor/MiniHomeWork1/Task3.cpp b/sem1/ReshetnikovEgor/MiniHomeWork1/Task3.cpp deleted file mode 100644 index 8856e1f1..00000000 --- a/sem1/ReshetnikovEgor/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -void Fibonachi(int last_numb) { - int rememb_numbers[3]{ 0, 1, 1 }; - for (int i = 0; i < last_numb; i++) { - std::cout << rememb_numbers[0] << ' '; - rememb_numbers[2] = rememb_numbers[1]; - rememb_numbers[1] = rememb_numbers[0] + rememb_numbers[1]; - rememb_numbers[0] = rememb_numbers[2]; - } -} -int main() { - setlocale(LC_ALL, "Russian"); - int numb_fibon; - std::cout << "Введите число для последовательности фибоначи: "; - std::cin >> numb_fibon; - std::cout << "Последовательнось: "; - Fibonachi(numb_fibon); -} diff --git a/sem1/ReshetnikovEgor/MiniHomeWork1/Task4.cpp b/sem1/ReshetnikovEgor/MiniHomeWork1/Task4.cpp deleted file mode 100644 index b778f5f4..00000000 --- a/sem1/ReshetnikovEgor/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int reverse_numb(int numb) { - int result = 0; - while (true) { - result = result * 10 + (numb % 10); - numb = numb / 10; - if (numb == 0) { - return result; - } - } -} - -int main() { - setlocale(LC_ALL, "Russian"); - int input; - std::cout << "Введите число: "; - std::cin >> input; - std::cout << "Ваше число перевернуто: " << reverse_numb(input); -} diff --git a/sem1/ReshetnikovEgor/MiniHomeWork2/Task1.cpp b/sem1/ReshetnikovEgor/MiniHomeWork2/Task1.cpp deleted file mode 100644 index cf9f1a2e..00000000 --- a/sem1/ReshetnikovEgor/MiniHomeWork2/Task1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int siracus(int numb) { - if (numb == 1) return 1; - if (numb % 2) { - return siracus((numb * 3 + 1) / 2); - } - else return siracus(numb / 2); -} -int main() { - setlocate(LS_ALL, "Russian"); - int simple_numb; - while (true) { - std::cout << "Brutyu y| t| ru{y syux Ryp{x: "; - std::cin >> simple_numb; - std::cout << "Oru: " << siracus(simple_numb) << std::endl; - } - -} \ No newline at end of file diff --git a/sem1/ReshetnikovEgor/MiniHomeWork2/Task2.cpp b/sem1/ReshetnikovEgor/MiniHomeWork2/Task2.cpp deleted file mode 100644 index ca61cf17..00000000 --- a/sem1/ReshetnikovEgor/MiniHomeWork2/Task2.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -using namespace std::string_literals; -std::string eight_sys(int numb) { - std::string res; - while (numb > 0) { - res = std::to_string(numb % 8) + res; - numb /= 8; - } - return res; -} - -std::string sixteen_sys(int numb) { - std::string res; - std::string letters = "ABCDEF"; - while (numb > 0) { - if (numb % 16 > 9) { - res = letters[numb % 16 - 10] + res; - } - else { - res = std::to_string(numb % 16) + res; - } - numb /= 16; - } - return res; -} - -std::string system(int sys, int numb) { return sys == 16 ? sixteen_sys(numb) : eight_sys(numb); } - -int main() { - int first_input, second_input; - while (true) { - std::cout << "B {p{ yu} y|u~y r yu uuruy y|? \n" - "Brutyu 8 u|y r r}uy~ y 16 u|y r u~ptpyy~: "; - std::cin >> first_input; - if (first_input == 8 || first_input == 16) { - std::cout << "Suu {p{u y}u~~ y| uuruy?: "; - std::cin >> second_input; - std::cout << "Bpu uurutu~~u y|: " << system(first_input, second_input) << std::endl; - } - else { - std::cout << "Sp{z yu} y|u~y r qpxu tp~~ ~u." << std::endl; - } - } -} \ No newline at end of file diff --git a/sem1/RomanLitvinchuk/MiniHomeWork1/Task1.cpp b/sem1/RomanLitvinchuk/MiniHomeWork1/Task1.cpp deleted file mode 100644 index c162ed66..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork1/Task1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -float square(float side) { - return side * side; -} - -int main() -{ - float side = 0.0; - std::cout << "Side length?" << std::endl; - std::cin >> side; - if (side >= 0.0) { - std::cout << "Square = " << square(side); - } - else { - std::cout << "Invalid value!"; - } - return 0; -} \ No newline at end of file diff --git a/sem1/RomanLitvinchuk/MiniHomeWork1/Task2.cpp b/sem1/RomanLitvinchuk/MiniHomeWork1/Task2.cpp deleted file mode 100644 index 6feb4057..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork1/Task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -float SquareTrapezoid(float side1, float side2, float height) { - return (side1 + side2) / 2 * height; -} - - -int main() -{ - float side1, side2 = 0.0, height = 0.0; - - std::cout << "Sides length?" << std::endl; - std::cin >> side1; - std::cin >> side2; - std::cout << "Height?" << std::endl; - std::cin >> height; - if (side1 >=0 and side2>=0 and height>=0) { - std::cout << "Square = " << SquareTrapezoid(side1, side2, height); - } - else { - std::cout << "Invalid value"; - } - return 0; -} \ No newline at end of file diff --git a/sem1/RomanLitvinchuk/MiniHomeWork1/Task3.cpp b/sem1/RomanLitvinchuk/MiniHomeWork1/Task3.cpp deleted file mode 100644 index 748005a6..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork1/Task3.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include - - -int main() -{ - unsigned int quantity = 0; - unsigned int storage = 0; - std::cout << "How many elements?" << std::endl; - std::cin >> quantity; - unsigned int FirstNumber = 1; - unsigned int SecondNumber = 1; - if (quantity >= 2) { - std::cout << FirstNumber << " "; - std::cout << SecondNumber << " "; - quantity -= 2; - } - else { - if (quantity == 1) { - std::cout << FirstNumber; - --quantity; - } - else { - if (quantity == 0) { - std::cout << "Nothing"; - } - } - - } - while (quantity > 0) { - std::cout << FirstNumber + SecondNumber << " "; - storage = FirstNumber; - FirstNumber = SecondNumber; - SecondNumber += storage; - --quantity; - - } - - -} \ No newline at end of file diff --git a/sem1/RomanLitvinchuk/MiniHomeWork1/Task4.cpp b/sem1/RomanLitvinchuk/MiniHomeWork1/Task4.cpp deleted file mode 100644 index bff22433..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork1/Task4.cpp +++ /dev/null @@ -1,34 +0,0 @@ -# include -# include - -int main() -{ - int number = 0; - int ZeroCount = 0; - int ReverseNumber = 0; - int digit = -1; - std::cout << "Number?" << std::endl; - std::cin >> number; - int storage = number; - while (storage % 10 == 0) { - ZeroCount += 1; - storage /= 10; - - } - storage = number; - while (storage != 0) { - storage = storage / 10; - digit += 1; - } - while (number != 0) { - ReverseNumber += number % 10 * pow(10, digit); - number = number / 10; - digit -= 1; - } - std::cout << "Reverse Number = "; - for (; ZeroCount > 0; --ZeroCount) { - std::cout << '0'; - } - std::cout << ReverseNumber; - return 0; -} \ No newline at end of file diff --git a/sem1/RomanLitvinchuk/MiniHomeWork2/Task1.cpp b/sem1/RomanLitvinchuk/MiniHomeWork2/Task1.cpp deleted file mode 100644 index 4321f95a..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork2/Task1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -void ConversionTo8(int value) { - std::cout << std::oct << value << std::endl; -} - -void ConversionTo16(int value) { - std::cout << std::hex << value << std::endl; -} - -int main() { - int value = 0; - std::cout << "Enter a number:" << std::endl; - std::cin >> value; - ConversionTo8(value); - ConversionTo16(value); - return 0; -} \ No newline at end of file diff --git a/sem1/RomanLitvinchuk/MiniHomeWork2/Task2.cpp b/sem1/RomanLitvinchuk/MiniHomeWork2/Task2.cpp deleted file mode 100644 index c1967e4b..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork2/Task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main() { - unsigned int value = 0; - std::cout << "Enter a natural number:" << std::endl; - std::cin >> value; - while (value != 1) { - if ((value % 2) == 0) { - value = value / 2; - - } - else { - value = (value * 3 + 1) / 2; - } - } - std::cout << "Value=" << value << " True!" << std::endl; -} diff --git a/sem1/RomanLitvinchuk/MiniHomeWork3/MiniHomeWork3(2).cpp b/sem1/RomanLitvinchuk/MiniHomeWork3/MiniHomeWork3(2).cpp deleted file mode 100644 index 040ce220..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork3/MiniHomeWork3(2).cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include -#include -#include -#include - -class Item { -public: - Item(std::string name, double price, double weight) - : name(name), price(price), weight(weight) {} - - double getPrice() - { - return price; - } - double getWeight() - { - return weight; - } - -private: - std::string name; - double price; - double weight; -}; - -class ShopBase { -public: - ShopBase(std::string name) : name(name) {} - - void addItem(Item item) { - items.push_back(item); - } - - double averagePrice() - { - double totalPrice = 0; - for (Item item : items) { - totalPrice += item.getPrice(); - } - return totalPrice / items.size(); - } - - double averageWeight() - { - double totalWeight = 0; - for (Item item : items) { - totalWeight += item.getWeight(); - } - return totalWeight / items.size(); - } - - std::string getName() - { - return name; - } - -private: - std::string name; - std::vector items; -}; - -class DrinksShop : public ShopBase { -public: - DrinksShop() : ShopBase("Drinks") {} -}; - -class FurnitureShop : public ShopBase { -public: - FurnitureShop() : ShopBase("Furniture") {} -}; - -class HardwareShop : public ShopBase { -public: - HardwareShop() : ShopBase("Hardware") {} -}; - -int main() { - std::ifstream file("shops.txt"); - if (!file.is_open()) { - std::cerr << "Error! File is not opened!"; - return 1; - } - - DrinksShop drinksShop; - FurnitureShop furnitureShop; - HardwareShop hardwareShop; - - std::string shopType; - std::string ItemsStr; - int itemCount; - - while (file >> shopType) { - if (shopType == "Shop") { - file >> shopType; - file >> ItemsStr; - file >> itemCount; - - if (shopType == "Drinks") { - for (int i = 0; i < itemCount; ++i) { - std::string itemName; - double price, weight; - - file >> itemName >> price >> weight; - drinksShop.addItem(Item(itemName, price, weight)); - } - } - else if (shopType == "Furniture") { - for (int i = 0; i < itemCount; ++i) { - std::string itemName; - double price, weight; - - file >> itemName >> price >> weight; - furnitureShop.addItem(Item(itemName, price, weight)); - } - } - else if (shopType == "Hardware") { - for (int i = 0; i < itemCount; ++i) { - std::string itemName; - double price, weight; - - file >> itemName >> price >> weight; - hardwareShop.addItem(Item(itemName, price, weight)); - } - } - } - } - - std::vector shops = { drinksShop, furnitureShop, hardwareShop }; - for (auto shop : shops) { - std::cout << "Shop: " << shop.getName() << std::endl; - std::cout << "Average Price: " << shop.averagePrice() << std::endl; - std::cout << "Average Weight: " << shop.averageWeight() << std::endl << std::endl; - } - - return 0; -} \ No newline at end of file diff --git a/sem1/RomanLitvinchuk/MiniHomeWork3/shops.txt b/sem1/RomanLitvinchuk/MiniHomeWork3/shops.txt deleted file mode 100644 index f7240e40..00000000 --- a/sem1/RomanLitvinchuk/MiniHomeWork3/shops.txt +++ /dev/null @@ -1,21 +0,0 @@ -Shop Drinks -Items 5 -Cola 80 1 -Fanta 70 0.5 -Lemonade 60 0.5 -Sprite 100 1.5 -Tarragon 85 1 -Shop Furniture -Items 5 -Sofa 10000 7 -Table 15000 15 -Chair 6000 2 -Dresser 14500 13 -Wardrobe 24000 20 -Shop Hardware -Items 5 -Hammer 3000 1.5 -Screwriver 500 0.3 -Cement bag 13000 10 -Pins 150 0.1 -Nails 200 0.2 diff --git a/sem1/RusakovaDS/MiniHomeWork1/task1.cpp b/sem1/RusakovaDS/MiniHomeWork1/task1.cpp deleted file mode 100644 index 39747f1f..00000000 --- a/sem1/RusakovaDS/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int calcSquareArea(int side) { - return side * side; -} - -int main() { - int side = 3; - std::cout << "Area of square w/ side 3 = " << calcSquareArea(side); - return 0; -} \ No newline at end of file diff --git a/sem1/RusakovaDS/MiniHomeWork1/task2.cpp b/sem1/RusakovaDS/MiniHomeWork1/task2.cpp deleted file mode 100644 index aa47947c..00000000 --- a/sem1/RusakovaDS/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int calcTrapezeArea(int base1, int base2, int height) { - return (base1 + base2) * height / 2; -} - -int main() { - int base1 = 3; - int base2 = 5; - int height = 4; - std::cout << "Area of trapeze = " << calcTrapezeArea(side); - return 0; -} \ No newline at end of file diff --git a/sem1/RusakovaDS/MiniHomeWork1/task3.cpp b/sem1/RusakovaDS/MiniHomeWork1/task3.cpp deleted file mode 100644 index 4af8e499..00000000 --- a/sem1/RusakovaDS/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int fib(int n) { - int a = 0, b = 1; - for (int i = 2; i <= n; i++) - { - int = a + b; - a = b; - b = c; - } - return b; -} - -int main() { - int n; - std::cin >> n; - std::cout << fib(n); - return 0; -} \ No newline at end of file diff --git a/sem1/RusakovaDS/MiniHomeWork1/task4.cpp b/sem1/RusakovaDS/MiniHomeWork1/task4.cpp deleted file mode 100644 index 502b4be9..00000000 --- a/sem1/RusakovaDS/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int reverseNumber(int number) { - int reverse = 0, remainder; - - while (number != 0) - { - remainder = number % 10; - reverse = reverse * 10 + remainder; - number /= 10; - }; - - return reverse; -} - -int main() { - int n; - std::cin >> n; - std::cout << reverseNumber(n); - return 0; -} \ No newline at end of file diff --git a/sem1/RusakovaDS/MiniHomeWork2/task1.cpp b/sem1/RusakovaDS/MiniHomeWork2/task1.cpp deleted file mode 100644 index b2c5a943..00000000 --- a/sem1/RusakovaDS/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -const std::string digits = "0123456789ABCDEF"; - -void convert(int number, int base) { - std::string result, sign; - if (number < 0) { - sign = "-"; - number *= -1; - } - if (number == 0) { - result = "0"; - } - while (number > 0) { - result = digits[number % base] + result; - number /= base; - } - - std::cout << "Number in " << base << " base: " << sign << result << std::endl; -} - -void convertOct(int number) { - convert(number, 8); -} - -void convertHex(int number) { - convert(number, 16); -} -int main() { - int number = 0; - std::cout << "Enter your number:" << std::endl; - std::cin >> number; - - convertOct(number); - convertHex(number); -} \ No newline at end of file diff --git a/sem1/RusakovaDS/MiniHomeWork2/task2.cpp b/sem1/RusakovaDS/MiniHomeWork2/task2.cpp deleted file mode 100644 index a05d8d96..00000000 --- a/sem1/RusakovaDS/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -int main() { - long long number; - std::cout << "Enter natural number" << std::endl; - std::cin >> number; - - while (true) { - if (number % 2 == 0) { - number /= 2; - } - else { - number = (3 * number + 1) / 2; - } - std::cout << number << " "; - if (number == 1) { - std::cout << "Hipotesys confirmed" << std::endl; - break; - } - } -} \ No newline at end of file diff --git a/sem1/RusakovaDS/ShopDB/ShopDB.cpp b/sem1/RusakovaDS/ShopDB/ShopDB.cpp deleted file mode 100644 index a254aadd..00000000 --- a/sem1/RusakovaDS/ShopDB/ShopDB.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include -#include -#include -#include -#include - -using namespace std; - -struct Item { - string name; - float price; - float weight; -}; - -using Items = vector; - -struct Shop { - string name; - int itemCount; - Items items; -}; - -using Shops = vector; - - -class ShopDB -{ -public: - string getFileName() - { - return fileName; - } - - void readFromFile() { - ifstream file; - string line, word; - vector row; - Items items; - string name = ""; - int count = 0; - int itemCount = 0; - bool isShop = true; - - file.open(getFileName()); - - if (file.is_open()) - { - shops.clear(); - - while (getline(file, line)) - { - row.clear(); - - stringstream s(line); - - while (getline(s, word, ';')) - { - row.push_back(word); - } - - if (isShop) - { - if (items.size() > 0) - { - shops.push_back(Shop{ name, itemCount, items }); - items.clear(); - name = ""; - itemCount = 0; - } - - isShop = false; - count = 0; - name = row[0]; - itemCount = stoi(row[1]); - } - else - { - string name = row[0]; - float weigth = stof(row[1]); - float price = stof(row[2]); - items.push_back(Item{ name, price, weigth }); - count++; - if (count == itemCount) { - isShop = true; - } - } - } - if (items.size() > 0) - { - shops.push_back(Shop{ name, itemCount, items }); - items.clear(); - name = ""; - itemCount = 0; - } - } - file.close(); - } - - void printAllShops() - { - for (Shop shop : shops) - { - printShop(shop); - } - } - - void printShop(Shop shop) - { - float weightSum = 0; - float priceSum = 0; - - cout << "Name: " - << shop.name - << "\tcount: " - << shop.itemCount - << endl; - - for (Item item : shop.items) - { - cout << "\tName: " - << item.name - << "\t\tweight: " - << item.weight - << "\tprice: " - << item.price - << endl; - weightSum += item.weight; - priceSum += item.price; - } - cout << "\t\t\t" - << "average weight: " - << weightSum / shop.itemCount - << "\taverage price: " - << priceSum / shop.itemCount - << endl; - cout << "=====================" - << endl; - } - -private: - const string fileName = "shops.csv"; - - Shops shops; - - -}; - - - -int main() -{ - ShopDB shopDB; - shopDB.readFromFile(); - shopDB.printAllShops(); - - cout << "FileName: " << shopDB.getFileName() << endl; -} \ No newline at end of file diff --git a/sem1/RusakovaDS/ShopDB/shops.csv b/sem1/RusakovaDS/ShopDB/shops.csv deleted file mode 100644 index fa91965b..00000000 --- a/sem1/RusakovaDS/ShopDB/shops.csv +++ /dev/null @@ -1,21 +0,0 @@ -Grocery Store 1;5; -rice mix;5.1;1 -grapes;1.2;2 -pork soda;12;10 -cocoa;0.5;20 -kiwi;2;4 -Grocery Store 2;6; -chili;0.2;60 -melon;10;0.5 -crab;1.5;32.5 -yeast;0.2;4 -cleaner;3;3 -corn;5;2 -Grocery Store 3;7; -milk;1;6; -squash;4;14; -croutons;2.5;4; -sunscreen;0.5;12; -wipes;0.3;7; -mozarella;1.2;36; -tomatoes;0.1;24; \ No newline at end of file diff --git a/sem1/SafronovGE/MiniHomeWork1/1.cpp b/sem1/SafronovGE/MiniHomeWork1/1.cpp deleted file mode 100644 index d60815c3..00000000 --- a/sem1/SafronovGE/MiniHomeWork1/1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void square_area(int side_square) { - std::cout << side_square * side_square << "\n"; - return; -} - -int main() { - square_area(2); -} - diff --git a/sem1/SafronovGE/MiniHomeWork1/2.cpp b/sem1/SafronovGE/MiniHomeWork1/2.cpp deleted file mode 100644 index 6f05d851..00000000 --- a/sem1/SafronovGE/MiniHomeWork1/2.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -void trapezoid_area(int side_base1, int side_base2, int side_hight) { - std::cout << (side_hight * (side_base1 + side_base2) / 2) << "\n"; - return; -} - - -int main() { - trapezoid_area(2, 4, 4); -} - diff --git a/sem1/SafronovGE/MiniHomeWork1/3.cpp b/sem1/SafronovGE/MiniHomeWork1/3.cpp deleted file mode 100644 index cdca74eb..00000000 --- a/sem1/SafronovGE/MiniHomeWork1/3.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -unsigned long long int Fibonacci_series(int N, unsigned long long int Fn1, unsigned long long int Fn2) { - if (N == 0) { - std::cout << '\n'; - return 0; - } - std::cout << Fn1 << ' '; - return Fibonacci_series(N - 1, Fn2, Fn1 + Fn2); -} - -int main() { - int N; - std::cin >> N; - Fibonacci_series(N, 0, 1); -} - diff --git a/sem1/SafronovGE/MiniHomeWork1/4.cpp b/sem1/SafronovGE/MiniHomeWork1/4.cpp deleted file mode 100644 index 9fed3677..00000000 --- a/sem1/SafronovGE/MiniHomeWork1/4.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int revers(int re_number) { - if (re_number == 0) { - return 0; - } - std::cout << (re_number % 10); - return revers(re_number / 10); -} - -int main() { - int N; - std::cin >> N; - revers(N); -} \ No newline at end of file diff --git a/sem1/SafronovGE/MiniHomework2/1.cpp b/sem1/SafronovGE/MiniHomework2/1.cpp deleted file mode 100644 index a46a9940..00000000 --- a/sem1/SafronovGE/MiniHomework2/1.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include - -std::string sistem_eight(int ten) { - std::string number = ""; - do { - number += std::to_string(ten % 8); - ten /= 8; - } while (ten != 0); - std::reverse(number.begin(), number.end()); - return number; -} - -std::string sistem_sixteen(int ten) { - const std::string database = "0123456789ABCDEF"; - std::string number = ""; - do { - number += database[(ten % 16)]; - ten /= 16; - } while (ten != 0); - std::reverse(number.begin(), number.end()); - return number; -} - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int data; - int request; - std::cout << "Добрый день!\nВведите десятичное число:"; - std::cin >> data; - std::cout << "Если Вы хотите преобразовать десятичное число в восьмеричное, то введите 1.\n Если Вы хотите преобразовать десятичное число в шетснадцатеричное, то введите 2.\n"; - std::cin >> request; - if (request == 1) { - std::cout << sistem_eight(data); - } - else if (request == 2) { - std::cout << sistem_sixteen(data); - } -} - diff --git a/sem1/SafronovGE/MiniHomework2/2.cpp b/sem1/SafronovGE/MiniHomework2/2.cpp deleted file mode 100644 index 8c52365f..00000000 --- a/sem1/SafronovGE/MiniHomework2/2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -bool Sirakuza(int number) { - while (true) - { - if (number == 1) { - return true; - } - else if (number < 1) { - return false; - } - else if (number % 2 == 0) { - number /= 2; - } - else { - number = ((number * 3) + 1) / 2; - } - } -} - -int main() -{ - setlocale(LC_ALL, "Russian"); - - int number; - - std::cin >> number; - if (Sirakuza(number) == true) { - std::cout << "Число подтвердило теорию!"; - } - else { - std::cout << "Число неподтвердило теорию!"; - } -} - diff --git a/sem1/SamsonovaTaisia/MiniHomework1/task1.cpp b/sem1/SamsonovaTaisia/MiniHomework1/task1.cpp deleted file mode 100644 index 173feb7d..00000000 --- a/sem1/SamsonovaTaisia/MiniHomework1/task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ - - -#include -int square(int a) { - return a * a; -} -int input = 0; -int main() -{ - std::cout << "Введите сторону квадрата: "; - std::cin >> input; - std::cout << "Площадь квадрата:" << square(input); -} - diff --git a/sem1/SamsonovaTaisia/MiniHomework1/task2.cpp b/sem1/SamsonovaTaisia/MiniHomework1/task2.cpp deleted file mode 100644 index 31514528..00000000 --- a/sem1/SamsonovaTaisia/MiniHomework1/task2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -int S_trapeze(int a, int b, int h) { - return (a + b) / 2 * h; -} -int AD = 0; -int BC = 0; -int h = 0; -int main() -{ - std::cout << "Введите основания трапеции: "; - std::cin >> AD; - std::cin >> BC; - std::cout << "Введите высоту трапеции: "; - std::cin >> h; - std::cout << "Площадь трапеции: " << S_trapeze(AD, BC, h); - -} \ No newline at end of file diff --git a/sem1/SamsonovaTaisia/MiniHomework1/task3.cpp b/sem1/SamsonovaTaisia/MiniHomework1/task3.cpp deleted file mode 100644 index cb7bb830..00000000 --- a/sem1/SamsonovaTaisia/MiniHomework1/task3.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -#include -int number = 0; -int counter = 1; -int a = 1; -int b = 1; -int c = 0; -int main() -{ - std::cout << "Введите номер: "; - std::cin >> number; - while (counter <= number) { - std::cout << a << " "; - counter = counter + 1; - c = a + b; - a = b; - b = c; - } -} - diff --git a/sem1/SamsonovaTaisia/MiniHomework1/task4.cpp b/sem1/SamsonovaTaisia/MiniHomework1/task4.cpp deleted file mode 100644 index 2d42f903..00000000 --- a/sem1/SamsonovaTaisia/MiniHomework1/task4.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -#include -int input = 0; -int k = 0; -int length = 0; -int last_number = 0; -int result = 0; - -int numbers(int a) { - while (a > 0) { - a = a / 10; - k = k + 1; - } - return k; -} -int main() -{ - std::cin >> input; - length = numbers(input); - while (input > 0) { - last_number = input % 10; - result = result + (last_number * pow(10, length - 1)); - input = input / 10; - length = length - 1; - } - std::cout << result; -} \ No newline at end of file diff --git a/sem1/Scherbakov Marat/Mini-Homework_2/Sirakyza.cpp b/sem1/Scherbakov Marat/Mini-Homework_2/Sirakyza.cpp deleted file mode 100644 index 6310170b..00000000 --- a/sem1/Scherbakov Marat/Mini-Homework_2/Sirakyza.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -int main() { - int n; - setlocale(LC_ALL, "Russian"); - std::cout << "Введите натуральное число: "; - std::cin >> n; - if (n <= 0) { - std::cout << "Ошибка: введите натуральное число." << std::endl; - return 1; - } - - std::cout << "Результат проверки гипотезы: " << std::endl; - - while (n != 1) { - std::cout << n << " "; - - if (n % 2 == 0) { - n = n / 2; - } else { - n = (n * 3 + 1); - } - } - std::cout << n << std::endl; - return 0; -} \ No newline at end of file diff --git a/sem1/Scherbakov Marat/Mini-Homework_2/System_10_16_8.cpp b/sem1/Scherbakov Marat/Mini-Homework_2/System_10_16_8.cpp deleted file mode 100644 index 2b99cd7d..00000000 --- a/sem1/Scherbakov Marat/Mini-Homework_2/System_10_16_8.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main() { - int Number_in_10; - setlocale(LC_ALL, "Russian"); - std::cout << "Введите десятичное число: "; - std::cin >> Number_in_10; - - std::cout << "Это число в шеснадцатеричной системе счисления: " - << std::hex << Number_in_10 << std::endl; - - std::cout << "Это число в восьмеричной системе счисления: " - << std::oct << Number_in_10 << std::endl; - return 0; -} \ No newline at end of file diff --git a/sem1/Scherbakov Marat/minidz3/minidz3.cpp b/sem1/Scherbakov Marat/minidz3/minidz3.cpp deleted file mode 100644 index fa7f1b14..00000000 --- a/sem1/Scherbakov Marat/minidz3/minidz3.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include -#include -#include - - -class ItemBase { - -public: - std::string name; - int price; - int weight; - - - void parse(std::string s) { - - } -}; - -class Guns : public ItemBase { - -public: - int size; - void parse(std::string s) { - std::string tmp = ""; - std::vector vars; - for (auto el : s) { - if (el == ' ') { - vars.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - vars.push_back(tmp); - name = vars[0]; - price = stoi(vars[1]); - size = stoi(vars[2]); - weight = stoi(vars[3]); - } -}; - -class Bullets : public ItemBase { - -public: - int quantity; - void parse(std::string s) { - std::string tmp = ""; - std::vector vars; - for (auto el : s) { - if (el == ' ') { - vars.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - vars.push_back(tmp); - name = vars[0]; - price = stoi(vars[1]); - quantity = stoi(vars[2]); - weight = stoi(vars[3]); - } -}; - -class Knifes : public ItemBase { - -public: - int length; - void parse(std::string s) { - std::string tmp = ""; - std::vector vars; - for (auto el : s) { - if (el == ' ') { - vars.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - vars.push_back(tmp); - name = vars[0]; - price = stoi(vars[1]); - length = stoi(vars[2]); - weight = stoi(vars[3]); - } -}; - -class Shop { - -public: - std::vector items; - - int getAveragePrice() { - int result = 0; - if (items.empty()) - return 0; - for (auto item : items) - result += item.price; - return result / items.size(); - } - int getAverageWeight() { - int result = 0; - if (items.empty()) - return 0; - for (auto item : items) - result += item.weight; - return result / items.size(); - } -}; -int main() { - setlocale(LC_ALL, "ru"); - Shop Gunsshop, Knifesshop, Bulletsshop; - std::ifstream in; - in.open("shops.txt"); - std::string line; - for (int i = 0; i < 5; ++i) { - getline(in, line); - Guns item; - item.parse(line); - Gunsshop.items.push_back(item); - } - for (int i = 0; i < 5; ++i) { - getline(in, line); - Bullets item; - item.parse(line); - Bulletsshop.items.push_back(item); - } - for (int i = 0; i < 5; ++i) { - getline(in, line); - Knifes item; - item.parse(line); - Knifesshop.items.push_back(item); - } - - std::cout << "Shop: Guns"; - std::cout << "Average price: " << Gunsshop.getAveragePrice() << '\n'; - std::cout << "Average weight: " << Gunsshop.getAverageWeight() << '\n'; - std::cout << "Shop: Bullets"; - std::cout << "Average price: " << Bulletsshop.getAveragePrice() << '\n'; - std::cout << "Average weight: " << Bulletsshop.getAverageWeight() << '\n'; - std::cout << "Shop: Knifes "; - std::cout << "Average price: " << Knifesshop.getAveragePrice() << '\n'; - std::cout << "Average weight: " << Knifesshop.getAverageWeight() << '\n'; -} \ No newline at end of file diff --git a/sem1/Scherbakov Marat/minidz3/shops.txt b/sem1/Scherbakov Marat/minidz3/shops.txt deleted file mode 100644 index 9122fd2a..00000000 --- a/sem1/Scherbakov Marat/minidz3/shops.txt +++ /dev/null @@ -1,15 +0,0 @@ -AK47 2700 100 4 -M4A4 3200 150 3 -AUG 3700 300 4 -GALIL 1800 10 4 -USP-S 200 500 1 -7.62_BULLET 150 30 3 -5.45_BULLET 100 50 2 -9_BULLET 50 90 1 -12.7_BULLET 200 10 5 -5.56_BULLET 120 50 2 -BAYONET 1500 3 4 -BUTTERFLY 3000 2 2 -FALCHION 500 2 1 -GUT 300 2 2 -KARAMBIT 2000 1 3 \ No newline at end of file diff --git a/sem1/SheinOleg/MiniHomeWork2/miniHomeWork2.1.cpp b/sem1/SheinOleg/MiniHomeWork2/miniHomeWork2.1.cpp deleted file mode 100644 index 28bfbe6a..00000000 --- a/sem1/SheinOleg/MiniHomeWork2/miniHomeWork2.1.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - while (true) - { - long long int number = 0; - std::cout << "Введите число для перевода: "; - std::cin >> number; - if (number >= 0) - { - std::cout << "Число в восьмиричной системе: " << std::oct << number << std::endl; - std::cout << "Число в шестнадцатеричной системе: " << std::hex << number << std::endl << std::endl; - } - else - { - std::cout << "Ошибка. Введите положительное число или 0"; - } - } -} \ No newline at end of file diff --git a/sem1/SheinOleg/MiniHomeWork2/miniHomeWork2.2.cpp b/sem1/SheinOleg/MiniHomeWork2/miniHomeWork2.2.cpp deleted file mode 100644 index d6b9a194..00000000 --- a/sem1/SheinOleg/MiniHomeWork2/miniHomeWork2.2.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "Russian"); - while (true) - { - long long int number = 0; - std::cout << "Введите любое натуральное число для проверки гипотезы Сиракуз: "; - std::cin >> number; - if (number > 0) - { - while (number != 1) - { - if (number % 2 == 0) - { - number /= 2; - } - else - { - number = (number * 3 + 1) / 2; - } - std::cout << number << std::endl; - } - std::cout << "Гипотеза доказана" << std::endl; - } - else - { - std::cout << "Ошибка. Введите положительное число"; - } - } -} \ No newline at end of file diff --git a/sem1/SheinOleg/MiniHomeWork3/MiniHomeWork3.cpp b/sem1/SheinOleg/MiniHomeWork3/MiniHomeWork3.cpp deleted file mode 100644 index 664499a0..00000000 --- a/sem1/SheinOleg/MiniHomeWork3/MiniHomeWork3.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include -#include -#include -#include -#include -#include - -class Item { -public: - std::string name; - double price; - double weight; - std::string uniqueAttribute; - - Item(std::string name, double price, double weight, std::string uniqueAttribute) - : name(name), price(price), weight(weight), uniqueAttribute(uniqueAttribute) {} -}; - -class ShopBase { -public: - void addItem(Item item) {} - - ~ShopBase() {} -}; - -class CustomShop : public ShopBase { -private: - std::string shopName; - std::vector items; - -public: - CustomShop(std::string name) : shopName(name) {} - - void addItem(Item item) { - items.push_back(item); - } - - double calculateAveragePrice() { - double total = std::accumulate(items.begin(), items.end(), 0.0, - [](double sum, Item item) { return sum + item.price; }); - return items.size() == 0 ? 0.0 : total / items.size(); - } - - double calculateAverageWeight() { - double total = std::accumulate(items.begin(), items.end(), 0.0, - [](double sum, Item item) { return sum + item.weight; }); - return items.size() == 0 ? 0.0 : total / items.size(); - } - - void displayAverages() { - std::cout << "Shop: " << shopName << std::endl; - std::cout << "Average Price: " << calculateAveragePrice() << std::endl; - std::cout << "Average Weight: " << calculateAverageWeight() << std::endl << std::endl; - - for (int i = 0; i < items.size(); ++i) { - std::cout << "Item: " << items[i].name << ", Price: " << items[i].price - << ", Weight: " << items[i].weight - << ", Unique Attribute: " << items[i].uniqueAttribute << std::endl; - } - std::cout << std::endl; - } -}; - -std::vector parseShopsFromFile(std::string filename) { - std::ifstream file(filename); - std::vector shops; - std::string line; - - if (!file.is_open()) { - std::cerr << "Error: Could not open file " << filename << std::endl; - return shops; - } - - while (std::getline(file, line)) { - if (line.rfind("Shop", 0) == 0) { - std::string shopName = line.substr(5); - if (shopName.empty()) { - std::cerr << "Error: Missing shop name." << std::endl; - continue; - } - - CustomShop shop(shopName); - - if (!std::getline(file, line) || line.rfind("Items", 0) != 0) { - std::cerr << "Error: Expected 'Items' line after shop name for shop " << shopName << std::endl; - continue; - } - - int itemCount; - try { - itemCount = std::stoi(line.substr(6)); - } - catch (...) { - std::cerr << "Error: Invalid item count for shop " << shopName << std::endl; - continue; - } - - for (int i = 0; i < itemCount; ++i) { - if (!std::getline(file, line)) { - std::cerr << "Error: Unexpected end of file while reading items for shop " << shopName << ".\n"; - break; - } - - std::istringstream itemStream(line); - std::string name, uniqueAttribute; - double price, weight; - - if (!std::getline(itemStream, name, ',')) { - std::cerr << "Error: Missing item name in shop " << shopName << ".\n"; - continue; - } - - if (!(itemStream >> price)) { - std::cerr << "Error: Invalid price for item " << name << " in shop " << shopName << ".\n"; - continue; - } - - itemStream.ignore(1); - - if (!(itemStream >> weight)) { - std::cerr << "Error: Invalid weight for item " << name << " in shop " << shopName << ".\n"; - continue; - } - - itemStream.ignore(1); - - if (!std::getline(itemStream, uniqueAttribute)) { - std::cerr << "Error: Missing unique attribute for item " << name << " in shop " << shopName << ".\n"; - continue; - } - - shop.addItem(Item(name, price, weight, uniqueAttribute)); - } - shops.push_back(shop); - } - else if (!line.empty()) { - std::cerr << "Error: Unrecognized line format: " << line << "\n"; - } - } - return shops; -} - -int main() { - std::string filename = "shops_data.txt"; - std::vector shops = parseShopsFromFile(filename); - - if (shops.empty()) { - std::cerr << "Error: No valid shop data found in file.\n"; - return 1; - } - - for (int i = 0; i < shops.size(); ++i) { - shops[i].displayAverages(); - } - - return 0; -} \ No newline at end of file diff --git a/sem1/SheinOleg/MiniHomeWork3/shops_data.txt b/sem1/SheinOleg/MiniHomeWork3/shops_data.txt deleted file mode 100644 index e6cd7cc7..00000000 --- a/sem1/SheinOleg/MiniHomeWork3/shops_data.txt +++ /dev/null @@ -1,23 +0,0 @@ -Shop Electronics -Items 5 -Laptop, 1000, 2500, game pro super -Monitor, 500, 5000, 144Hz -Keyboard, 100, 500, made in china -Mouse, 50, 150, 4000dpi -Printer, 200, 3000, black - -Shop Groceries -Items 5 -Milk, 3, 1000, almond -Bread, 1, 500, black -Cheese, 5, 300, leaky -Apple, 2, 200, red -Orange, 2, 150, orange - -Shop Clothing -Items 5 -Shirt, 20, 300, cotton 100% -Pants, 25, 600, white -Jacket, 50, 1000, black -Hat, 10, 150, A man bought a hat and it fit him just right -Shoes, 60, 1200, grey \ No newline at end of file diff --git a/sem1/ShuraevGA/MiniHomework1/Task1.cpp b/sem1/ShuraevGA/MiniHomework1/Task1.cpp deleted file mode 100644 index c06d7e94..00000000 --- a/sem1/ShuraevGA/MiniHomework1/Task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - - -int square(int lenght) { - return lenght * lenght; -} - -int main() -{ - int input; - std::cout << "Enter the lenght (>0) "; - std::cin >> input; - std::cout << "The square is " << square(input); -} diff --git a/sem1/ShuraevGA/MiniHomework1/Task2.cpp b/sem1/ShuraevGA/MiniHomework1/Task2.cpp deleted file mode 100644 index 910b0a8f..00000000 --- a/sem1/ShuraevGA/MiniHomework1/Task2.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - - -float trapezoid(int TopSide, int DownSide, int H ) { - return (TopSide + DownSide) * H/2; -} - -int main() -{ - int InputTop; - int InputDown; - int InputH; - std::cout << "Enter the lenght of the top side of trapezoid (>0) "; - std::cin >> InputTop; - std::cout << "Enter the lenght of the down side of trapezoid (>0) "; - std::cin >> InputDown; - std::cout << "Enter the lenght of the Height of trapezoid (>0) "; - std::cin >> InputH; - std::cout << "The Area of trapezoid is " << trapezoid(InputTop, InputDown, InputH); -} \ No newline at end of file diff --git a/sem1/ShuraevGA/MiniHomework1/Task3.cpp b/sem1/ShuraevGA/MiniHomework1/Task3.cpp deleted file mode 100644 index b631bfb9..00000000 --- a/sem1/ShuraevGA/MiniHomework1/Task3.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - - -long int Fibo(int N) { - if ((N == 1) or (N == 2)) { - return 1; - } - if(N > 2) { - return Fibo(N - 1) + Fibo(N - 2); - } -} - -int main() { - int InputN; - std::cout << "Enter the number of Fibonacci element (>0) "; - std::cin >> InputN; - std::cout << "Your element = " << Fibo(InputN); -} diff --git a/sem1/ShuraevGA/MiniHomework1/Task4.cpp b/sem1/ShuraevGA/MiniHomework1/Task4.cpp deleted file mode 100644 index 2af9fc85..00000000 --- a/sem1/ShuraevGA/MiniHomework1/Task4.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - - -int main() -{ - int old; - int NewNum = 0; - std::cout << "Enter your number to ~reverse~ "; - std::cin >> old; - while (old != 0) { - NewNum = (NewNum * 10) + old % 10; - old /= 10; - } - std::cout << "Reverse completed! Now your number is " << NewNum; -} diff --git a/sem1/ShuraevGA/MiniHomework2/Task1.1.cpp b/sem1/ShuraevGA/MiniHomework2/Task1.1.cpp deleted file mode 100644 index 0570b4a9..00000000 --- a/sem1/ShuraevGA/MiniHomework2/Task1.1.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int OldNum; -int NewNumReverse = 0; -int NewNum = 0; -int Remain = 0; -int Remain2 = 0; - -int main() { - std::cout << "Enter your number "; - std::cin >> OldNum; - while (OldNum != 0) { - Remain = OldNum % 8; - NewNumReverse = NewNumReverse * 10 + Remain; //перевод числа в восьмеричку, но оно "переворачивается", как в минидомашке1 - OldNum /= 8; - } - while (NewNumReverse != 0) - { - Remain2 = NewNumReverse % 10; - NewNum = NewNum * 10 + Remain2; //собственно,обратный переворот без изменения цифр,а значит,система счисления остается восьмеричной - NewNumReverse /= 10; - } - std::cout << "Now your number by 8 numerical basis = " << NewNum; -} \ No newline at end of file diff --git a/sem1/ShuraevGA/MiniHomework2/Task1.2.cpp b/sem1/ShuraevGA/MiniHomework2/Task1.2.cpp deleted file mode 100644 index bfffa7c6..00000000 --- a/sem1/ShuraevGA/MiniHomework2/Task1.2.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include - - -std::string NewNum(""); -int OldNum = 0; -int Bufer = 0; - -int main() { - std::cout << "Enter your number "; - std::cin >> OldNum; - while (OldNum != 0) { - Bufer = OldNum % 16; - OldNum /= 16; - switch (Bufer) { - case 0: - (NewNum = "0" + NewNum); - break; - case 1: - (NewNum = "1" + NewNum); - break; - case 2: - (NewNum = "2" + NewNum); - break; - case 3: - (NewNum = "3" + NewNum); - break; - case 4: - (NewNum = "4" + NewNum); - break; - case 5: - (NewNum = "5" + NewNum); - break; - case 6: - (NewNum = "6" + NewNum); - break; - case 7: - (NewNum = "7" + NewNum); - break; - case 8: - (NewNum = "8" + NewNum); - break; - case 9: - (NewNum = "9" + NewNum); - break; - case 10: - (NewNum = "A" + NewNum); - break; - case 11: - (NewNum = "B" + NewNum); - break; - case 12: - (NewNum = "C" + NewNum); - break; - case 13: - (NewNum = "D" + NewNum); - break; - case 14: - (NewNum = "E" + NewNum); - break; - case 15: - (NewNum = "F" + NewNum); - break; - }//чуть безумный вариант,сам не очень разобрался как работают - //варианты с чаром и решил в тупую с инета не копировать, - //больше такого ужаса не сделаю,надеюсь - } - std::cout << "Now your number by 16 numerical basis = " << NewNum; -} \ No newline at end of file diff --git a/sem1/ShuraevGA/MiniHomework2/Task2.cpp b/sem1/ShuraevGA/MiniHomework2/Task2.cpp deleted file mode 100644 index 33461ec6..00000000 --- a/sem1/ShuraevGA/MiniHomework2/Task2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - - -long SirNum; - -int main() -{ - std::cout << "Lets try Syracuse hypothesis. Enter you number "; - std::cin >> SirNum; - std::cout << "We will act according to the algorithm and show the value after each iteration" << "\n"; - int SirNumEter = SirNum; - while (SirNumEter != 1) - { - if (SirNumEter % 2 == 0) - { - std::cout << SirNumEter << "/2 = "; - SirNumEter = SirNumEter / 2; - std::cout << SirNumEter << "\n"; - } - else - { - std::cout << "((" << SirNumEter << " * 3)+ 1) / 2 = "; - SirNumEter = ((SirNumEter * 3) + 1) / 2; - std::cout << SirNumEter << "\n"; - } - } - std::cout << "Finally we have 1"; -} \ No newline at end of file diff --git a/sem1/ShustermanSergey/MiniHomework2/Task 1.cpp b/sem1/ShustermanSergey/MiniHomework2/Task 1.cpp deleted file mode 100644 index b84e25c0..00000000 --- a/sem1/ShustermanSergey/MiniHomework2/Task 1.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include - - -std::string ToSixteen(long long int decimal) { // Переводит число в шестнадцатиричную сс - std::string new_number = ""; - char nums[16] = { '0', '1', '2', '3' ,'4' , '5', '6' ,'7' , '8' ,'9', 'A', 'B' , 'C' , 'D', 'E', 'F' }; - if (decimal == 0) { - return "0"; - } - while (decimal > 0) { - new_number = nums[decimal % 16] + new_number; - decimal /= 16; - } - return new_number; -} - -std::string ToEight(long long int decimal) { // Переводит число в восьмеричную сс - std::string new_number = ""; - char nums[8] = { '0', '1', '2', '3' ,'4' , '5', '6' ,'7' }; - if (decimal == 0) { - return "0"; - } - while (decimal > 0) { - new_number = nums[decimal % 8] + new_number; - decimal /= 8; - } - return new_number; -} - -int main(){ - long long int decimal_number = 0; // Число в десятичной сс, которое может быть очень большим - int base = 0; // сс в которую переведёт прога - std::string answer = ""; - while (decimal_number == 0) { // Проверяет изменилось ли число после ввода. Если нет то ввод надо повторить - std::cout << "Enter your decimal number (not higher than 10^18): "; - std::cin >> decimal_number; - // Защита от "дурака" - if (!std::cin) { // Если ввод не удался (по каким-то причинам) - std::cin.clear(); // Мы сбрасываем поле для ввода - std::cin.ignore(std::numeric_limits::max(), '\n'); // Мы вычёркиваем полученные данные дабы они не навернули программу. - } - } - while (base != 8 and base != 16) { - std::cout << "Now, enter base you would like to convert your number in (8 or 16): "; - std::cin >> base; - // Защита от "дурака" - if (!std::cin) { // Если ввод не удался (по каким-то причинам) - std::cin.clear(); // Мы сбрасываем поле для ввода - std::cin.ignore(std::numeric_limits::max(), '\n'); // Мы вычёркиваем полученные данные дабы они не навернули программу. - } - if (base == 8) { - answer = ToEight(decimal_number); - } - if (base == 16) { - answer = ToSixteen(decimal_number); - } - } - std::cout << "The number " << decimal_number << " in " << base << " numeral system is: " << answer << std::endl; - return 0; -} \ No newline at end of file diff --git a/sem1/ShustermanSergey/MiniHomework2/Task 2.cpp b/sem1/ShustermanSergey/MiniHomework2/Task 2.cpp deleted file mode 100644 index ab7781fd..00000000 --- a/sem1/ShustermanSergey/MiniHomework2/Task 2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -int Sirokuz(int x) { - while (x != 1) { - if (x % 2 == 0) { - x /= 2; - std::cout << x << std::endl; - } - else { - x = ((x * 3) + 1) / 2; - std::cout << x << std::endl; - } - - } - return x; -} - -int main() { - long long int input_num = 0; - while (input_num == 0 or input_num < 0) { - std::cout << "Input any NATURAL nmber and I will turn it into 1 via mathematical magic: "; - std::cin >> input_num; - if (!std::cin) { // - std::cin.clear(); - std::cin.ignore(std::numeric_limits::max(), '\n'); - } - } - Sirokuz(input_num); - std::cout << "TA-DA!" << std::endl; - return 0; -} \ No newline at end of file diff --git a/sem1/SkovpenArseniy/MiniHomeWork1/task 1.cpp b/sem1/SkovpenArseniy/MiniHomeWork1/task 1.cpp deleted file mode 100644 index 40915805..00000000 --- a/sem1/SkovpenArseniy/MiniHomeWork1/task 1.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "RU"); - int side, square; - std::cout << "Введите сторону квадрата:"; - std::cin >> side; - square= pow(side, 2); - std::cout << "Площадь равна : " << square; - - - - return 0; -} - - diff --git a/sem1/SkovpenArseniy/MiniHomeWork1/task 2.cpp b/sem1/SkovpenArseniy/MiniHomeWork1/task 2.cpp deleted file mode 100644 index 4e063b00..00000000 --- a/sem1/SkovpenArseniy/MiniHomeWork1/task 2.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "RU"); - int a, b, h, square; - std::cout << "Введите наименьшее основание трапеции:"; - std::cin >> a; - std::cout << "Введите наибольшее основание трапеции:"; - std::cin >> b; - std::cout << "Введите высоту трапеции:"; - std::cin >> h; - square = ((a + b) / 2) * h; - std::cout << "Площадь равна : " << square; - - return 0; -} \ No newline at end of file diff --git a/sem1/SkovpenArseniy/MiniHomeWork1/task 3.cpp b/sem1/SkovpenArseniy/MiniHomeWork1/task 3.cpp deleted file mode 100644 index ce466ab0..00000000 --- a/sem1/SkovpenArseniy/MiniHomeWork1/task 3.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int main() -{ - setlocale(LC_ALL, "RU"); - int n=0,i=0,a=0,b=1,c=0; - std::cout << "Введите количетво чисел Фибоначчи:"; - std::cin >> n; - while (i < n) { - a = b; - b = c; - c = a + b; - std:: cout << c << " "; - i++; - - } - return 0; -} - diff --git a/sem1/SkovpenArseniy/MiniHomeWork1/task 4.cpp b/sem1/SkovpenArseniy/MiniHomeWork1/task 4.cpp deleted file mode 100644 index 7a9926e0..00000000 --- a/sem1/SkovpenArseniy/MiniHomeWork1/task 4.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main() { - setlocale(LC_ALL, "RU"); - int num, reverse_num=0; - std::cout << "Введите число:"; - std::cin >> num; - while (num > 0) - { - reverse_num = reverse_num*10 + num % 10; - num /= 10; - - } - std::cout <<"Перевернутое число:"<< reverse_num; - - return 0; -} diff --git a/sem1/SmolinMichael/MiniHM 3/Task1.cpp b/sem1/SmolinMichael/MiniHM 3/Task1.cpp deleted file mode 100644 index bb79db38..00000000 --- a/sem1/SmolinMichael/MiniHM 3/Task1.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include -#include -#include -#include - - -class ItemBase { -public: - std::string name; - int price; - int weight; - - virtual void parse(std::string s) { - - } -}; - -class Food : public ItemBase { -public: - int calories; - void parse(std::string s) { - std::string tmp = ""; - std::vector tokens; - for (auto el : s) { - if (el == ' ') { - tokens.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - tokens.push_back(tmp); - name = tokens[0]; - price = stoi(tokens[1]); - calories = stoi(tokens[2]); - weight = stoi(tokens[3]); - } -}; - -class Tech : public ItemBase { -public: - int consumption; - void parse(std::string s) { - std::string tmp = ""; - std::vector tokens; - for (auto el : s) { - if (el == ' ') { - tokens.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - tokens.push_back(tmp); - name = tokens[0]; - price = stoi(tokens[1]); - consumption = stoi(tokens[2]); - weight = stoi(tokens[3]); - } -}; - -class Wires : public ItemBase { -public: - int length; - void parse(std::string s) { - std::string tmp = ""; - std::vector tokens; - for (auto el : s) { - if (el == ' ') { - tokens.push_back(tmp); - tmp = ""; - } - else - tmp += el; - } - tokens.push_back(tmp); - name = tokens[0]; - price = stoi(tokens[1]); - length = stoi(tokens[2]); - weight = stoi(tokens[3]); - } -}; - -class Shop { -public: - std::vector items; - - int getAveragePrice() { - int result = 0; - if (items.empty()) - return 0; - for (auto item : items) - result += item.price; - return result / items.size(); - } - int getAverageWeight() { - int result = 0; - if (items.empty()) - return 0; - for (auto item : items) - result += item.weight; - return result / items.size(); - } -}; - - - -int main() { - Shop tech, wires, food; - std::ifstream in; - in.open("info.txt"); - std::string line; - for (int i = 0; i < 5; ++i) { - getline(in, line); - Tech item; - item.parse(line); - tech.items.push_back(item); - } - for (int i = 0; i < 5; ++i) { - getline(in, line); - Food item; - item.parse(line); - food.items.push_back(item); - } - for (int i = 0; i < 5; ++i) { - getline(in, line); - Wires item; - item.parse(line); - wires.items.push_back(item); - } - - while (true) { - int com; - std::cout << "Which store you want to get information about?\n"; - std::cout << "1) tech store \n"; - std::cout << "2) convenience store \n"; - std::cout << "3) wire store \n"; - std::cin >> com; - switch (com) { - case 1: - std::cout << "Average price in the store: " << tech.getAveragePrice() << '\n'; - std::cout << "Average weight in the store " << tech.getAverageWeight() << '\n'; - break; - case 2: - std::cout << "Average price in the convenience store: " << food.getAveragePrice() << '\n'; - std::cout << "Average weight in the convenience store: " << food.getAverageWeight() << '\n'; - break; - case 3: - std::cout << "Average price in the wire store: " << wires.getAveragePrice() << '\n'; - std::cout << "Average weight in the wire store: " << wires.getAverageWeight() << '\n'; - break; - } - std::cout << "\n\n"; - } -} \ No newline at end of file diff --git a/sem1/SmolinMichael/MiniHM 3/info.txt b/sem1/SmolinMichael/MiniHM 3/info.txt deleted file mode 100644 index dff6023a..00000000 --- a/sem1/SmolinMichael/MiniHM 3/info.txt +++ /dev/null @@ -1,15 +0,0 @@ -RTX3060 50000 100 2 -RTX4090 200000 150 3 -Iphone18ProMax 9999999 300 4 -XiaomiPlusMaxSuperLiteUltra 100 10 25 -Iron 500 500 1 -Crisps 150 50 2 -Tomatoes 100 80 3 -Potatoes 100 90 4 -Cola 80 200 1 -Fanta 100 220 2 -M60 200 300 412 -X5 3000 400 4251 -X3 100 250 51254 -M5 4000 500 24124 -M3 1000 100 51245 \ No newline at end of file diff --git a/sem1/SomkinFyodorDmitrievich/MiniHomework3/MiniHomework3.cpp b/sem1/SomkinFyodorDmitrievich/MiniHomework3/MiniHomework3.cpp deleted file mode 100644 index 1e538e36..00000000 --- a/sem1/SomkinFyodorDmitrievich/MiniHomework3/MiniHomework3.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include -#include -#include - -class ItemBase { -public: - std::string NameItem = "RTX6090"; - int Weight = 5; - int Count = 3; - ItemBase() {} - ~ItemBase() {} - ItemBase(std::string NameItem_, int Weight_, int Count_) { - NameItem = NameItem_; - Weight = Weight_; - Count = Count_; - } - void Info() { - std::cout << NameItem << " " << Weight << " " << Count << "\n"; - } -}; - -class Item : public ItemBase { -private: -public: - Item() { - } - ~Item() { - } - - Item(std::string NameItem_, int Weight_, int Count_) { - NameItem = NameItem_; - Weight = Weight_; - Count = Count_; - } - void SetAll(std::string NameItem_, int Weight_, int Count_) { - NameItem = NameItem_; - Weight = Weight_; - Count = Count_; - } - void inf() { - Info(); - } - int GetWeight() { - return Weight; - } - int GetCount() { - return Count; - } -}; - -class ShopBase { -private: - int ItemsCount; - std::string ShopName = "Shop"; - std::vector Shop; -public: - ShopBase() { - } - ~ShopBase() { - } - ShopBase(std::string Shop_, int ItemsCount_) { - ShopName = Shop_; - ItemsCount = ItemsCount_; - Shop.resize(ItemsCount); - } - void Info() { - std::cout << ShopName << " " << ItemsCount << "\n"; - } - void InfoShop() { - for (int i = 0; i < ItemsCount; i++) { - Shop[i].Info(); - } - } - double midlCount() { - double Midl = 0, count = ItemsCount; - for (int i = 0; i < ItemsCount; i++) { - Midl += Shop[i].GetCount(); - } - Midl = Midl / count; - return Midl; - } - double midlWeight() { - double Midl = 0, count = ItemsCount; - for (int i = 0; i < ItemsCount; i++) { - Midl += Shop[i].GetWeight(); - } - Midl = Midl / count; - return Midl; - } - std::vector GetVector() { - return Shop; - } - void Push_back(Item item, int i) { - Shop[i] = item; - } - -}; - -int main() -{ - /*std::ofstream out; - out.open("ShopBase.txt", std::ios::app); - std::string line; - for (int i = 0; i < 21; i++) { - getline(std::cin, line); - if (out.is_open()) { - out << line << "\n"; - } - } - out.close();*/ - int countShop; - std::string ShopName; - int CountItems; - std::vector ShopBases; - int count, f, g, j = 1; - std::ifstream in("ShopBase.txt"); - if (in.is_open()) { - std::string ShopName, fg; - while (in >> ShopName) { - in >> fg; - in >> count; - ShopBase Shop(ShopName, count); - for (int k = 0; k < count; k++) { - std::string ItemName; - int countItem, Weight; - in >> ItemName >> countItem >> Weight; - Item item; - item.SetAll(ItemName, Weight, countItem); - Shop.Push_back(item, k); - } - - ShopBases.push_back(Shop); - j++; - } - } - for (int i = 0; i < j - 1; i++) { - ShopBases[i].Info(); - ShopBases[i].InfoShop(); - std::cout << ShopBases[i].midlCount() << "\n"; - std::cout << ShopBases[i].midlWeight() << "\n"; - std::cout << "\n"; - } - in.close(); -} \ No newline at end of file diff --git a/sem1/SomkinFyodorDmitrievich/MiniHomework3/ShopBase.txt b/sem1/SomkinFyodorDmitrievich/MiniHomework3/ShopBase.txt deleted file mode 100644 index a3b84c0b..00000000 --- a/sem1/SomkinFyodorDmitrievich/MiniHomework3/ShopBase.txt +++ /dev/null @@ -1,21 +0,0 @@ -Sitilink -items 5 -RTX_3060 360 110 -RTX_3070 370 120 -RTX_3080 380 130 -RTX_4060 460 140 -RTX_4070 470 150 -MVideo -items 5 -RX_460 270 100 -RX_470 280 110 -RX_480 290 120 -RX_560 300 130 -RX_570 310 140 -Yandex -items 5 -Intel_5_12400 250 80 -Intel_5_11400 230 70 -Intel_5_13400 270 80 -Intel_5_13600 280 90 -Intel_5_11600 240 90 diff --git a/sem1/SopkovaMargarita/MiniHomeWork1/task1.cpp b/sem1/SopkovaMargarita/MiniHomeWork1/task1.cpp deleted file mode 100644 index b321ee1a..00000000 --- a/sem1/SopkovaMargarita/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int square(int si) { - return si * si; -} - -int main(){ - std::cout << "Enter squares side"; - int side = 0; - std::cin >> side; - std::cout << "Area of ​​the square:"; - std::cout << square(side); - return 0; -} \ No newline at end of file diff --git a/sem1/SopkovaMargarita/MiniHomeWork1/task2.cpp b/sem1/SopkovaMargarita/MiniHomeWork1/task2.cpp deleted file mode 100644 index 4fec5c81..00000000 --- a/sem1/SopkovaMargarita/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int trapecia(int a, int b, int h) { - return (a + b) * h / 2; -} - -int main() { - int side_a = 0; - int side_b = 0; - int high = 0; - std::cout << "Enter Trapezoid sides and high"; - std::cin >> side_a; - std::cin >> side_b; - std::cin >> high; - std::cout << "Area of the trapezoid:"; - std::cout << trapecia(side_a, side_b, high); - return 0; -} diff --git a/sem1/SopkovaMargarita/MiniHomeWork1/task3.cpp b/sem1/SopkovaMargarita/MiniHomeWork1/task3.cpp deleted file mode 100644 index 7ada975c..00000000 --- a/sem1/SopkovaMargarita/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -int main() { - int N = 0; - int counter = 0; - int number1 = 0; - int number2 = 1; - int temporary = 0; - std::cout << "Enter the number"; - std::cin >> N; - while (true) { - if (N > counter and counter > 0) { - counter++; - std::cout << number1 + number2 << " "; - temporary = number1; - number1 = number2; - number2 = number1 + temporary; - } - if (counter == 0) { - counter++; - std::cout << "0 "; - } - if (N < counter) { - return 0; - } - } - return 0; -} - diff --git a/sem1/SopkovaMargarita/MiniHomeWork1/task4.cpp b/sem1/SopkovaMargarita/MiniHomeWork1/task4.cpp deleted file mode 100644 index 95f52300..00000000 --- a/sem1/SopkovaMargarita/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() { - int number = 0; - std::cout << "Enter number "; - std::cin >> number; - while (number != 0) { - std::cout << number % 10; - number /= 10; - } - return 0; -} diff --git a/sem1/SopkovaMargarita/minihw2/1.cpp b/sem1/SopkovaMargarita/minihw2/1.cpp deleted file mode 100644 index ad08f4fa..00000000 --- a/sem1/SopkovaMargarita/minihw2/1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -void transformation (int user_number) { - std::cout << "hexadecimal base: " << std::hex << user_number << std::endl; - std::cout << "octal base: " << std::oct << user_number << std::endl; -} - -int main() -{ - int user_number; - std::cout << "Enter the number" << std::endl; - std::cin >> user_number; - transformation (user_number); - return 0; -} \ No newline at end of file diff --git a/sem1/SopkovaMargarita/minihw2/2.cpp b/sem1/SopkovaMargarita/minihw2/2.cpp deleted file mode 100644 index 94c66476..00000000 --- a/sem1/SopkovaMargarita/minihw2/2.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include - -int Sirakuz(int user_number) { - int temporary; - temporary = user_number; - std::set previous_numbers; - while (temporary != 1 or previous_numbers.find(temporary) == previous_numbers.end()) { - previous_numbers.insert(temporary); - if (temporary % 2 == 0) { - temporary = temporary / 2; - } - else { - temporary = (temporary * 3 + 1) / 2; - } - } - if (temporary == 1) { - return 1; - } - else - { - return 0; - } -} - -int main() -{ - int user_number; - std::cout << "Enter the number" << std::endl; - std::cin >> user_number; - if (Sirakuz(user_number) == 1) { - std::cout << "Theory is true" << std::endl; - } - else - { - std::cout << "Theory is false" << std::endl; - } - -} - diff --git a/sem1/SviridovVA/MiniHomeWork1/CalculateFibonacci.cpp b/sem1/SviridovVA/MiniHomeWork1/CalculateFibonacci.cpp deleted file mode 100644 index 6582d966..00000000 --- a/sem1/SviridovVA/MiniHomeWork1/CalculateFibonacci.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -std::vector CalculateFibonacci(int N) { - if (N <= 0) {return {};}; - if (N == 1) {return {0};} - - std::vector fibonacci_array = {0, 1}; - - for(int i = 2; i < N; ++i) { - fibonacci_array.push_back(fibonacci_array[i - 2] + fibonacci_array[i - 1]); - } - - return fibonacci_array; -} - -void print(const std::vector& array) { - for (int i : array) { - std::cout << i << ' '; - } -} - -int main() { - int N; std::cin >> N; - - print(CalculateFibonacci(N)); -} diff --git a/sem1/SviridovVA/MiniHomeWork1/CalculateSquareArea.cpp b/sem1/SviridovVA/MiniHomeWork1/CalculateSquareArea.cpp deleted file mode 100644 index 8ccf441e..00000000 --- a/sem1/SviridovVA/MiniHomeWork1/CalculateSquareArea.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int CalculateSquareArea(int square_side_length) { - if (square_side_length < 0) {return -1;} - - return square_side_length * square_side_length; -} - -void Test(){ - assert(CalculateSquareArea(0) == 0); - assert(CalculateSquareArea(5) == 25); - assert(CalculateSquareArea(-5) == -1); -} - -int main() { - Test(); -} diff --git a/sem1/SviridovVA/MiniHomeWork1/CalculateTrapezoidArea.cpp b/sem1/SviridovVA/MiniHomeWork1/CalculateTrapezoidArea.cpp deleted file mode 100644 index 805307bf..00000000 --- a/sem1/SviridovVA/MiniHomeWork1/CalculateTrapezoidArea.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -double CalculateTrapezoidArea(int a, int b, int h) { - if (a < 0 || b < 0 || h < 0) {return -1;} - - return ((a + b) / 2.0) * h; -} - -void Test() { - assert(CalculateTrapezoidArea(2, 4, 7) == 21); - assert(CalculateTrapezoidArea(-1, -1, -1) == -1); - assert(CalculateTrapezoidArea(2, 4, 0) == 0); -} - -int main() { - Test(); -} \ No newline at end of file diff --git a/sem1/SviridovVA/MiniHomeWork1/ReverseNumber.cpp b/sem1/SviridovVA/MiniHomeWork1/ReverseNumber.cpp deleted file mode 100644 index 7db082f9..00000000 --- a/sem1/SviridovVA/MiniHomeWork1/ReverseNumber.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int ReverseNumber(int number) { - int reverse_number = 0; - - while (number > 0) { - reverse_number = reverse_number * 10 + number % 10; - number /= 10; - } - - return reverse_number; -} - -void Test() { - assert(ReverseNumber(1234) == 4321); - assert(ReverseNumber(1002) == 2001); - assert(ReverseNumber(2000) == 2); -} - -int main() { - Test(); -} diff --git a/sem1/SviridovVA/MiniHomeWork2/CheckSyracuseHypothesis.cpp b/sem1/SviridovVA/MiniHomeWork2/CheckSyracuseHypothesis.cpp deleted file mode 100644 index 2fac0c9c..00000000 --- a/sem1/SviridovVA/MiniHomeWork2/CheckSyracuseHypothesis.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include - -bool CheckSyracuseHypothesis(int number) { - const auto start{std::chrono::steady_clock::now()}; - - while (number != 1) { - const std::chrono::duration elapsed_seconds{std::chrono::steady_clock::now() - start}; - - if (elapsed_seconds.count() > 5) {return false;} - - number = (number % 2 == 0) ? (number / 2) : (((number * 3) + 1) / 2); - } - - return true; -} - - -void Test(int number) { - if (number <= 0) { - std::cout << "Incorrect number " << '\n'; - return; - } - - if (CheckSyracuseHypothesis(number)) { - std::cout << "The hypothesis is CORRECT for " << number << '\n'; - } else { - std::cout << "The hypothesis is INCORRECT for " << number << '\n'; - } -} - -void Test(int begin, int end) { - if (begin <= 0 || end <= 0 || (begin > end)) { - std::cout << "Incorrect number range" << '\n'; - return; - } - - for (int number = begin; number <= end; ++number) { - if (CheckSyracuseHypothesis(number)) { - std::cout << "The hypothesis is CORRECT for " << number << '\n'; - } else { - std::cout << "The hypothesis is INCORRECT for " << number << '\n'; - } - } -} - -int main() { - Test(1000000); - Test(1, 10000); -} diff --git a/sem1/SviridovVA/MiniHomeWork2/ConvertDecimalNumber.cpp b/sem1/SviridovVA/MiniHomeWork2/ConvertDecimalNumber.cpp deleted file mode 100644 index 8402499c..00000000 --- a/sem1/SviridovVA/MiniHomeWork2/ConvertDecimalNumber.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include - -std::string ConvertDecimalNumber(int decimal_number, const int radix) { - std::string result; - - if (decimal_number < 0 || radix < 2 || radix > 16) {return result;} - - while(decimal_number > 0) { - const int remainder = decimal_number % radix; - result = ((remainder < 10) ? char('0' + remainder) : char('A' + (remainder - 10))) + result; - decimal_number /= radix; - } - - return result; -} - -void Test() { - assert(ConvertDecimalNumber(670, 8) == "1236"); - assert(ConvertDecimalNumber(144, 8) == "220"); - assert(ConvertDecimalNumber(47, 8) == "57"); - - assert(ConvertDecimalNumber(619, 16) == "26B"); - assert(ConvertDecimalNumber(934, 16) == "3A6"); - assert(ConvertDecimalNumber(9999, 16) == "270F"); - - assert(ConvertDecimalNumber(-1, 16).empty()); - assert(ConvertDecimalNumber(229, 1).empty()); - assert(ConvertDecimalNumber(112, 17).empty()); -} - -int main() { - Test(); -} \ No newline at end of file diff --git a/sem1/TeploukhovNikita/MiniHomeWork1/task1.cpp b/sem1/TeploukhovNikita/MiniHomeWork1/task1.cpp deleted file mode 100644 index 412136f1..00000000 --- a/sem1/TeploukhovNikita/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int sqr_side; - -int count_sqr_area(int side); - -int main() -{ - std::cout << "Square area calculation" << std::endl; - std::cout << "Enter square side: "; - std::cin >> sqr_side; - std::cout << "Area of square: " << count_sqr_area(sqr_side); - - return 0; -} - -int count_sqr_area(int side) -{ - return side * side; -} \ No newline at end of file diff --git a/sem1/TeploukhovNikita/MiniHomeWork1/task2.cpp b/sem1/TeploukhovNikita/MiniHomeWork1/task2.cpp deleted file mode 100644 index 071ee735..00000000 --- a/sem1/TeploukhovNikita/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int base1, base2, height; - -int count_trapezium_area(int b1, int b2, int h) -{ - return 0.5 * (b1 + b2) * h; -} - -int main() -{ - std::cout << "Trapezium area calculation" << std::endl; - std::cout << "Enter first trapezium base: "; - std::cin >> base1; - std::cout << "Enter second trapezium base: "; - std::cin >> base2; - std::cout << "Enter trapezium height: "; - std::cin >> height; - std::cout << "Area of trapezium: " << count_trapezium_area(base1, base2, height); - - return 0; -} diff --git a/sem1/TeploukhovNikita/MiniHomeWork1/task3.cpp b/sem1/TeploukhovNikita/MiniHomeWork1/task3.cpp deleted file mode 100644 index 047dfa89..00000000 --- a/sem1/TeploukhovNikita/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include - -int nums_amount; - - -int main() -{ - std::cout << "Fibonacci sequence output \nEnter number of Fibonacci numbers: "; - std::cin >> nums_amount; - std::cout << "Your sequence: " << std::endl; - - - if (nums_amount > 1 or nums_amount < -1) { - std::cout << 0 << std::endl << 1 << std::endl; - } - else if(nums_amount != 0) { - std::cout << 0; - } - else { - std::cout << "Nothing here...\n"; - } - - - if (nums_amount > 1) { - int num1 = 0; - int num2 = 1; - - while (nums_amount > 2) { - int summ = num2 + num1; - std::cout << summ << std::endl; - num1 = num2; - num2 = summ; - - nums_amount -= 1; - } - } - - else if(nums_amount < -1) { - int num1 = 1; - int num2 = 0; - - while (nums_amount < -2) { - int def = num2 - num1; - std::cout << def << std::endl; - num2 = num1; - num1 = def; - - nums_amount += 1; - } - } - - return 0; -} diff --git a/sem1/TeploukhovNikita/MiniHomeWork1/task4.cpp b/sem1/TeploukhovNikita/MiniHomeWork1/task4.cpp deleted file mode 100644 index 6ee9d9a2..00000000 --- a/sem1/TeploukhovNikita/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int main() -{ - int num; - int revd_num = 0; - - std::cout << "Number reverse\nEnter your number: "; - std::cin >> num; - std::cout << "Reversed number: "; - - while (num != 0) { - revd_num += num % 10; - num -= num % 10; - num /= 10; - if (num != 0) { - revd_num *= 10; - } - } - - std::cout << revd_num << std::endl; - - return 0; -} diff --git a/sem1/TeploukhovNikita/MiniHomework2/2.1.cpp b/sem1/TeploukhovNikita/MiniHomework2/2.1.cpp deleted file mode 100644 index 7205f263..00000000 --- a/sem1/TeploukhovNikita/MiniHomework2/2.1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int num_input = 0; - -int main() -{ - std::cout << "Converting your decimal to octal and hex" << std::endl; - std::cout << "Enter your decimal number: "; - std::cin >> num_input; - std::cout << "Your number in octal: " << std::oct << num_input << std::endl; - std::cout << "Your number in hex: " << std::hex << num_input << std::endl; -} \ No newline at end of file diff --git a/sem1/TeploukhovNikita/MiniHomework2/2.2.cpp b/sem1/TeploukhovNikita/MiniHomework2/2.2.cpp deleted file mode 100644 index 3a4a060d..00000000 --- a/sem1/TeploukhovNikita/MiniHomework2/2.2.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -int num; - -void check(); - -int main() -{ - std::cout << "Let's check Syracuse hypothesis: any your number must be converted to 1" << std::endl; - std::cout << "Enter your number: "; - std::cin >> num; - while (num != 1){ - check(); - } -} - -void check() { - if (num % 2 == 0) { - num /= 2; - std::cout << num << std::endl; - } - else { - num *= 3; - num += 1; - num /= 2; - std::cout << num << std::endl; - } - -} \ No newline at end of file diff --git a/sem1/TrepovMK/MiniHomeWork1/task1.cpp b/sem1/TrepovMK/MiniHomeWork1/task1.cpp deleted file mode 100644 index 59425965..00000000 --- a/sem1/TrepovMK/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -void sqr_area() -{ - int sqr_side; - std::cout << "Enter square side"; - std::cin >> sqr_side; - std::cout << "Square area: " << sqr_side * sqr_side; -} -int main() -{ - sqr_area(); - return 0; -} diff --git a/sem1/TrepovMK/MiniHomeWork1/task2.cpp b/sem1/TrepovMK/MiniHomeWork1/task2.cpp deleted file mode 100644 index 67e525ae..00000000 --- a/sem1/TrepovMK/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -void trp_area() -{ - int trp_lside; - int trp_uside; - int trp_h; - std::cout << "Enter lower side of trapezoid"; - std::cin >> trp_lside; - std::cout << "Enter upper side of trapezoid"; - std::cin >> trp_uside; - std::cout << "Enter trapezoid heigh"; - std::cin >> trp_h; - std::cout << "Trapezoid area: " << float((trp_lside + trp_uside)*trp_h)/2; -} -int main() -{ - trp_area(); - return 0; -} diff --git a/sem1/TrepovMK/MiniHomeWork1/task3.cpp b/sem1/TrepovMK/MiniHomeWork1/task3.cpp deleted file mode 100644 index 486edc90..00000000 --- a/sem1/TrepovMK/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int main() -{ - int num; - int x = 1; - int n; - int y = 0; - std::cout << "Enter number of Fibonacсi numbers"; - std::cin >> num; - for (int i = 0; i < num; i++) - { - if (i == 0) - { - std::cout << " " << x; - } - else - { - std::cout << " " << x + y; - n = x; - x = x + y; - y = n; - } - - - } -} diff --git a/sem1/TrepovMK/MiniHomeWork1/task4.cpp b/sem1/TrepovMK/MiniHomeWork1/task4.cpp deleted file mode 100644 index 073f6715..00000000 --- a/sem1/TrepovMK/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - int num; - std::cout << "Enter number to reverse"; - std::cin >> num; - for (;num > 0;num = num / 10) - { - std::cout << num % 10; - } -} diff --git a/sem1/TrepovMK/MiniHomeWork2/task1.cpp b/sem1/TrepovMK/MiniHomeWork2/task1.cpp deleted file mode 100644 index 6998f164..00000000 --- a/sem1/TrepovMK/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main() -{ - int i; - std::cout << "Enter the number. The first number will be in octal system and second number will be in hexadecimal system "; - std::cin >> i; - std::cout << std::oct << i << std::endl; - std::cout << std::hex << i; -} diff --git a/sem1/TrepovMK/MiniHomeWork2/task2.cpp b/sem1/TrepovMK/MiniHomeWork2/task2.cpp deleted file mode 100644 index 732f90c5..00000000 --- a/sem1/TrepovMK/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -#include - -int main() -{ - int i; - std::cout << "Enter any natural number. Аccording to the Syracuse hypothesis, the result should be 1 "<< std::endl; - std::cin >> i; - while(i!=1) - { - if (i % 2 == 0) - { - std::cout << i << " / 2 = " << i / 2 << std:: endl; - i = i / 2; - - } - else - { - std::cout << '(' << i << " * 3 + 1 ) /2 = " << (i * 3 + 1) / 2 << std::endl; - i = (i * 3 + 1) / 2; - } - } - std::cout << i; -} diff --git a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task1.cpp b/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task1.cpp deleted file mode 100644 index d551b478..00000000 --- a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -//float type just in case -float squareArea(float side) { - return side * side; -} - -int main() { - std::cout << "Проверка, площадь квадрата в виде десятичной дроби " << squareArea(2.5) << '\n'; - std::cout << "Проверка, площадь квадрата в виде целого числа " << squareArea(25) << '\n'; - - return 0; -} \ No newline at end of file diff --git a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task2.cpp b/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task2.cpp deleted file mode 100644 index adddea65..00000000 --- a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -float trapezoidArea(float firstFoundation, float secondFoundation, float height) { - return (firstFoundation + secondFoundation) * height / 2; -} - -float trapezoidAreaSecond(float middleLine, float height) { - return middleLine * height; -} - -int main() { - std::cout << "Проверка, площадь трапеции в виде десятичной дроби " << trapezoidArea(2, 2.6, 4) << '\n'; - std::cout << "Проверка, площадь трапеции в виде целого числа " << trapezoidArea(2, 2.5, 4) << '\n'; - - std::cout << "Площадь трапеции через среднюю линию " << trapezoidAreaSecond(2.5, 4) << '\n'; - - return 0; -} \ No newline at end of file diff --git a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task3.cpp b/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task3.cpp deleted file mode 100644 index 96de38f3..00000000 --- a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -void fibonacci(int usersInput) { - int first {1}; - int second {0}; - for (int i {1}; i <= usersInput; i++) { - if (i % 2 != 0) { - first += second; - std::cout << first << ' '; - } - else { - second += first; - std::cout << second << ' '; - } - } -} - -int main() { - std::cout << "Введите, сколько чисел Фибоначчи вы бы хотели увидеть: "; - int usersNumber {}; - std::cin >> usersNumber; - - std::cout << "Ваш ряд: "; - fibonacci(usersNumber); - - return 0; -} \ No newline at end of file diff --git a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task4.cpp b/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task4.cpp deleted file mode 100644 index 62fd949c..00000000 --- a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -void reverseNumber(long long usersNumber) { - int temp {}; - while (usersNumber) { - temp = usersNumber % 10; - std::cout << temp; - usersNumber /= 10; - } -} - -int main() { - std::cout << "Введите ваше число: "; - long long usersInput {}; //long long type for cases with really big numbers - std::cin >> usersInput; - - std::cout << "Ваше число в обратно порядке: "; - reverseNumber(usersInput); - - return 0; -} \ No newline at end of file diff --git a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork2/task1.cpp b/sem1/TyazhelovIlyaOlegovich/MiniHomeWork2/task1.cpp deleted file mode 100644 index 7e72c5ba..00000000 --- a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork2/task1.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -void numbersRepresentation(int usersNumber, int usersBase) { - usersBase == 8 ? std::cout << "Your number in in octal representation is: " << std::oct << usersNumber : - std::cout << "Your number in hexadecimal representation is: " << std::hex << usersNumber; -} - -int main() { - std::cout << "Please enter your integer (every symbol past comma will be discarded): "; - float usersNumber {}; - std::cin >> usersNumber; - - std::cout << "Please enter the base of new number (8 or 16): "; - int usersBase {}; - std::cin >> usersBase; - - while (usersBase != 8 and usersBase != 16) { - std::cout << "Please enter 8 or 16: "; - std::cin >> usersBase; - } - - numbersRepresentation(usersNumber, usersBase); - - return 0; -} \ No newline at end of file diff --git a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork2/task2.cpp b/sem1/TyazhelovIlyaOlegovich/MiniHomeWork2/task2.cpp deleted file mode 100644 index cafc4a63..00000000 --- a/sem1/TyazhelovIlyaOlegovich/MiniHomeWork2/task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -void hypothesisOfSyrakuz(int usersNumber) { - int amountOfIterations {1}; - while (usersNumber != 1) { - if (usersNumber % 2 == 0) - usersNumber /= 2; - else - usersNumber = 3 * usersNumber + 1; - std::cout << amountOfIterations << " iteration gave: " << usersNumber << '\n'; - amountOfIterations++; - } - std::cout << "Hypothesis is right!"; -} - -int main() { - std::cout << "Please enter your integer (every symbol past comma will be discarded): "; - float usersNumber {}; - std::cin >> usersNumber; - - hypothesisOfSyrakuz(usersNumber); - - return 0; -} \ No newline at end of file diff --git a/sem1/UshnovaAI/MiniHomeWork2_fixed/task1.cpp b/sem1/UshnovaAI/MiniHomeWork2_fixed/task1.cpp deleted file mode 100644 index bb534b1c..00000000 --- a/sem1/UshnovaAI/MiniHomeWork2_fixed/task1.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int main() -{ - while (1) { - std::cout << "Select octal and hexadecimal number system\nWrite 8 or 16\n"; - int numSys, num; - std::cin >> numSys; - if ((numSys == 16) or (numSys == 8)) { - std::cout << "Enter your number:\n"; - std::cin >> num; - switch (numSys) { - case 16: - std::cout << "Hexadecimal number: " << std::hex << num << std::endl; - break; - case 8: - std::cout << "Octal number: " << std::oct << num << std::endl; - break; - } - } - else { - std::cout << "Invalid input\n"; - } - - } - return 0; -} \ No newline at end of file diff --git a/sem1/UshnovaAI/MiniHomeWork2_fixed/task2.cpp b/sem1/UshnovaAI/MiniHomeWork2_fixed/task2.cpp deleted file mode 100644 index 0f76c19f..00000000 --- a/sem1/UshnovaAI/MiniHomeWork2_fixed/task2.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main() -{ - while (1) { - std::cout << "Enter any natural number\n"; - int num; - std::cin >> num; - while (num > 1) { - if (num % 2 == 0) { - num = num / 2; - std::cout << num << std::endl; - } - else if (num % 2 == 1) { - num = (num * 3 + 1) / 2; - std::cout << num << std::endl; - } - } - } - return 0; -} \ No newline at end of file diff --git a/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.1.cpp b/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.1.cpp deleted file mode 100644 index df7aaa4e..00000000 --- a/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() { - setlocale(LC_ALL, "rus"); - std::cout << "Введите сторону квадрата:"; - int side = 0; - std::cin >> side; - while (side < 0) { - std::cout << "Сторона квадрата не может быть меньше 0\n"; - std::cout << "Введите сторону квадрата:"; - std::cin >> side; - }; - std::cout << "\n"; - std::cout << pow(side, 2); -} \ No newline at end of file diff --git a/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.2.cpp b/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.2.cpp deleted file mode 100644 index c7c41bae..00000000 --- a/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.2.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -int func(std::string s1, std::string s2) { - std::cout << "Введите длину "; - std::cout << s1; - std::cout << " трапеции:"; - int side = 0; - std::cin >> side; - while (side < 0) { - std::cout << s2; - std::cout << " трапеции не может быть меньше нуля\n"; - std::cout << "Введите длину "; - std::cout << s1; - std::cout << " трапеции:"; - std::cin >> side; - } - return side; -} - -int main() { - setlocale(LC_ALL, "rus"); - - int side1 = func("верхнего основания", "Сторона"); - int side2 = func("нижнего основания", "Сторона"); - int h = func("высоты", "Высота"); - - std::cout << (side1 + side2) / 2 * h; -} diff --git a/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.3.cpp b/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.3.cpp deleted file mode 100644 index e57ac76a..00000000 --- a/sem1/VictorMihaylukov/MiniHomework1/MiniHomework1.3.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -int main(){ - setlocale(LC_ALL, "rus"); - int n = 0; - std::cout << "Введите N:"; - std::cin >> n; - if (n == 0) { - std::cout << ""; - } - if (n > 0){ - std::cout << 1; - std::cout << " "; - } - while (n < 0) { - std::cout << "Вы ввели недопустимое число\nВведите N:"; - std::cin >> n; - } - int pre1 = 0; - int pre2 = 1; - int count = 1; - int i = 0; - while (count < n) { - i++; - if (pre1 + pre2 == i) { - count++; - pre1 = pre2; - pre2 = i; - std::cout< - -int main(){ - setlocale(LC_ALL, "rus"); - std::cout << "Введите число:"; - int num = 0; - std::cin >> num; - int num_r = 0; - - while (num != 0) { - if (num_r != 0) { - num_r *= 10; - } - num_r += num % 10; - num = num / 10; - } - - std::cout << num_r; -} \ No newline at end of file diff --git a/sem1/VictorMihaylukov/MiniHomework2/MiniHomework2.1.cpp b/sem1/VictorMihaylukov/MiniHomework2/MiniHomework2.1.cpp deleted file mode 100644 index 1e2999e0..00000000 --- a/sem1/VictorMihaylukov/MiniHomework2/MiniHomework2.1.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include - -std::string func(int n, int cc) { - std::string abc = { "0123456789ABCDEF" }; - std::string result = ""; - int i = 0; - do { - i = n % cc; - result = result + abc[i]; - n = n / cc; - } while (n > 0); - reverse(result.begin(), result.end()); - return result; -} - -int main(){ - setlocale(LC_ALL, "rus"); - - std::cout << "Введите число:"; - int number = 0; - std::cin >> number; - while (number < 0) { - std::cout << "Число не может быть меньше 0\n"; - std::cout << "Введите число:"; - std::cin >> number; - } - - int choice = 0; - std::cout << "Введите 1, если хотите перевести число в восьмеричиную систему счисления.\nИли введите 2, если хотите перевести число в шестнадцатеричную систему счисления\n"; - std::cin >> choice; - while (choice != 1 and choice != 2) { - std::cout << "Вы ввели не допустимое число\n"; - std::cout << "Введите 1, если хотите перевести число в восьмеричиную систему счисления.\nИли введите 2, если хотите перевести число в шестнадцатеричную систему счисления\n"; - std::cin >> choice; - } - - if (choice == 1) { - std::cout << func(number, 8); - } - else { - std::cout << func(number, 16); - } -} \ No newline at end of file diff --git a/sem1/VictorMihaylukov/MiniHomework2/MiniHomework2.2.cpp b/sem1/VictorMihaylukov/MiniHomework2/MiniHomework2.2.cpp deleted file mode 100644 index 8f34173d..00000000 --- a/sem1/VictorMihaylukov/MiniHomework2/MiniHomework2.2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -using namespace std; - -int main(){ - setlocale(LC_ALL, "rus"); - - cout << "Введите натуральное число:"; - int n = 0; - cin >> n; - while (n <= 0) { - cout << "Число не может быть меньше или равно нулю\n"; - cout << "Введите натуральное число:"; - cin >> n; - } - - while (n != 1) { - if (n % 2 == 0) { - n /= 2; - } - else { - n = (n * 3 + 1) / 2; - } - } - - if (n == 1) { - cout << "Гипотеза подтверждена"; - } -} \ No newline at end of file diff --git a/sem1/VilesovaVO/BigHomeWork1/Practice_1.cpp b/sem1/VilesovaVO/BigHomeWork1/Practice_1.cpp deleted file mode 100644 index b8baece9..00000000 --- a/sem1/VilesovaVO/BigHomeWork1/Practice_1.cpp +++ /dev/null @@ -1,270 +0,0 @@ -#include -#include -#include -#include -#include -#include - -class Student { - public: - int id; - std::string surname; - std::string name; - std::string patr; - double avgGrade; - std::string specialization; - - Student() { - - } - Student(int id, std::string surname, std::string name, std::string patr, double avgGrade, std::string specialization) { - this->id = id; - this->surname = surname; - this->name = name; - this->patr = patr; - this->avgGrade = avgGrade; - this->specialization = specialization; - } - - void GetInfo() { - std::cout << "ID: " << id << "\nSurname: " << surname << "\nName: " << name << "\nPatronymic: " << patr << "\nAverage grade : " << avgGrade << "\nSpecialty : " << specialization << std::endl; - } - -}; - -std::string path = "DBStudents.txt"; -bool active = true; -std::vector DBStudents; -std::vector studentsFilter; -int idToFind; -std::string patrToFind; -std::string nameToFind; -std::string surnameToFind; -double avgGradeToFind; -std::string specializationToFind; - -int newId; -std::string newSurname; -std::string newName; -std::string newPatr; -double newAvgGrade; -std::string newSpecialization; - -void WriteToFile() { - std::ofstream out; - out.open(path); - if (out.is_open()) { - std::string str; - for (Student st : DBStudents) - { - out << st.id << " " << st.surname << " " << st.name << " " << st.patr << " " << st.avgGrade << " " << st.specialization << "\n"; - } - } - out.close(); -} - -void ReadFromFile() { - std::ifstream in; - in.open(path); - if (in.is_open()) { - std::string str; - std::string strSplit[6]; - for (int i = 0; getline(in, str); i++) - { - std::stringstream s(str); - int j = 0; - while (s.good() && j < 6) { - s >> strSplit[j]; - j++; - } - DBStudents.push_back(Student(stoi(strSplit[0]), strSplit[1], strSplit[2], strSplit[3], stod(strSplit[4]), strSplit[5])); - - } - } - in.close(); -} - -void GetInfoFiltered() { - for (Student st : studentsFilter) - { - st.GetInfo(); - } -} - -void GetInfoAll() { - for (Student st : DBStudents) - { - st.GetInfo(); - } -} - -int FIndById() { - int index; - auto result = find_if(DBStudents.begin(), DBStudents.end(), [](const Student & st) { - return st.id == idToFind; - }); - if (result == DBStudents.end()) index = -1; - else index = result - DBStudents.begin(); - return index; -} - -void FAllById() { - copy_if(DBStudents.begin(), DBStudents.end(), back_inserter(studentsFilter), [](const Student& st) { - return st.id == idToFind; - }); -} - -void FAllBySN() { - copy_if(DBStudents.begin(), DBStudents.end(), back_inserter(studentsFilter), [](const Student& st) { - return st.surname == surnameToFind; - }); -} - -void FAllByN() { - copy_if(DBStudents.begin(), DBStudents.end(), back_inserter(studentsFilter), [](const Student& st) { - return st.name == nameToFind; - }); -} - -void FAllByPatr() { - copy_if(DBStudents.begin(), DBStudents.end(), back_inserter(studentsFilter), [](const Student& st) { - return st.patr == patrToFind; - }); -} - -void FAllByAGrade() { - copy_if(DBStudents.begin(), DBStudents.end(), back_inserter(studentsFilter), [](const Student& st) { - return st.avgGrade == avgGradeToFind; - }); -} - -void FindAllBySpecialization() { - copy_if(DBStudents.begin(), DBStudents.end(), back_inserter(studentsFilter), [](const Student& st) { - return st.specialization == specializationToFind; - }); -} - -int main() -{ - ReadFromFile(); - - while (active) { - int option; - Select: - std::cout << "\nITMO students database\nSelect the option:\n"; - std::cout << "1 - Add a new student to the database\n2 - Print all\n3 - Find a student by criteria\n4 - Delete a student by ID\n5 - Exit\n"; - std::cin >> option; - switch (option) - { - case 1: - StudentCreate: - std::cout << "Enter new student's ID: "; - std::cin >> idToFind; - if (FIndById() > -1) { - cout << "Student with this ID already exists.\n"; - goto StudentCreate; - } - else newId = idToFind; - std::cout << "Enter new student's surname: "; - std::cin.ignore(); - std::getline(cin, newSurname); - std::cout << "Enter new student's name: "; - std::cin.ignore(); - std::getline(cin, newName); - std::cout << "Enter new student's patronymic: "; - std::cin.ignore(); - std::getline(cin, newPatr); - std::cout << "Enter new student's average grade: "; - std::cin >> newAvgGrade; - std::cout << "Enter new student's specialty: "; - std::cin.ignore(); - std::getline(cin, newSpecialization); - DBStudents.push_back(Student(newId, newSurname, newName, newPatr, newAvgGrade, newSpecialization)); - WriteToFile(); - break; - case 2: - std::cout << "\nThe list of all students: \n"; - GetInfoAll(); - std::cout << std::endl; - break; - case 3: - FindSelect: - int crit; - std::cout << "Select crit to find:\n"; - std::cout << "1 - ID\n2 - Surname\n3 - Name\n4 - Patronymic\n5 - Average Grade\n6 - Specialty\n7 - Go back\n"; - std::cin >> crit; - switch (crit) - { - case 1: - std::cout << "Enter id for searching: "; - std::cin >> idToFind; - FAllById(); - break; - case 2: - std::cout << "Enter surname for searching: "; - std::cin.ignore(); - std::getline(cin, surnameToFind); - FAllBySN(); - break; - case 3: - std::cout << "Enter name for searching: "; - std::cin.ignore(); - std::getline(cin, nameToFind); - FAllByN(); - break; - case 4: - std::cout << "Enter patronymic for searching: "; - std::cin.ignore(); - std::getline(cin, patrToFind); - FAllByPatr(); - break; - case 5: - std::cout << "Enter average grade for searching: "; - std::cin >> avgGradeToFind; - FAllByAGrade(); - break; - case 6: - std::cout << "Enter specialty for searching: "; - std::cin.ignore(); - std::getline(cin, specializationToFind); - FindAllBySpecialization(); - break; - break; - case 7: - goto Select; - break; - default: - std::cout << "There is no such a crit. Select again.\n"; - goto FindSelect; - } - if (!studentsFilter.empty()) GetInfoFiltered(); - else std::cout << "There are no students by this crit.\n"; - studentsFilter.clear(); - break; - case 4: - std::cout << "Enter the ID you want to delete: "; - std::cin >> idToFind; - if (FIndById() >= 0) { - DBStudents.erase(DBStudents.begin() + FIndById()); - std::cout << "ID was deleted.\n"; - WriteToFile(); - } - else std::cout << "ID doesn't exist.\n"; - break; - case 5: - active = 0; - break; - default: - std::cout << "There is no such an option. Select again.\n"; - goto Select; - } - } -} - - - - - - - - diff --git a/sem1/VilesovaVO/BigHomeWork1/bigHomeWork b/sem1/VilesovaVO/BigHomeWork1/bigHomeWork deleted file mode 160000 index 09a08a9f..00000000 --- a/sem1/VilesovaVO/BigHomeWork1/bigHomeWork +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 09a08a9f6c4ee9197290d7d0152d9fbf89f5c42e diff --git a/sem1/VilesovaVO/MiniHomeWork 2/Task1/MiniHomeWork 2.cpp b/sem1/VilesovaVO/MiniHomeWork 2/Task1/MiniHomeWork 2.cpp deleted file mode 100644 index bd92337c..00000000 --- a/sem1/VilesovaVO/MiniHomeWork 2/Task1/MiniHomeWork 2.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include -#include -#include -#include -int tenToEight(int); - - -int main() -{ - int in_10, result_8, num, temp; - std::cout << "Enter a number "; - std::cin >> in_10; - - result_8 = tenToEight(in_10); - - std::string num16; - - num = in_10; - - do - { - temp = num % 16; - - if (temp > 9) - { - switch (temp) { - case 10: - num16 += "A"; - break; - case 11: - num16 += "B"; - break; - case 12: - num16 += "C"; - break; - case 13: - num16 += "D"; - break; - case 14: - num16 += "E"; - break; - case 15: - num16 += "F"; - break; - } - } - else - { - num16 += std::to_string(temp); - } - - num /= 16; - - } while (num > 0); - - - reverse(num16.begin(), num16.end()); - - - std::cout << "Octal " << result_8 << std::endl << "Hexadecimal " << num16 << std::endl; - - -} -int tenToEight(int a) -{ - int div_8 = 8, buffer, result; - buffer = a / 8; - result = a % 8; - std::stack stack; - stack.push(result); - while (buffer > 0) - { - result = buffer % 8; - buffer /= 8; - stack.push(result); - - } - result = 0; - while (!stack.empty()) - { - result *= 10; - result += stack.top(); - stack.pop(); - } - return result; -} \ No newline at end of file diff --git a/sem1/VilesovaVO/MiniHomeWork1/Task1/Task1.cpp b/sem1/VilesovaVO/MiniHomeWork1/Task1/Task1.cpp deleted file mode 100644 index 9c3288f6..00000000 --- a/sem1/VilesovaVO/MiniHomeWork1/Task1/Task1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -int main() -{ - int s, a; - std::cout << "Enter side of square :" << std::endl; - std::cin >> a; - s = a * a; - std::cout << "Side of square " << a << std::endl; - std::cout << "Square " << s << std::endl; - -} \ No newline at end of file diff --git a/sem1/VilesovaVO/MiniHomeWork1/Task2/Task2.cpp b/sem1/VilesovaVO/MiniHomeWork1/Task2/Task2.cpp deleted file mode 100644 index 27357245..00000000 --- a/sem1/VilesovaVO/MiniHomeWork1/Task2/Task2.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - int s, a, b, h; - std::cout << "Enter top and bottom \n"; - std::cin >> a >> b; - std::cout << "Enter height \n"; - std::cin >> h; - s = (a + b) / 2 * h; - std::cout << "Square " << s << std::endl; -} \ No newline at end of file diff --git a/sem1/VilesovaVO/MiniHomeWork1/Task3/Task3.cpp b/sem1/VilesovaVO/MiniHomeWork1/Task3/Task3.cpp deleted file mode 100644 index 1acfd83f..00000000 --- a/sem1/VilesovaVO/MiniHomeWork1/Task3/Task3.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -int main() -{ - int a, b, c, n; - std::cout << "Enter a number of element :\n"; - std::cin >> n; - a = 0; - b = 1; - n -= 2; - std::cout << "0\n" << "1\n"; - while (n > 0) - { - - c = a + b; - a = b; - b = c; - n--; - std::cout << c << std::endl; - - } - -} \ No newline at end of file diff --git a/sem1/VilesovaVO/MiniHomeWork1/Task4/Task4.cpp b/sem1/VilesovaVO/MiniHomeWork1/Task4/Task4.cpp deleted file mode 100644 index bc2b5f05..00000000 --- a/sem1/VilesovaVO/MiniHomeWork1/Task4/Task4.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -int main() -{ - int number, rev = 0, rem; - std::cout << "Enter number:\n"; - std::cin >> number; - while (number > 0) - { - rem = number % 10; - rev = rem + rev * 10; - number /= 10; - } - std::cout << rev; -} \ No newline at end of file diff --git a/sem1/VilesovaVO/MiniHomeWork2/Task1/Task1.cpp b/sem1/VilesovaVO/MiniHomeWork2/Task1/Task1.cpp deleted file mode 100644 index c761ab54..00000000 --- a/sem1/VilesovaVO/MiniHomeWork2/Task1/Task1.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include -#include -#include -#include -#include -using namespace std; - -int tenToEight(int); - - -int main() -{ - int in_10, result_8, num, temp; - cout << "Enter a number "; - cin >> in_10; - - result_8 = tenToEight(in_10); - - string num16; - - num = in_10; - - do - { - temp = num % 16; - - if (temp > 9) - { - switch (temp) { - case 10: - num16 += "A"; - break; - case 11: - num16 += "B"; - break; - case 12: - num16 += "C"; - break; - case 13: - num16 += "D"; - break; - case 14: - num16 += "E"; - break; - case 15: - num16 += "F"; - break; - } - } - else - { - num16 += to_string(temp); - } - - num /= 16; - - } while (num > 0); - - - reverse(num16.begin(), num16.end()); - - - cout << "Octal " << result_8 << endl << "Hexadecimal " << num16 << endl; - - -} -int tenToEight(int a) -{ - int div_8 = 8, buffer, result; - buffer = a / 8; - result = a % 8; - stack stack; - stack.push(result); - while (buffer > 0) - { - result = buffer % 8; - buffer /= 8; - stack.push(result); - - } - result = 0; - while (!stack.empty()) - { - result *= 10; - result += stack.top(); - stack.pop(); - } - return result; -} diff --git a/sem1/VilesovaVO/MiniHomeWork2/Task2/Task2.cpp b/sem1/VilesovaVO/MiniHomeWork2/Task2/Task2.cpp deleted file mode 100644 index 614513bd..00000000 --- a/sem1/VilesovaVO/MiniHomeWork2/Task2/Task2.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -int main() -{ - int a, b, f; - - std::cout << "Enter the number "; - std::cin >> b; - f = 0; - - while (b > 1) - { - if (f == b % 2) - { - a = b / 2; - b = a; - } - else - { - a = ((b * 3) + 1) / 2; - b = a; - } - } - std::cout << "Result " << b; -} diff --git a/sem1/VilesovaVO/MiniHomeWork3/ConsoleApplication1.cpp b/sem1/VilesovaVO/MiniHomeWork3/ConsoleApplication1.cpp deleted file mode 100644 index 8d555960..00000000 --- a/sem1/VilesovaVO/MiniHomeWork3/ConsoleApplication1.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include -#include -#include -#include -#include - - -class ItemBase { -public: - virtual double getPrice() const = 0; - virtual double getWeight() const = 0; - virtual ~ItemBase() = default; -}; - -class GraphicsCard : public ItemBase { -private: - std::string name; - double price; - double weight; - double fps; - -public: - GraphicsCard(const std::string& n, double p, double w, double f) : name(n), price(p), weight(w), fps(f) {} - double getPrice() const override { return price; } - double getWeight() const override { return weight; } -}; - -class Fruit : public ItemBase { -private: - std::string name; - double price; - double weight; - std::string vitamins; - -public: - Fruit(const std::string& n, double p, double w, const std::string& v) : name(n), price(p), weight(w), vitamins(v) {} - double getPrice() const override { return price; } - double getWeight() const override { return weight; } -}; - -class Shop { -public: - std::string name; - std::vector items; - - Shop(const std::string& shopName) : name(shopName) {} - - - void addItem(ItemBase* item) { items.push_back(item); } - - double getAveragePrice() const { - if (items.empty()) return 0.0; - double sum = 0.0; - for (const auto& item : items) { - sum += item->getPrice(); - } - return sum / items.size(); - } - - double getAverageWeight() const { - if (items.empty()) return 0.0; - double sum = 0.0; - for (const auto& item : items) { - sum += item->getWeight(); - } - return sum / items.size(); - } - - ~Shop() { - for (auto item : items) { - delete item; - } - } -}; -Shop* parseFile(const std::string& filename) { - std::ifstream file(filename); - if (!file.is_open()) { - throw std::runtime_error("Could not open file"); - } - - std::string line; - Shop* currentShop = nullptr; - while (std::getline(file, line)) { - std::stringstream ss(line); - std::string keyword; - ss >> keyword; - - if (keyword == "Shop") { - std::string shopName; - ss >> shopName; - currentShop = new Shop(shopName); - } - else if (keyword == "Items") { - int numItems; - ss >> numItems; - for (int i = 0; i < numItems; ++i) { - std::getline(file, line); - std::stringstream itemSs(line); - std::string itemName; - double price, weight, fps; - std::string vitamins; - - itemSs >> itemName; - if (itemName.find("NVIDIA") != std::string::npos) { - itemSs >> price >> weight >> fps; - currentShop->addItem(new GraphicsCard(itemName, price, weight, fps)); - } - else { - itemSs >> price >> weight; - std::string word; - while (itemSs >> word) { - vitamins += word + " "; - } - vitamins.pop_back(); - currentShop->addItem(new Fruit(itemName, price, weight, vitamins)); - } - } - std::cout << "Shop: " << currentShop->name << std::endl; - std::cout << "Average price: " << currentShop->getAveragePrice() << std::endl; - std::cout << "Average weight: " << currentShop->getAverageWeight() << std::endl; - } - } - file.close(); - return currentShop; -} -int main() { - try { - parseFile("shop_data.txt"); - - } - catch (const std::runtime_error& error) { - std::cerr << "Error: " << error.what() << std::endl; - } - - return 0; -} diff --git a/sem1/VilesovaVO/MiniHomeWork3/shop_data.txt b/sem1/VilesovaVO/MiniHomeWork3/shop_data.txt deleted file mode 100644 index 38ec107e..00000000 --- a/sem1/VilesovaVO/MiniHomeWork3/shop_data.txt +++ /dev/null @@ -1,21 +0,0 @@ -Shop ShopA -Items 5 -GPU_RTX3080 1200 2 10 -GPU_RX6800 1100 1.8 9 -GPU_RTX3070 800 1.5 8 -GPU_GTX1660 300 1 6 -GPU_RX6600 400 1.2 7 -Shop ShopB -Items 5 -Apple 1 0.2 Vitamins A C -Orange 0.8 0.15 Vitamins C -Banana 0.5 0.1 Vitamins B6 K -Pear 1.2 0.25 Vitamins C -Grape 2 0.3 Vitamins K -Shop ShopC -Items 5 -Cherry 1.5 0.1 Vitamins A C -Strawberry 2 0.15 Vitamins C -Blueberry 3 0.2 Vitamins A C E -Raspberry 2.5 0.18 Vitamins C -Mango 4 0.5 Vitamins A C diff --git a/sem1/VolkovaAP/Minidomashka3.cpp b/sem1/VolkovaAP/Minidomashka3.cpp deleted file mode 100644 index a7aa0bb9..00000000 --- a/sem1/VolkovaAP/Minidomashka3.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include -#include -#include - -class ItemBase -{ -protected: - std::string name; - int price; - int weight; -}; - -class Iphone : public ItemBase -{ -protected: - std::string color; - int memory; - -public: - Iphone(std::string name, std::string color, int memory, int price, int weight) - { - this->name = name; - this->color = color; - this->memory = memory; - this->price = price; - this->weight = weight; - } -}; - -class Book : public ItemBase -{ -protected: - std::string genre; - int number_of_pages; - -public: - Book(std::string name, std::string genre, int number_of_pages, int price, int weight) - { - this->name = name; - this->genre = genre; - this->number_of_pages = number_of_pages; - this->price = price; - this->weight = weight; - } -}; - -class Sport_item : public ItemBase -{ -protected: - std::string type; - std::string kind_of_sport; - -public: - Sport_item(std::string name, std::string type, std::string kind_of_sport, int price, int weight) - { - this->name = name; - this->type = type; - this->kind_of_sport = kind_of_sport; - this->price = price; - this->weight = weight; - } -}; - -class Item -{ -public: - void New_iphone() - { - Iphone iphone("iphone 13", "black", 256, 77990, 173); - } - - void New_book() - { - Book book("Kolobok", "skazka", 10, 250, 100); - } - - void New_sport_item() - { - Sport_item sport_item("ski", "equipment", "alpine skiing", 6800, 3200); - } -}; - -int main() -{ - setlocale(LC_ALL, "Rus"); - - std::string path = "database.txt"; - - std::ifstream fin(path); - std::string str; - - int sum_price = 0; - int sum_weight = 0; - - while (getline(fin, str)) - { - if (str == "iphonestore" or str == "bookstore" or str == "sportmaster" or str == "items 5") - { - if (str == "iphonestore") - { - std::cout << "iphonestore" << std::endl; - } - - if (str == "bookstore") - { - std::cout << "Средняя цена: " << (float)sum_price / 5 << "\t" << "Средний вес: " << (float)sum_weight / 5 << std::endl << std::endl; - sum_price = 0; - sum_weight = 0; - std::cout << "bookstore" << std::endl; - } - - if (str == "sportmaster") - { - std::cout << "Средняя цена: " << (float)sum_price / 5 << "\t" << "Средний вес: " << (float)sum_weight / 5 << std::endl << std::endl; - sum_price = 0; - sum_weight = 0; - std::cout << "sportmaster" << std::endl; - } - - if (str == "items 5") - { - std::cout << "items 5" << std::endl; - } - } - - else { - int pos1 = 0; - for (int i = 1; i < 4; ++i) - { - pos1 = str.find(",", pos1) + 2; - } - int endpos1 = str.find(",", pos1); - std::string str_price = str.substr(pos1, endpos1 - pos1); - int price = stoi(str_price); - sum_price += price; - - int pos2 = endpos1 + 2; - int endpos2 = str.find(",", pos2); - std::string str_weight = str.substr(pos2, endpos2 - pos2); - int weight = stoi(str_weight); - sum_weight += weight; - - //std::cout << "Цена: " << price << "\t" << "Вес: " << weight << std::endl; - } - } - - fin.close(); - - std::cout << "Средняя цена: " << (float)sum_price / 5 << "\t" << "Средний вес: " << (float)sum_weight / 5 << std::endl << std::endl; -} \ No newline at end of file diff --git a/sem1/VolkovaAP/database.txt b/sem1/VolkovaAP/database.txt deleted file mode 100644 index c634b7f3..00000000 --- a/sem1/VolkovaAP/database.txt +++ /dev/null @@ -1,21 +0,0 @@ -iphonestore -items 5 -iphone 13 mini, red, 256, 65990, 157 -iphone 13, black, 256, 77990, 173 -iphone 15 pro, gold, 512, 104990, 187 -iphone 15, white, 128, 89990, 176 -iphone 13, white, 512, 87990, 173 -bookstore -items 5 -Vlastelin kolec, fantasy, 1200, 3600, 812 -Kolobok, skazka, 10, 250, 100 -Ono, horror, 563, 2000, 376 -Institut, horror, 762, 1650, 523 -Voyna i mir, roman, 2408, 1879, 1590 -sportmaster -items 5 -ski, equipment, alpine skiing, 6800, 3200 -soccer ball, equipment, soccer, 670, 270 -swimsuit, cloth, swimming, 2200, 127 -tennis racket, equipment, tennis, 1700, 210 -tennis skirt, cloth, tennis, 1290, 97 \ No newline at end of file diff --git a/sem1/YakimenkoAA/MH2/task1.cpp b/sem1/YakimenkoAA/MH2/task1.cpp deleted file mode 100644 index 9f988926..00000000 --- a/sem1/YakimenkoAA/MH2/task1.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -std::string sixteen(int number); - -std::string eight(int number); - -int main() -{ - int number; - std::cout << "Enter number:"; - std::cin >> number; - std::cout << "8: "<< eight(number) << std::endl; - std::cout << "16 :" << sixteen(number) << std::endl; - return 0; -} - -std::string eight(int number) { - std::string result = ""; - while (number != 0) { - result = std::to_string(number % 8) + result; - number = number / 8; - } - return result; -} -std::string sixteen(int number) { - std::string result = ""; - while (number > 0) { - if (number % 16 < 10) { - result = std::to_string(number % 16) + result; - number = number / 16; - } - else { - result = (char)(number % 16 + 'A' - 10) + result; - number = number / 16; - } - } - return result; -} \ No newline at end of file diff --git a/sem1/YakimenkoAA/MH2/task2.cpp b/sem1/YakimenkoAA/MH2/task2.cpp deleted file mode 100644 index 4c01c34f..00000000 --- a/sem1/YakimenkoAA/MH2/task2.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int HypSyrakuz(int Nnumber); - -int main() { - int Nnumber; - std::cout << "Enter Natural number:"; - std::cin >> Nnumber; - std::cout << HypSyrakuz(Nnumber); - return 0; -} - -int HypSyrakuz(int Nnumber) { - while (Nnumber != 1) { - if (Nnumber % 2 == 0) { - Nnumber = Nnumber / 2; - } - else { - Nnumber = Nnumber * 3 + 1; - } - } - return Nnumber; -} -/// Гипотеза работает для любых Nnumber >= 1 \ No newline at end of file diff --git a/sem1/YakimenkoAA/MiniHomeWork1/task1.cpp b/sem1/YakimenkoAA/MiniHomeWork1/task1.cpp deleted file mode 100644 index 0dd5d61d..00000000 --- a/sem1/YakimenkoAA/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -int square(int input); - -int main() { - int input; - std::cout << "Enter a number:"; - std::cin >> input; - std::cout << square(input); - return 0; -} - -int square(int input) { - return input*input; -} \ No newline at end of file diff --git a/sem1/YakimenkoAA/MiniHomeWork1/task2.cpp b/sem1/YakimenkoAA/MiniHomeWork1/task2.cpp deleted file mode 100644 index 3474d547..00000000 --- a/sem1/YakimenkoAA/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -int square(int a, int b, int h); -int main() { - int a, b, h; - std::cout << "Enter a numbers:"; - std::cin >> a; - std::cin >> b; - std::cin >> h; - std::cout << square(a, b, h); -} - -int square(int a, int b, int h) { - return ((a+b)*h)/2; -} \ No newline at end of file diff --git a/sem1/YakimenkoAA/MiniHomeWork1/task3.cpp b/sem1/YakimenkoAA/MiniHomeWork1/task3.cpp deleted file mode 100644 index c472eacf..00000000 --- a/sem1/YakimenkoAA/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int fibba(int input); - - -int main() { - int input; - std::cout << "Enter a number: "; - std::cin >> input; - std::cout << fibba(input); - return 0; -} - -int fibba(int input) { - int first_num = 0; - int second_num = 1; - int result = 0; - for (int i = 0; i < input; i++) { - first_num = second_num; - second_num = result; - result = first_num + second_num; - } - return result; -} \ No newline at end of file diff --git a/sem1/YakimenkoAA/MiniHomeWork1/task4.cpp b/sem1/YakimenkoAA/MiniHomeWork1/task4.cpp deleted file mode 100644 index e9b68bf0..00000000 --- a/sem1/YakimenkoAA/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -int reverse(int input); - -int main() { - int input; - std::cout << " ᫮:"; - std::cin >> input; - std::cout << reverse(input); -} - -int reverse(int input) { - int reversed = 0; - while (input != 0) { - reversed = reversed * 10 + input % 10; - input /= 10; - } - return reversed; -} \ No newline at end of file diff --git a/sem1/andreychetporov/MiniHomeWork1/task1.cpp b/sem1/andreychetporov/MiniHomeWork1/task1.cpp deleted file mode 100644 index 1fa869e9..00000000 --- a/sem1/andreychetporov/MiniHomeWork1/task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int square(int n) { - return n * n; - -} - -int main() -{ - int n; - std::cin >> n; - std::cout << square(n); -} \ No newline at end of file diff --git a/sem1/andreychetporov/MiniHomeWork1/task2.cpp b/sem1/andreychetporov/MiniHomeWork1/task2.cpp deleted file mode 100644 index 67478ecc..00000000 --- a/sem1/andreychetporov/MiniHomeWork1/task2.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int square(float high, int side1, int side2) { - return high * (side1 + side2) / 2; -} - - -int main() -{ - float high; int side1; int side2; - std::cin >> high >> side1 >> side2; - std::cout << square(high, side1, side2); -} diff --git a/sem1/andreychetporov/MiniHomeWork1/task3.cpp b/sem1/andreychetporov/MiniHomeWork1/task3.cpp deleted file mode 100644 index 5b933a3f..00000000 --- a/sem1/andreychetporov/MiniHomeWork1/task3.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - - -int fib(int n) { - if (n <= 2) { - return 1; - } - else - return fib(n - 1) + fib(n - 2); -} - -int main() { - int n = 0; - std::cin >> n; - for (int i = 1; i <= n; i++) { - std::cout << fib(i) << ' '; - } -} \ No newline at end of file diff --git a/sem1/andreychetporov/MiniHomeWork1/task4.cpp b/sem1/andreychetporov/MiniHomeWork1/task4.cpp deleted file mode 100644 index 1ded4308..00000000 --- a/sem1/andreychetporov/MiniHomeWork1/task4.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - - -int main() { - unsigned long long int n; - short int num; - std::cin >> n; - while (n != 0) { - num = n % 10; - n = n / 10; - std::cout << num; - } -} \ No newline at end of file diff --git a/sem1/andreychetporov/hw3/Base.txt b/sem1/andreychetporov/hw3/Base.txt deleted file mode 100644 index 83ba8f48..00000000 --- a/sem1/andreychetporov/hw3/Base.txt +++ /dev/null @@ -1,21 +0,0 @@ -Shop Videocards -Items 5 -NVIDIA6090 10000 10 32Gb 1000W -NVIDIA5090 9999 9 24Gb 890W -RadeonRX1080 7555 9 24Gb 880W -RadeonRX1080Ti 8500 11 32Gb 1080W -NVIDIATITANRTXULTRA 99999 18 128Gb 1800W -Shop CPUs -Items 5 -I11-99999F 7999 3 120W 8 -Ryzen11700 5600 3 100W 8 -I13-99999F 8999 3 150W 16 -Ryzen12900 7200 3 130W 16 -XeonE-5500 17999 4 200W 32 -Shop HDD/SSD -Items 5 -WDYellow 1800 6 SATA_V 16Tb -WDPurple 1300 6 SATA_V 4Tb -QueenstonA900 1600 5 SATA_V 2Tb -Somsung4090 2100 5 SATA_V 4Tb -QueenstonKC999 3800 4 M.3 4Tb diff --git a/sem1/andreychetporov/hw3/MiniHW3.cpp b/sem1/andreychetporov/hw3/MiniHW3.cpp deleted file mode 100644 index 38e1911f..00000000 --- a/sem1/andreychetporov/hw3/MiniHW3.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include -#include -#include -#include - -class ItemBase { -protected: - std::string Name; - int price, weight; -public: - void set_data(std::string Name1, int price1, int weight1) { - Name = Name1; - price = price1; - weight = weight1; - } - std::string getName() { - return Name; - } - int getPrice() { - return price; - } - int getWeight() { - return weight; - } -}; - -class VideoCard: public ItemBase{ -protected: - std::string Memory, Energy; -public: - void set_data(std::string Name1, int price1, int weight1, std::string Memory1, std::string Energy1) { - Name = Name1; - price = price1; - weight = weight1; - Memory = Memory1; - Energy = Energy1; - } - std::string getMemory() { - return Memory; - } - std::string getEnergy() { - return Energy; - } -}; - -class CPU : public ItemBase { -protected: - std::string Energy; - int core; -public: - void set_data(std::string Name1, int price1, int weight1, std::string Energy1, int core1) { - Name = Name1; - price = price1; - weight = weight1; - Energy = Energy1; - core = core1; - } - std::string getEnergy() { - return Energy; - } - int getCore() { - return core; - } -}; - -class HardDrive : public ItemBase { -protected: - std::string Connection, Volume; -public: - void set_data(std::string Name1, int price1, int weight1, std::string Connection1, std::string Volume1) { - Name = Name1; - price = price1; - weight = weight1; - Volume = Volume1; - Connection = Connection1; - } - std::string getConnection() { - return Connection; - } - std::string getVolume() { - return Volume; - } -}; - - - - -int main() -{ - - std::string Shop, x, y; - std::ifstream in("Base.txt"); - std::vector videocard; - std::vector cpu; - std::vector harddrive; - while (in >> x >> y) { - if (x == "Shop") { - Shop = y; - } - else { - for (int i = 0; i < std::stoi(y); i++) { - if (Shop == "Videocards") { - std::string a1, a4, a5; - int a2, a3; - VideoCard copy; - in >> a1 >> a2 >> a3 >> a4 >> a5; - copy.set_data(a1, a2, a3, a4, a5); - videocard.push_back(copy); - - } - else if (Shop == "CPUs") { - std::string a1, a4; - int a2, a3, a5; - CPU copy; - in >> a1 >> a2 >> a3 >> a4 >> a5; - copy.set_data(a1, a2, a3, a4, a5); - cpu.push_back(copy); - } - else if (Shop == "HDD/SSD") { - std::string a1, a4, a5; - int a2, a3; - HardDrive copy; - in >> a1 >> a2 >> a3 >> a4 >> a5; - copy.set_data(a1, a2, a3, a4, a5); - harddrive.push_back(copy); - } - } - } - } - float price1 = 0.0, price2 = 0.0, price3 = 0.0, weight1 = 0.0, weight2 = 0.0, weight3 = 0.0; - for (int i = 0; i < size(videocard)-1; i++) { - VideoCard example1; - example1 = videocard[i]; - price1 += example1.getPrice() / 5.0; - weight1 += example1.getWeight() / 5.0; - } - std::cout << "Average price in Shop Video cards: " << price1 << "\t" << "Average weight: " << weight1 << "\n"; - for (int i = 0; i < size(cpu) - 1; i++) { - CPU example1; - example1 = cpu[i]; - price2 += example1.getPrice() / 5.0; - weight2 += example1.getWeight() / 5.0; - } - std::cout << "Average price in CPU Video cards: " << price2 << "\t" << "Average weight: " << weight2 << "\n"; - for (int i = 0; i < size(harddrive) - 1; i++) { - HardDrive example1; - example1 = harddrive[i]; - price3 += example1.getPrice() / 5.0; - weight3 += example1.getWeight() / 5.0; - } - std::cout << "Average price in Shop HDD/SSD cards: " << price3 << "\t" << "Average weight: " << weight3 << "\n"; -} diff --git a/sem1/mokrushinaOV/mini_homework1/task1.cpp b/sem1/mokrushinaOV/mini_homework1/task1.cpp deleted file mode 100644 index dbe29268..00000000 --- a/sem1/mokrushinaOV/mini_homework1/task1.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - - -int square_area(int side) { - int area = side * side; - return area; -} - -int main() -{ - int side; - - std::cout << "Enter square side: "; - std::cin >> side; - - std::cout << "Square area: " << square_area(side) << std::endl; -} diff --git a/sem1/mokrushinaOV/mini_homework1/task2.cpp b/sem1/mokrushinaOV/mini_homework1/task2.cpp deleted file mode 100644 index 3bd4fdff..00000000 --- a/sem1/mokrushinaOV/mini_homework1/task2.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - - -int trapezoid_area(int hight, int smaller_base, int bigger_base) { - int area = ((smaller_base + bigger_base) / 2) * hight; - return area; -} - - -int main() -{ - int hight; - int smaller_base; - int bigger_base; - - std::cout << "Enter trapezoid hight: "; - std::cin >> hight; - - std::cout << "Enter trapezoid's smaller base: "; - std::cin >> smaller_base; - - std::cout << "Enter trapezoid's bigger base: "; - std::cin >> bigger_base; - - std::cout << "Trapezoid area: " << trapezoid_area(hight, smaller_base, bigger_base) << std::endl; -} \ No newline at end of file diff --git a/sem1/mokrushinaOV/mini_homework1/task3.cpp b/sem1/mokrushinaOV/mini_homework1/task3.cpp deleted file mode 100644 index 744094a7..00000000 --- a/sem1/mokrushinaOV/mini_homework1/task3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - - -void fibonacci(int num_left, unsigned long int previous_previous = 0, unsigned long int previous = 1) { - - if (previous_previous == 0) { - num_left -= 2; - std::cout << previous_previous << " " << previous << " "; - } - - unsigned long int this_one = previous_previous + previous; - num_left--; - std::cout << this_one << " "; - - if (num_left == 0) { - return; - } - return fibonacci(num_left, previous, this_one); -} - -int main() -{ - int num_count; - std::cout << "set Fibonacci sequence length: "; - std::cin >> num_count; - fibonacci(num_count); -} \ No newline at end of file diff --git a/sem1/mokrushinaOV/mini_homework1/task4.cpp b/sem1/mokrushinaOV/mini_homework1/task4.cpp deleted file mode 100644 index 2e691c60..00000000 --- a/sem1/mokrushinaOV/mini_homework1/task4.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -int number_length(int number) { - int num_length = 0; - - for (; number > 0; num_length++) { // , - number /= 10; - } - return num_length; -} - -int number_backwards_that_returns_number(int given_num) { - long double new_num = 0; - - for (int num_length = number_length(given_num); num_length > 0; num_length--) { - new_num += (given_num % 10) * pow(10, num_length - 1); - given_num /= 10; - } - - return new_num; -} - -void number_backwards(int number) { - - while (number > 0) { // , - std::cout << number % 10; - number /= 10; - } -} - - -int main() -{ - int given_num; - std::cout << "Enter the number: "; - std::cin >> given_num; - - std::cout << "\nsimple method:" << std::endl; - number_backwards(given_num); - - std::cout << "\n\nmethod that returns a number:\n" << number_backwards_that_returns_number(given_num) << std::endl; -} diff --git a/sem1/mokrushinaOV/mini_homework2/task1.cpp b/sem1/mokrushinaOV/mini_homework2/task1.cpp deleted file mode 100644 index 7baf1b36..00000000 --- a/sem1/mokrushinaOV/mini_homework2/task1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -char althabet[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; - -std::string to_octal(int num, int syst) { - std::string res = ""; - - while (num > 0) { - res = althabet[num % syst] + res; - num /= syst; - } - - return res; -} - -int main() -{ - int syst, num; - - std::cout << "enter the number system from 2 to 36: "; - std::cin >> syst; - std::cout << std::endl; - - std::cout << "enter decimal non-negative number you want to transfer to this number system: "; - std::cin >> num; - std::cout << std::endl; - - std::cout << "your transfered number: " << to_octal(num, syst) << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/mokrushinaOV/mini_homework2/task1/task1/task1.cpp b/sem1/mokrushinaOV/mini_homework2/task1/task1/task1.cpp deleted file mode 100644 index 7baf1b36..00000000 --- a/sem1/mokrushinaOV/mini_homework2/task1/task1/task1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -char althabet[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; - -std::string to_octal(int num, int syst) { - std::string res = ""; - - while (num > 0) { - res = althabet[num % syst] + res; - num /= syst; - } - - return res; -} - -int main() -{ - int syst, num; - - std::cout << "enter the number system from 2 to 36: "; - std::cin >> syst; - std::cout << std::endl; - - std::cout << "enter decimal non-negative number you want to transfer to this number system: "; - std::cin >> num; - std::cout << std::endl; - - std::cout << "your transfered number: " << to_octal(num, syst) << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/mokrushinaOV/mini_homework2/task2.cpp b/sem1/mokrushinaOV/mini_homework2/task2.cpp deleted file mode 100644 index 40df364e..00000000 --- a/sem1/mokrushinaOV/mini_homework2/task2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -int main() -{ - int num; - - std::cout << "enter any number: "; - std::cin >> num; - std::cout << std::endl; - - while (num != 1) { - switch (num % 2) { - case 0: - num /= 2; - break; - case 1: - num = (num * 3 + 1) / 2; - break; - } - - std::cout << "now your number is " << num << std::endl; - } - - std::cout << "\nCollatz conjecture turned out to be correct this time" << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/mokrushinaOV/mini_homework2/task2/task2/task2.cpp b/sem1/mokrushinaOV/mini_homework2/task2/task2/task2.cpp deleted file mode 100644 index 40df364e..00000000 --- a/sem1/mokrushinaOV/mini_homework2/task2/task2/task2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -int main() -{ - int num; - - std::cout << "enter any number: "; - std::cin >> num; - std::cout << std::endl; - - while (num != 1) { - switch (num % 2) { - case 0: - num /= 2; - break; - case 1: - num = (num * 3 + 1) / 2; - break; - } - - std::cout << "now your number is " << num << std::endl; - } - - std::cout << "\nCollatz conjecture turned out to be correct this time" << std::endl; - - return 0; -} \ No newline at end of file diff --git a/sem1/mokrushinaOV/mini_homework3/mini_homework3_mokrushina.cpp b/sem1/mokrushinaOV/mini_homework3/mini_homework3_mokrushina.cpp deleted file mode 100644 index 05a76854..00000000 --- a/sem1/mokrushinaOV/mini_homework3/mini_homework3_mokrushina.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - - -std::vector split(std::string str_in, std::string str_to_split_by) { - - std::vector tokens; - size_t pos = 0; - std::string token; - - while ((pos = str_in.find(str_to_split_by)) != std::string::npos) { - token = str_in.substr(0, pos); - tokens.push_back(token); - str_in.erase(0, pos + str_to_split_by.length()); - } - - tokens.push_back(str_in); - - return tokens; -} - - -class Item { -public: - std::string name; - float price; - float wait; - - Item(std::vector arr) { - - name = arr[0]; - price = stof(arr[1]); - wait = stof(arr[2]); - } -}; - -class ShopBase { -public: - std::string name; - std::vector items; - - - ShopBase(std::vector lines_list) { - - name = lines_list[0]; - - for (std::string str : lines_list) { - std::vector item_vec = split(str, " "); - if (item_vec.size() == 3) { - items.push_back(Item(item_vec)); - } - } - } - -}; - - -class CustomShop : public ShopBase { -public: - CustomShop(std::vector lines_list) : ShopBase(lines_list) {} - - float mid_price() { - - float mid_price = 0; - for (Item item : items) { - mid_price += item.price; - } - - mid_price /= items.size(); - - return mid_price; - } - - float mid_wait() { - - float mid_wait = 0; - for (Item item : items) { - mid_wait += item.wait; - } - - mid_wait /= items.size(); - - return mid_wait; - } -}; - -int main() { - std::ifstream file; - std::vector stors_strs_list; - - file.open("stors_file.txt"); - - std::string file_text; - std::string line; - while (std::getline(file, line)) { - file_text += (line + "|"); - } - - file.close(); - - stors_strs_list = split(file_text, "Store "); - - std::vector stors; - for (std::string str : stors_strs_list) { - std::vector lines_list = split(str, "|"); - if (lines_list.size() >= 2) { - stors.push_back(CustomShop(lines_list)); - } - } - - for (CustomShop shop : stors) { - - std::cout << "for a shop " << shop.name << " awerege price is " << shop.mid_price() << " and awerege weight is " << shop.mid_price() << '\n'; - - } - - return 0; -} \ No newline at end of file diff --git a/sem1/mokrushinaOV/mini_homework3/stors_file.txt b/sem1/mokrushinaOV/mini_homework3/stors_file.txt deleted file mode 100644 index 96fcb1ed..00000000 --- a/sem1/mokrushinaOV/mini_homework3/stors_file.txt +++ /dev/null @@ -1,46 +0,0 @@ -Store cool_magic_stuff -magic_stik 999 111 -magic_potato 42 13 -magic_bomb 77 9 -cucumber 99999 1 -bird 33 12 -magic_wand 1500 5 -enchanted_ring 2500 2 -Store cool_games -rain_world 999999 0 -hollow_knight 756 34 -papers_please 666 11 -animal_well 98368 72 -tunic 38256 49 -celeste 1999 15 -stardew_valley 1499 25 -Store cool_books -mystery_novel 20 50 -science_fiction 15 30 -fantasy_epic 25 20 -cookbook 30 15 -biography 18 10 -Store cool_electronics -smartphone 999 25 -laptop 1299 15 -tablet 499 40 -smartwatch 199 60 -headphones 99 100 -Store cool_clothing -tshirt 19.99 200 -jeans 49.99 100 -jacket 89.99 50 -sneakers 69.99 75 -hat 24.99 150 -Store cool_toys -action_figure 15.99 80 -puzzle 12.99 60 -board_game 29.99 40 -stuffed_animal 19.99 100 -building_blocks 34.99 30 -Store cool_furniture -sofa 599.99 10 -dining_table 399.99 5 -chair 79.99 20 -bookshelf 199.99 15 -bed_frame 299.99 8 \ No newline at end of file diff --git a/sem2/Mikhaylova Anastasia/HW3/HW3.cpp b/sem2/Mikhaylova Anastasia/HW3/HW3.cpp new file mode 100644 index 00000000..9c9af0f7 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/HW3/HW3.cpp @@ -0,0 +1,128 @@ +// sfml 2.6.2 +#include +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif + +class ShutdownButton { +private: + sf::RectangleShape button; + sf::Text text; + sf::Font font; + sf::Clock timer; + float countdown; + bool activated; + std::chrono::time_point activationTime; + + float generateRandomTime() { + return 10.0f + static_cast(rand()) / (static_cast(RAND_MAX / 50.0f)); + } + +public: + ShutdownButton(float x, float y, float width, float height) { + button.setSize(sf::Vector2f(width, height)); + button.setPosition(x, y); + button.setFillColor(sf::Color(200, 50, 50)); + button.setOutlineThickness(2); + button.setOutlineColor(sf::Color::White); + + if (!font.loadFromFile("arial.ttf")) { + font.loadFromFile("arial.ttf"); + } + + text.setFont(font); + text.setString("Do not press!"); + text.setCharacterSize(24); + text.setFillColor(sf::Color::White); + + sf::FloatRect textRect = text.getLocalBounds(); + text.setOrigin(textRect.left + textRect.width / 2.0f, + textRect.top + textRect.height / 2.0f); + text.setPosition(x + width / 2.0f, y + height / 2.0f); + + countdown = generateRandomTime(); + activated = false; + timer.restart(); + } + + void draw(sf::RenderWindow& window) { + window.draw(button); + window.draw(text); + + if (activated) { + float remaining = countdown - timer.getElapsedTime().asSeconds(); + if (remaining > 0) { + sf::Text countdownText; + countdownText.setFont(font); + countdownText.setString("Shutting down in: " + std::to_string(static_cast(remaining)) + "s"); + countdownText.setCharacterSize(20); + countdownText.setFillColor(sf::Color::White); + countdownText.setPosition(button.getPosition().x, button.getPosition().y - 30); + window.draw(countdownText); + } + } + } + + void handleEvent(const sf::Event& event) { + if (event.type == sf::Event::MouseButtonPressed && + event.mouseButton.button == sf::Mouse::Left) { + sf::Vector2f mousePos(event.mouseButton.x, event.mouseButton.y); + + if (button.getGlobalBounds().contains(mousePos)) { + if (!activated) { + activated = true; + timer.restart(); + activationTime = std::chrono::steady_clock::now(); + button.setFillColor(sf::Color(150, 30, 30)); + text.setString("Cancel!"); + } + else { + activated = false; + button.setFillColor(sf::Color(200, 50, 50)); + text.setString("Do not press!"); + countdown = generateRandomTime(); + } + } + } + } + + void update() { + if (activated && timer.getElapsedTime().asSeconds() >= countdown) { +#ifdef _WIN32 + system("shutdown /s /t 0"); +#else + system("shutdown now"); +#endif + } + } +}; + +int main() { + srand(static_cast(time(nullptr))); + + sf::RenderWindow window(sf::VideoMode(400, 300), "Dangerous Button"); + ShutdownButton button(100, 100, 200, 80); + + while (window.isOpen()) { + sf::Event event; + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) { + window.close(); + } + button.handleEvent(event); + } + + button.update(); + + window.clear(sf::Color(30, 30, 30)); + button.draw(window); + window.display(); + } + + return 0; +} diff --git a/sem2/Mikhaylova Anastasia/HW4/Minhw4.cpp b/sem2/Mikhaylova Anastasia/HW4/Minhw4.cpp new file mode 100644 index 00000000..e8f9e9af --- /dev/null +++ b/sem2/Mikhaylova Anastasia/HW4/Minhw4.cpp @@ -0,0 +1,18 @@ +#include +#include +#include +#include + +int main() { + std::vector strings = { "apple", "banana", "cherry" }; + std::vector lengths; + auto countChars = [](const std::string& str) { return str.size(); }; + for (const auto& str : strings) { + lengths.push_back(countChars(str)); + } + for (const auto& l : lengths) { + std::cout << l << std::endl; + } + + return 0; +} diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/FileContentIndex/7825a13e-2603-410f-b315-3101a09bb75d.vsidx b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/FileContentIndex/7825a13e-2603-410f-b315-3101a09bb75d.vsidx new file mode 100644 index 00000000..814516ce Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/FileContentIndex/7825a13e-2603-410f-b315-3101a09bb75d.vsidx differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/.suo b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/.suo new file mode 100644 index 00000000..329a1230 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/.suo differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db new file mode 100644 index 00000000..13df4c9f Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db-shm b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db-shm new file mode 100644 index 00000000..218540fd Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db-shm differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db-wal b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db-wal new file mode 100644 index 00000000..95aae82c Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Browse.VC.db-wal differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/DocumentLayout.backup.json b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/DocumentLayout.backup.json new file mode 100644 index 00000000..18369ec0 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/DocumentLayout.backup.json @@ -0,0 +1,41 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{948321EB-4757-46FB-8ADA-79D189B08F3F}|Not_minesweeper.vcxproj|C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\Not_minesweeper.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{948321EB-4757-46FB-8ADA-79D189B08F3F}|Not_minesweeper.vcxproj|solutionrelative:Not_minesweeper.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 1, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Not_minesweeper.cpp", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\Not_minesweeper.cpp", + "RelativeDocumentMoniker": "Not_minesweeper.cpp", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\Not_minesweeper.cpp", + "RelativeToolTip": "Not_minesweeper.cpp", + "ViewState": "AgIAANAAAAAAAAAAAAAUwNIAAAAJAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2025-03-28T11:07:53.432Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/DocumentLayout.json b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/DocumentLayout.json new file mode 100644 index 00000000..18369ec0 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/DocumentLayout.json @@ -0,0 +1,41 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{948321EB-4757-46FB-8ADA-79D189B08F3F}|Not_minesweeper.vcxproj|C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\Not_minesweeper.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{948321EB-4757-46FB-8ADA-79D189B08F3F}|Not_minesweeper.vcxproj|solutionrelative:Not_minesweeper.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 1, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Not_minesweeper.cpp", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\Not_minesweeper.cpp", + "RelativeDocumentMoniker": "Not_minesweeper.cpp", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\Not_minesweeper\\Not_minesweeper.cpp", + "RelativeToolTip": "Not_minesweeper.cpp", + "ViewState": "AgIAANAAAAAAAAAAAAAUwNIAAAAJAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", + "WhenOpened": "2025-03-28T11:07:53.432Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Solution.VC.db b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Solution.VC.db new file mode 100644 index 00000000..7a3266d3 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/Solution.VC.db differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/ipch/AutoPCH/a7b09b60477eaca1/NOT_MINESWEEPER.ipch b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/ipch/AutoPCH/a7b09b60477eaca1/NOT_MINESWEEPER.ipch new file mode 100644 index 00000000..7f24c05f Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/.vs/Not_minesweeper/v17/ipch/AutoPCH/a7b09b60477eaca1/NOT_MINESWEEPER.ipch differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Arial.ttf b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Arial.ttf new file mode 100644 index 00000000..7ff88f22 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Arial.ttf differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.cpp b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.cpp new file mode 100644 index 00000000..2e9f3250 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.cpp @@ -0,0 +1,226 @@ +#include +#include +#include +#include + +#define CELLSIZE_M 10 +#define CELLSIZE_N 10 +#define CHANCE_FOOD 10 +#define ENERGY_MAX 100 +#define CELLSIZE_SCREEN 100.f +#define HEALTH_POINT_DECREASE_1 20 // Снижение здоровья при открытии клетки с первым типом врага +#define HEALTH_POINT_DECREASE_2 30 // Снижение здоровья при открытии клетки с вторым типом врага +#define HUNGER_DECREASE 5 // Снижение голода при открытии любой клетки + +enum CellType { + Type_Grass, + Type_Hill, + Type_Forest, + Type_Stone, + Type_Sand, + Type_Snow, + Type_Water, + Type_Enemy1, // Первый тип врага (с уменьшением здоровья на 20) + Type_Enemy2, // Второй тип врага (с уменьшением здоровья на 30) + Type_End +}; + +enum TextureType { + Texture_Grass, + Texture_Hill, + Texture_Forest, + Texture_Stone, + Texture_Sand, + Texture_Snow, + Texture_Water, + Texture_Hide, + Texture_Soup, + Texture_Enemy1, // Текстура для первого врага + Texture_Enemy2, // Текстура для второго врага + Texture_End +}; + +struct Cell { + bool isHidden; + bool isFood; + CellType cellType; +}; + +bool isWinOfGame(const Cell cells[CELLSIZE_M][CELLSIZE_N]) { + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + if (cells[x][y].isHidden) { + return false; + } + } + } + return true; +} + +bool isLoseOfGame(const int& healthPoint) { + return healthPoint <= 0; +} + +bool isLoseOfHunger(const int& hunger) { + return hunger <= 0; +} + +void clickTile(int& healthPoint, int& hunger, + const sf::Vector2i& mouseCoord, + Cell cells[CELLSIZE_M][CELLSIZE_N], + sf::RectangleShape shapes[CELLSIZE_M][CELLSIZE_N], + sf::Texture textures[TextureType::Texture_End]) { + + int x = std::max(0, std::min(mouseCoord.x / static_cast(CELLSIZE_SCREEN), CELLSIZE_M - 1)); + int y = std::max(0, std::min(mouseCoord.y / static_cast(CELLSIZE_SCREEN), CELLSIZE_N - 1)); + + cells[x][y].isHidden = false; + + if (cells[x][y].isFood) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Soup]); + healthPoint = ENERGY_MAX; + hunger = 100; // Сбросить голод + } + else if (cells[x][y].cellType == Type_Enemy1) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Enemy1]); + healthPoint -= HEALTH_POINT_DECREASE_1; // Уменьшаем здоровье на 20 + } + else if (cells[x][y].cellType == Type_Enemy2) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Enemy2]); + healthPoint -= HEALTH_POINT_DECREASE_2; // Уменьшаем здоровье на 30 + } + else { + shapes[x][y].setTexture(&textures[cells[x][y].cellType]); + hunger -= HUNGER_DECREASE; // Уменьшаем голод + } +} + +int main() { + int healthPoint = ENERGY_MAX; + int hunger = 100; // Начальный уровень голода + bool gameOver = false; // Флаг окончания игры + + srand(static_cast(time(0))); + + Cell cells[CELLSIZE_M][CELLSIZE_N]; + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + cells[x][y].isHidden = true; + cells[x][y].isFood = rand() % 100 < CHANCE_FOOD; + + int enemyChance = rand() % 100; + if (enemyChance < 5) { // 5% шанс на первый тип врага + cells[x][y].cellType = Type_Enemy1; + } + else if (enemyChance < 10) { // 5% шанс на второй тип врага + cells[x][y].cellType = Type_Enemy2; + } + else { + cells[x][y].cellType = static_cast(rand() % (CellType::Type_End - 1)); + } + } + } + + sf::RenderWindow window( + sf::VideoMode(static_cast(CELLSIZE_SCREEN * CELLSIZE_M), + static_cast(CELLSIZE_SCREEN * CELLSIZE_N)), + "NOT MINESWEEPER GAME"); + + sf::Font font; + font.loadFromFile("arial.ttf"); + + sf::Text textHealthPoint; + sf::Text textHunger; + sf::Text textCondition; + + + textHealthPoint.setFont(font); + textHealthPoint.setCharacterSize(CELLSIZE_SCREEN / 2); + textHealthPoint.setFillColor(sf::Color::Red); + textHealthPoint.setStyle(sf::Text::Bold | sf::Text::Underlined); + + textHunger.setFont(font); + textHunger.setCharacterSize(CELLSIZE_SCREEN / 2); + textHunger.setFillColor(sf::Color::Green); + textHunger.setStyle(sf::Text::Bold | sf::Text::Underlined); + textHunger.setPosition(10.f, CELLSIZE_SCREEN); // Сдвигаем текст голода ниже + + textCondition.setFont(font); + textCondition.setCharacterSize(CELLSIZE_SCREEN); + textCondition.setFillColor(sf::Color::Red); + textCondition.setStyle(sf::Text::Bold | sf::Text::Underlined); + textCondition.setPosition(10.f, CELLSIZE_SCREEN * CELLSIZE_N - 300.f); // Сдвигаем текст поражения вниз + + sf::RectangleShape shapes[CELLSIZE_M][CELLSIZE_N]; + sf::Texture textures[TextureType::Texture_End]; + + textures[TextureType::Texture_Grass].loadFromFile("grass.png"); + textures[TextureType::Texture_Hill].loadFromFile("hill.png"); + textures[TextureType::Texture_Forest].loadFromFile("forest.png"); + textures[TextureType::Texture_Stone].loadFromFile("stone.png"); + textures[TextureType::Texture_Sand].loadFromFile("sand.png"); + textures[TextureType::Texture_Snow].loadFromFile("snow.png"); + textures[TextureType::Texture_Water].loadFromFile("water.png"); + textures[TextureType::Texture_Hide].loadFromFile("hide.png"); + textures[TextureType::Texture_Soup].loadFromFile("soup.png"); + textures[TextureType::Texture_Enemy1].loadFromFile("enemy1.png"); // Текстура для первого врага + textures[TextureType::Texture_Enemy2].loadFromFile("enemy2.png"); // Текстура для второго врага + + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Hide]); + shapes[x][y].setPosition(sf::Vector2f(x * CELLSIZE_SCREEN, y * CELLSIZE_SCREEN)); + shapes[x][y].setSize({ CELLSIZE_SCREEN, CELLSIZE_SCREEN }); + } + } + + bool mousepressed = false; + while (window.isOpen()) { + sf::Event event; + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) + window.close(); + + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) + window.close(); + + if (!sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + mousepressed = false; + } + + if (!mousepressed && sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + mousepressed = true; + sf::Vector2i mouseCoord = sf::Mouse::getPosition(window); + clickTile(healthPoint, hunger, mouseCoord, cells, shapes, textures); + textHealthPoint.setString("HP: " + std::to_string(healthPoint)); + textHunger.setString("Hunger: " + std::to_string(hunger)); + + if (isWinOfGame(cells) && !gameOver) { + textCondition.setString("WINNER!!!"); + gameOver = true; + } + else if (isLoseOfGame(healthPoint) && !gameOver) { + textCondition.setString("LOSER!!!"); + gameOver = true; + } + else if (isLoseOfHunger(hunger) && !gameOver) { + textCondition.setString("STARVED!!!"); + gameOver = true; + } + } + } + + window.clear(); + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + window.draw(shapes[x][y]); + } + } + window.draw(textHealthPoint); + window.draw(textHunger); + window.draw(textCondition); + window.display(); + } + + return 0; +} diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.sln b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.sln new file mode 100644 index 00000000..f8633411 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.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}") = "Not_minesweeper", "Not_minesweeper.vcxproj", "{948321EB-4757-46FB-8ADA-79D189B08F3F}" +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 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Debug|x64.ActiveCfg = Debug|x64 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Debug|x64.Build.0 = Debug|x64 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Debug|x86.ActiveCfg = Debug|Win32 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Debug|x86.Build.0 = Debug|Win32 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Release|x64.ActiveCfg = Release|x64 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Release|x64.Build.0 = Release|x64 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Release|x86.ActiveCfg = Release|Win32 + {948321EB-4757-46FB-8ADA-79D189B08F3F}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5B0A6672-644A-441C-9700-60B22DF2147E} + EndGlobalSection +EndGlobal diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj new file mode 100644 index 00000000..49a22277 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {948321eb-4757-46fb-8ada-79d189b08f3f} + Notminesweeper + 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 + SFML_DYNAMIC;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + C:\SFML-2.6.2\include;%(AdditionalIncludeDirectories) + + + Console + true + C:\SFML-2.6.2\lib;%(AdditionalLibraryDirectories) + sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-audio-d.lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj.filters b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj.filters new file mode 100644 index 00000000..2c6f3669 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.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/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj.user b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/Not_minesweeper.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy.png new file mode 100644 index 00000000..b70746bc Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy1.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy1.png new file mode 100644 index 00000000..08526323 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy1.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy2.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy2.png new file mode 100644 index 00000000..2ac976ae Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/enemy2.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/forest.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/forest.png new file mode 100644 index 00000000..c3428de6 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/forest.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/grass.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/grass.png new file mode 100644 index 00000000..dfce21cd Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/grass.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/hide.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/hide.png new file mode 100644 index 00000000..412fd2d9 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/hide.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/hill.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/hill.png new file mode 100644 index 00000000..7194c7be Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/hill.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/sand.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/sand.png new file mode 100644 index 00000000..01027e4b Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/sand.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/snow.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/snow.png new file mode 100644 index 00000000..4fdb8565 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/snow.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/soup.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/soup.png new file mode 100644 index 00000000..d89bc56c Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/soup.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/stone.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/stone.png new file mode 100644 index 00000000..6eceb199 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/stone.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/water.png b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/water.png new file mode 100644 index 00000000..483a5965 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/water.png differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/Not_minesweeper.exe b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/Not_minesweeper.exe new file mode 100644 index 00000000..25adb2b0 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/Not_minesweeper.exe differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/Not_minesweeper.pdb b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/Not_minesweeper.pdb new file mode 100644 index 00000000..ce56deb0 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/Not_minesweeper.pdb differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp100d.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp100d.dll new file mode 100644 index 00000000..ceb26cb6 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp100d.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp110.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp110.dll new file mode 100644 index 00000000..93fab568 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp110.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp110d.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp110d.dll new file mode 100644 index 00000000..875cb6b2 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcp110d.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr100d.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr100d.dll new file mode 100644 index 00000000..6853775b Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr100d.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr110.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr110.dll new file mode 100644 index 00000000..1ce960d7 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr110.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr110d.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr110d.dll new file mode 100644 index 00000000..9581499e Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/msvcr110d.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/openal32.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/openal32.dll new file mode 100644 index 00000000..7760c05f Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/openal32.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-audio-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-audio-2.dll new file mode 100644 index 00000000..8fd4bc60 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-audio-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-audio-d-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-audio-d-2.dll new file mode 100644 index 00000000..d07c7a26 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-audio-d-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-graphics-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-graphics-2.dll new file mode 100644 index 00000000..c814d18e Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-graphics-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-graphics-d-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-graphics-d-2.dll new file mode 100644 index 00000000..a87fc45f Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-graphics-d-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-network-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-network-2.dll new file mode 100644 index 00000000..eea1b210 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-network-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-network-d-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-network-d-2.dll new file mode 100644 index 00000000..86da6cbf Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-network-d-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-system-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-system-2.dll new file mode 100644 index 00000000..663abdde Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-system-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-system-d-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-system-d-2.dll new file mode 100644 index 00000000..fedc2e03 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-system-d-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-window-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-window-2.dll new file mode 100644 index 00000000..719f93aa Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-window-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-window-d-2.dll b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-window-d-2.dll new file mode 100644 index 00000000..9c74e594 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/Minihw2/Not_minesweeper/Not_minesweeper/x64/Debug/sfml-window-d-2.dll differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/Arial.ttf b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/Arial.ttf new file mode 100644 index 00000000..7ff88f22 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/Arial.ttf differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/Not_minesweeper.cpp b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/Not_minesweeper.cpp new file mode 100644 index 00000000..2e9f3250 --- /dev/null +++ b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/Not_minesweeper.cpp @@ -0,0 +1,226 @@ +#include +#include +#include +#include + +#define CELLSIZE_M 10 +#define CELLSIZE_N 10 +#define CHANCE_FOOD 10 +#define ENERGY_MAX 100 +#define CELLSIZE_SCREEN 100.f +#define HEALTH_POINT_DECREASE_1 20 // Снижение здоровья при открытии клетки с первым типом врага +#define HEALTH_POINT_DECREASE_2 30 // Снижение здоровья при открытии клетки с вторым типом врага +#define HUNGER_DECREASE 5 // Снижение голода при открытии любой клетки + +enum CellType { + Type_Grass, + Type_Hill, + Type_Forest, + Type_Stone, + Type_Sand, + Type_Snow, + Type_Water, + Type_Enemy1, // Первый тип врага (с уменьшением здоровья на 20) + Type_Enemy2, // Второй тип врага (с уменьшением здоровья на 30) + Type_End +}; + +enum TextureType { + Texture_Grass, + Texture_Hill, + Texture_Forest, + Texture_Stone, + Texture_Sand, + Texture_Snow, + Texture_Water, + Texture_Hide, + Texture_Soup, + Texture_Enemy1, // Текстура для первого врага + Texture_Enemy2, // Текстура для второго врага + Texture_End +}; + +struct Cell { + bool isHidden; + bool isFood; + CellType cellType; +}; + +bool isWinOfGame(const Cell cells[CELLSIZE_M][CELLSIZE_N]) { + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + if (cells[x][y].isHidden) { + return false; + } + } + } + return true; +} + +bool isLoseOfGame(const int& healthPoint) { + return healthPoint <= 0; +} + +bool isLoseOfHunger(const int& hunger) { + return hunger <= 0; +} + +void clickTile(int& healthPoint, int& hunger, + const sf::Vector2i& mouseCoord, + Cell cells[CELLSIZE_M][CELLSIZE_N], + sf::RectangleShape shapes[CELLSIZE_M][CELLSIZE_N], + sf::Texture textures[TextureType::Texture_End]) { + + int x = std::max(0, std::min(mouseCoord.x / static_cast(CELLSIZE_SCREEN), CELLSIZE_M - 1)); + int y = std::max(0, std::min(mouseCoord.y / static_cast(CELLSIZE_SCREEN), CELLSIZE_N - 1)); + + cells[x][y].isHidden = false; + + if (cells[x][y].isFood) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Soup]); + healthPoint = ENERGY_MAX; + hunger = 100; // Сбросить голод + } + else if (cells[x][y].cellType == Type_Enemy1) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Enemy1]); + healthPoint -= HEALTH_POINT_DECREASE_1; // Уменьшаем здоровье на 20 + } + else if (cells[x][y].cellType == Type_Enemy2) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Enemy2]); + healthPoint -= HEALTH_POINT_DECREASE_2; // Уменьшаем здоровье на 30 + } + else { + shapes[x][y].setTexture(&textures[cells[x][y].cellType]); + hunger -= HUNGER_DECREASE; // Уменьшаем голод + } +} + +int main() { + int healthPoint = ENERGY_MAX; + int hunger = 100; // Начальный уровень голода + bool gameOver = false; // Флаг окончания игры + + srand(static_cast(time(0))); + + Cell cells[CELLSIZE_M][CELLSIZE_N]; + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + cells[x][y].isHidden = true; + cells[x][y].isFood = rand() % 100 < CHANCE_FOOD; + + int enemyChance = rand() % 100; + if (enemyChance < 5) { // 5% шанс на первый тип врага + cells[x][y].cellType = Type_Enemy1; + } + else if (enemyChance < 10) { // 5% шанс на второй тип врага + cells[x][y].cellType = Type_Enemy2; + } + else { + cells[x][y].cellType = static_cast(rand() % (CellType::Type_End - 1)); + } + } + } + + sf::RenderWindow window( + sf::VideoMode(static_cast(CELLSIZE_SCREEN * CELLSIZE_M), + static_cast(CELLSIZE_SCREEN * CELLSIZE_N)), + "NOT MINESWEEPER GAME"); + + sf::Font font; + font.loadFromFile("arial.ttf"); + + sf::Text textHealthPoint; + sf::Text textHunger; + sf::Text textCondition; + + + textHealthPoint.setFont(font); + textHealthPoint.setCharacterSize(CELLSIZE_SCREEN / 2); + textHealthPoint.setFillColor(sf::Color::Red); + textHealthPoint.setStyle(sf::Text::Bold | sf::Text::Underlined); + + textHunger.setFont(font); + textHunger.setCharacterSize(CELLSIZE_SCREEN / 2); + textHunger.setFillColor(sf::Color::Green); + textHunger.setStyle(sf::Text::Bold | sf::Text::Underlined); + textHunger.setPosition(10.f, CELLSIZE_SCREEN); // Сдвигаем текст голода ниже + + textCondition.setFont(font); + textCondition.setCharacterSize(CELLSIZE_SCREEN); + textCondition.setFillColor(sf::Color::Red); + textCondition.setStyle(sf::Text::Bold | sf::Text::Underlined); + textCondition.setPosition(10.f, CELLSIZE_SCREEN * CELLSIZE_N - 300.f); // Сдвигаем текст поражения вниз + + sf::RectangleShape shapes[CELLSIZE_M][CELLSIZE_N]; + sf::Texture textures[TextureType::Texture_End]; + + textures[TextureType::Texture_Grass].loadFromFile("grass.png"); + textures[TextureType::Texture_Hill].loadFromFile("hill.png"); + textures[TextureType::Texture_Forest].loadFromFile("forest.png"); + textures[TextureType::Texture_Stone].loadFromFile("stone.png"); + textures[TextureType::Texture_Sand].loadFromFile("sand.png"); + textures[TextureType::Texture_Snow].loadFromFile("snow.png"); + textures[TextureType::Texture_Water].loadFromFile("water.png"); + textures[TextureType::Texture_Hide].loadFromFile("hide.png"); + textures[TextureType::Texture_Soup].loadFromFile("soup.png"); + textures[TextureType::Texture_Enemy1].loadFromFile("enemy1.png"); // Текстура для первого врага + textures[TextureType::Texture_Enemy2].loadFromFile("enemy2.png"); // Текстура для второго врага + + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + shapes[x][y].setTexture(&textures[TextureType::Texture_Hide]); + shapes[x][y].setPosition(sf::Vector2f(x * CELLSIZE_SCREEN, y * CELLSIZE_SCREEN)); + shapes[x][y].setSize({ CELLSIZE_SCREEN, CELLSIZE_SCREEN }); + } + } + + bool mousepressed = false; + while (window.isOpen()) { + sf::Event event; + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) + window.close(); + + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) + window.close(); + + if (!sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + mousepressed = false; + } + + if (!mousepressed && sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + mousepressed = true; + sf::Vector2i mouseCoord = sf::Mouse::getPosition(window); + clickTile(healthPoint, hunger, mouseCoord, cells, shapes, textures); + textHealthPoint.setString("HP: " + std::to_string(healthPoint)); + textHunger.setString("Hunger: " + std::to_string(hunger)); + + if (isWinOfGame(cells) && !gameOver) { + textCondition.setString("WINNER!!!"); + gameOver = true; + } + else if (isLoseOfGame(healthPoint) && !gameOver) { + textCondition.setString("LOSER!!!"); + gameOver = true; + } + else if (isLoseOfHunger(hunger) && !gameOver) { + textCondition.setString("STARVED!!!"); + gameOver = true; + } + } + } + + window.clear(); + for (int x = 0; x < CELLSIZE_M; x++) { + for (int y = 0; y < CELLSIZE_N; y++) { + window.draw(shapes[x][y]); + } + } + window.draw(textHealthPoint); + window.draw(textHunger); + window.draw(textCondition); + window.display(); + } + + return 0; +} diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy.png new file mode 100644 index 00000000..b70746bc Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy1.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy1.png new file mode 100644 index 00000000..08526323 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy1.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy2.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy2.png new file mode 100644 index 00000000..2ac976ae Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/enemy2.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/forest.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/forest.png new file mode 100644 index 00000000..c3428de6 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/forest.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/grass.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/grass.png new file mode 100644 index 00000000..dfce21cd Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/grass.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/hide.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/hide.png new file mode 100644 index 00000000..412fd2d9 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/hide.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/hill.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/hill.png new file mode 100644 index 00000000..7194c7be Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/hill.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/snow.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/snow.png new file mode 100644 index 00000000..4fdb8565 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/snow.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/soup.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/soup.png new file mode 100644 index 00000000..d89bc56c Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/soup.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/stone.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/stone.png new file mode 100644 index 00000000..6eceb199 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/stone.png differ diff --git a/sem2/Mikhaylova Anastasia/minihw2_Remake/game/water.png b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/water.png new file mode 100644 index 00000000..483a5965 Binary files /dev/null and b/sem2/Mikhaylova Anastasia/minihw2_Remake/game/water.png differ diff --git a/task1a.cpp b/task1a.cpp deleted file mode 100644 index b0f6ae55..00000000 --- a/task1a.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -void fun(int number) -{ - while (number != 1) - { - if (number % 2 == 0) - { - number = number / 2; - } - else if (number % 2 == 1) - { - number = number * 3 + 1; - } - } - - std::cout << number << std::endl; -} - -int main() -{ - int number; - - std::cout << "Введите число" << std::endl; - std::cin >> number; - - fun(number); -} \ No newline at end of file diff --git a/task1b.cpp b/task1b.cpp deleted file mode 100644 index 489fc7a8..00000000 --- a/task1b.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -int main() -{ - std::string num = ""; - - int a; - std::cin >> a; - - while (a > 0) - { - if (a % 16 == 10) - { - num = "A" + num; - } - else if (a % 16 == 11) - { - num = "B" + num; - } - else if (a % 16 == 12) - { - num = "C" + num; - } - else if (a % 16 == 13) - { - num = "D" + num; - } - else if (a % 16 == 14) - { - num = "E" + num; - } - else if (a % 16 == 15) - { - num = "F" + num; - } - else { - num = std::to_string(a % 16) + num; - } - - a = a / 16; - } - - std::cout << num << std::endl; -} \ No newline at end of file diff --git a/task2.cpp b/task2.cpp deleted file mode 100644 index 398974e9..00000000 --- a/task2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -void fun(int a) -{ - std::string num = ""; - - while (a > 0) - { - num = std::to_string(a % 8) + num; - a = a / 8; - } - - std::cout << num; -} - -int main() -{ - int a; - std::cin >> a; - fun(a); -} \ No newline at end of file