commit 88051b9775acc993d3e58b10c4acd8ebad2b8d4a Author: Michael Plotnikov Date: Tue Dec 10 16:54:46 2024 +0500 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66f17d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*/.vs +*.tlog +*.obj +*.pdb +*.exe +*.dll +*.iobj +*.ipdb +*.log +*.ilk +*.idb +*.exe.recipe +*.obj.enc diff --git a/ConsoleApplication1/ConsoleApplication1.sln b/ConsoleApplication1/ConsoleApplication1.sln new file mode 100644 index 0000000..6ca5f12 --- /dev/null +++ b/ConsoleApplication1/ConsoleApplication1.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.vcxproj", "{CA9319C6-B95D-4EA3-880F-5067549B933E}" +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 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Debug|x64.ActiveCfg = Debug|x64 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Debug|x64.Build.0 = Debug|x64 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Debug|x86.ActiveCfg = Debug|Win32 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Debug|x86.Build.0 = Debug|Win32 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Release|x64.ActiveCfg = Release|x64 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Release|x64.Build.0 = Release|x64 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Release|x86.ActiveCfg = Release|Win32 + {CA9319C6-B95D-4EA3-880F-5067549B933E}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.cpp b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.cpp new file mode 100644 index 0000000..e081b7f --- /dev/null +++ b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.cpp @@ -0,0 +1,629 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +#include +#include +#include +//#include + +using namespace std; + + +//void print(string word) +//{ +// cout << word << endl; +//} +//int add(int a, int b) +//{ +// return (a + b); +//} +//void print(string word) +//{ +// cout << word << endl; +//} +// +//void print(int word) +//{ +// cout << word << endl; +//} +// +//void add(int a, int b) +//{ +// int res = a + b; +// print(res); +//} +// +//void add(int a, int b, int c) +//{ +// int res = a + b + c; +// print(res); +//} + +//void minimal(int *arr, int len) +//{ +// int min = *arr; +// for (int i = 0; i < len; i++) +// { +// if (min > *(arr + i)) +// min = *(arr + i); +// } +// cout << "Minimal " << min << endl; +//} + + + +//struct Point { +// int x, y; +//}; +// +//struct Tree { +// string name; +// int ages; +// bool is_alive; +// float height; +// Point place; +// +// +// void get_info() { +// cout << "Name: " << name << ". Age: " << ages << "Place: " << place << endl; +// } +// +//}; + +//enum Options { +// open, +// close, +// wait, +// del +//}; +// +//struct File { +// int weight; +// string name; +// Options options; +//}; + +//void divide(float a, float b) { +// if (b == 0) throw 100; +// +// else cout << (a / b); +//} + +//class Building { +//private: +// int year; +// string type; +// +//public: +// Building(int y, string t) { +// set_data(y, t); +// }; +// +// Building(int y) { +// year = y; +// cout << "Данные установлены" << endl; +// }; +// +// Building() {} +// +// void set_data(int year, string type) { +// this->year = year; +// this->type = type; +// } +// +// void set_data(int y) { +// year = y; +// } +// +// void get_info() { +// cout << "Type: " << type << ". Year: " << year << endl; +// } +// +// ~Building() { +// cout << "Delete object" << endl; +// } +// +//}; + +//class Car; +//class Person { +//private: +// int age; +// string name; +//public: +// Person(string name) { +// this->name = name; +// } +// friend void info_car(Car& car, Person& person); +//}; +// +//class Car { +//private: +// string name; +//public: +// Car(string name) { +// this->name = name; +// } +// friend void info_car(Car& car, Person& person); +//}; +// +//void info_car(Car& car, Person& person) { +// cout << "Человек с именем: " << person.name << ", имеет машину " << car.name << "." << endl; +//} + + + +//class Person; +//class Dog { +//private: +// int health = 100; +//public: +// friend class Person; +//}; +// +//class Person { +//public: +// void Damage(Dog& dog) { +// dog.health -= 20; +// cout << "Health of animal: " << dog.health << endl; +// } +// +// void Heal(Dog& dog) { +// dog.health += 10; +// cout << "Health of animal: " << dog.health << endl; +// } +// +// void Kill(Dog& dog) { +// dog.health = 0; +// cout << "Health of animal: " << dog.health << endl; +// } +//}; + + + +//class PC { +//protected: +// int diagonal; +// string os; +//public: +// PC(int diagonal, string os) { +// this->diagonal = diagonal; +// this->os = os; +// } +// void get_info() { +// cout << "OS: " << os << ". Diagonal " << diagonal << endl; +// } +//}; +// +//class Laptop: public PC { +//private: +// float weight; +//public: +// Laptop(int diagonal, string os, float weight): PC(diagonal, os) { +// // this->diagonal = 12; +// this->weight = weight; +// } +// void get_info() { +// PC::get_info(); +// cout << "Weight: " << weight << endl; +// } +//}; + +//template +// +//void print_arr(T* arr, int len) { +// for (T2 i = 0; i < len; i++) +// cout << *(arr + i) << " "; +// cout << endl; +//} +// +//void print_arr(float* arr, int len) { +// for (int i = 0; i < len; i++) +// cout << *(arr + i) << " "; +// cout << endl; +//} + +template +class Arrays { +private: + int len; + T* arr; +public: + Arrays(T* a, int len) { + Arrays::len = len; + arr = new T[len]; + for (int i = 0; i < len; i++) + arr[i] = a[i]; + } + + void get() { + for (int i = 0; i < len; i++) + cout << arr[i] << " "; + cout << endl; + } + ~Arrays() { + delete[] arr; + } +}; + +int main(int argc, char **argv) +{ + char text[] = "Print thi!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!s!"; + char dest[50]; + strcpy(dest, text); + return 0; + + + for (int i = 0; i < argc; i++) { + printf("arg %d : \"%s\"\n", i, argv[i]); + } + //getchar(); + + setlocale(LC_ALL, "RU"); + + int arr1[] = {3, 6, 8}; + Arrays obj1(arr1, 3); + obj1.get(); + + float arr2[] = { 332.12f, 69.23f, 812.34f }; + Arrays obj2(arr2, 3); + obj2.get(); + +#pragma region OLD_CODE + /*int arr1[] = { 5, 6, 3, 21, 13, 643 }; + print_arr (arr1, 6); + + float arr2[] = { 4.123f, 213.13f, 123.213f }; + print_arr (arr2, 3);*/ + + /*Laptop mac(16, "Mac", 1.5f); + mac.get_info();*/ + + + /*Dog skuby; + Person Alex; + Alex.Damage(skuby); + Alex.Damage(skuby); + Alex.Heal(skuby); + Alex.Heal(skuby); + Alex.Heal(skuby); + Alex.Kill(skuby);*/ + + //Car bmw("BMW"); + //Person Jhon("Jhon"); + //info_car(bmw, Jhon); + + + //Building school(2000, "Школа"); + //school.get_info(); + + + //Building house(2010); + //house.get_info(); + + + /*string str1 = "Hello"; + string str2 = "World"; + + str1.append(str2); + str1.pop_back(); + str1.push_back('!'); + str1.pop_back(); + str1.resize(5); + + cout << str1 << " - " << str1.length() << endl; + cout << str1; + + cout << pow(2, 3) << endl; + cout << abs(-3) << endl; + cout << sin(1) << endl; + cout << cos(1) << endl; + cout << sqrt(16) << endl; + cout << ceil(1.78f) << endl; + cout << ceil(1.08f) << " - " << floor(1.99f) << " - " << round(1.55f) << endl;*/ + + + + /*try { + divide(5.2f, 0.0f); + + } + catch (int err) { + if (err == 100) cout << "Ошибка при делении" << endl; + } + + divide(5.2f, 0.0f);*/ + + + + + + + + + + + + + //File my_file; + //my_file.weight = 1.5f; + //my_file.name = "test.txt"; + //my_file.options = Options::close; + + ////cout << my_file.options; + + //if (my_file.options == Options::close) + // cout << "File is close" << endl; + + + //Tree dub; + //dub.name = "Дуб"; + //dub.ages = 24; + //dub.place.x = 100; + //dub.place.y = 10; + + //Tree yelka; + //yelka.name = "Ёлка"; + //yelka.ages = 5; + //yelka.place.x = 1200; + //yelka.place.y = 1013; + + + ////cout << dub.name << " - " << yelka.name; + + //dub.get_info(); + //yelka.get_info(); + + + /*ofstream file("test.txt", ios_base::out); + if (file.is_open()) + { + file << "Hello world my friends!)"; + file.close(); + }*/ + + //ifstream file("test.txt"); + //if (file.is_open()) { + // //string temp; + // //file >> temp; + // char temp[100]; + // file.getline(temp, 100); + // cout << temp << endl; + // file.close(); + //} + + + ////Практический пример + //int arr[] = { -2,5,3,2,1,33,42 }; + //minimal(arr, 6); + ////Ссылки + //int num = 10; + //int &a = num; + + //a = 15; + //cout << &num << "-" << num << endl; + //cout << &a << "-" << a << endl; + ////Адрес меньше значения переменной + + ////Указатели + //int val = 12; + //int* ptrval = &val; + + //*ptrval = 20; + //ptrval = nullptr; + //cout << &val << "-" << val << endl; + //cout << ptrval << "-" << *ptrval << endl; + //ptr - pointer + +//{ +// setlocale(LC_ALL, "RU"); +// +// print("some"); +// add(5, 6); +// add(5, 6, 9); + + //print("Hello"); + //string words = "World"; + //print(words); + //print("!!!"); + + /*int res1 = add(5, 7); + int res2 = add(51, 7); + if (res1 > res2) + { + cout << res1; + } + else + cout << res2;*/ + //char word[] = "Hi!"; //{'H','i','!'}; + //for (int i = 0; i < 3; i++) + // cout << word[i]; + + ////getline(cin, word); + + //string words = "Hello World!"; + ////words[0] = 'W'; + //cout << "\n" << words << endl; + + //cin >> words; + //cout << "new" << words; + + + + /*int nums[3]; + nums[0] = 56; + nums[1] = 26; + nums[2] = 36; + + nums[0] = 20; + cout << nums[0];*/ + + + /*float nums2[3] = {3, 5, 6}; + for (int i = 0; i < 3; i++) + { + cout << "Element " << i << ": " << nums2[i] << endl; + }*/ + + /* + float Numbers[5]; + for (int i = 0; i < 5; i++) + { + cout << "Enter number " << i << endl; + cin >> Numbers[i]; + } + + float summa = 0; + float min = Numbers[0]; + for (int i = 0; i < 5; i++) + { + summa += Numbers[i]; + if (Numbers[i] < min) + min = Numbers[i]; + } + cout << "Summa " << summa << endl; + cout << "Min " << min << endl; + for (int i = 0; i < 5; i++) + { + cout << "Enter number "<< i << Numbers[i] << endl; + }*/ + + //Многомерные массивы + + /*int matrix[3][2] = + { + {3,2}, + {-2,5}, + {8,9} + };*/ + //matrix + //cout << matrix[1][1] << endl; + + /*for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 2; j++) + { + cout << matrix[i][j] << endl; + } + }*/ + + //Динамическая память + //* - указатель + + /*int *nums = new int[3]; + nums[0] = 45; + cout << nums[0] << endl; + delete[] nums;*/ + + + + + //Практический пример + /*srand(time(NULL)); + int rand_num = 1 + rand() % 15; + bool stop = false; + int user_input; + + + do + { + cout << "Enter number: "; + cin >> user_input; + + if (user_input != rand_num) + cout << "Вы не угадали!\n"; + else + stop = true; + + } + while (!stop); + + cout << "Вы угадали!";*/ + + + + + + + + + + + + + + /*for (int i = 1; i < 15; i++) + { + if (i == 10) + break; + + if (i % 2 == 0) + continue; + + cout << "Info: " << i << endl; + }*/ + + + + + /*for (int i = 1000; i >= 10; i -= 7) + { + cout << "1. Info: " << i << endl; + } + float j = 10000; + while (j > 10) + { + cout << "2. Info: " << j << endl; + j /= 1.5; + } + + int k = 100; + do + { + cout << "3. Info: " << k << endl; + k -= 10; + } while (k < 10);*/ + /*float num, num1, res; + cout << "Enter number in diapathone -100 to 100\n"; + cin >> num; + cout << "Enter number in diapathone -100 to 100\n"; + cin >> num1; + char math; + cout << "Enter math symbol:"; + cin >> math;*/ + + /*if (math == '+') + res = num + num1; + else if (math == '-') + res = num - num1; + else if (math == '*') + res = num * num1; + else if (math == '/') + res = num / num1;*/ + + /*switch (math) + { + case '+':res = num + num1; break; + case '-':res = num - num1; break; + case '*':res = num * num1; break; + case '/':res = num / num1; break; + } + cout << res;*/ + + /*int a = 10, b = 3, z; + z = a % b; + cout << z; + + a = a + 5;*/ + //int a; + //cin >> a; + //a++; + + //cout << a; + /*srand(time(NULL)); + int result = -3 + rand() % 20; + cout << result;*/ +#pragma endregion OLD_CODE + return 0; +} \ No newline at end of file diff --git a/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj new file mode 100644 index 0000000..ac4886e --- /dev/null +++ b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {ca9319c6-b95d-4ea3-880f-5067549b933e} + ConsoleApplication1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj.filters b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj.filters new file mode 100644 index 0000000..51702e6 --- /dev/null +++ b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.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/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj.user b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ConsoleApplication1/ConsoleApplication1/test.txt b/ConsoleApplication1/ConsoleApplication1/test.txt new file mode 100644 index 0000000..e003330 --- /dev/null +++ b/ConsoleApplication1/ConsoleApplication1/test.txt @@ -0,0 +1 @@ +Hello world my friends!) \ No newline at end of file diff --git a/Project1/Project1.sln b/Project1/Project1.sln new file mode 100644 index 0000000..910a51d --- /dev/null +++ b/Project1/Project1.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{CD5316C1-076C-4666-800B-B24944792FBF}" +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 + {CD5316C1-076C-4666-800B-B24944792FBF}.Debug|x64.ActiveCfg = Debug|x64 + {CD5316C1-076C-4666-800B-B24944792FBF}.Debug|x64.Build.0 = Debug|x64 + {CD5316C1-076C-4666-800B-B24944792FBF}.Debug|x86.ActiveCfg = Debug|Win32 + {CD5316C1-076C-4666-800B-B24944792FBF}.Debug|x86.Build.0 = Debug|Win32 + {CD5316C1-076C-4666-800B-B24944792FBF}.Release|x64.ActiveCfg = Release|x64 + {CD5316C1-076C-4666-800B-B24944792FBF}.Release|x64.Build.0 = Release|x64 + {CD5316C1-076C-4666-800B-B24944792FBF}.Release|x86.ActiveCfg = Release|Win32 + {CD5316C1-076C-4666-800B-B24944792FBF}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Project1/Project1/Project1.vcxproj b/Project1/Project1/Project1.vcxproj new file mode 100644 index 0000000..29eaf10 --- /dev/null +++ b/Project1/Project1/Project1.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + 17.0 + Win32Proj + {cd5316c1-076c-4666-800b-b24944792fbf} + Project1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + diff --git a/Project1/Project1/Project1.vcxproj.filters b/Project1/Project1/Project1.vcxproj.filters new file mode 100644 index 0000000..153170c --- /dev/null +++ b/Project1/Project1/Project1.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {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/Project1/Project1/Project1.vcxproj.user b/Project1/Project1/Project1.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Project1/Project1/Project1.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file