From 143195206402de0ca7ed7a61a57d75a275b231f7 Mon Sep 17 00:00:00 2001 From: GordiyevskikDA Date: Tue, 5 Mar 2024 18:14:43 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=98=D1=81=D1=85=D0=BE=D0=B4=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4=20=D1=81=20LAB1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + LABA1.cpp | 50 ++++++++++++++++ LABA1.sln | 31 ++++++++++ LABA1.vcxproj | 135 ++++++++++++++++++++++++++++++++++++++++++ LABA1.vcxproj.filters | 22 +++++++ 5 files changed, 241 insertions(+) create mode 100644 .gitignore create mode 100644 LABA1.cpp create mode 100644 LABA1.sln create mode 100644 LABA1.vcxproj create mode 100644 LABA1.vcxproj.filters diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f5ce3e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.vs +/x64 +LABA1.vcxproj.user \ No newline at end of file diff --git a/LABA1.cpp b/LABA1.cpp new file mode 100644 index 0000000..6e48f9b --- /dev/null +++ b/LABA1.cpp @@ -0,0 +1,50 @@ +#include +#include +using namespace std; + +int main() +{ + int VecSize = 0, NCharts = 0, Average = 0; + double interval = 0, inp = 0, i = 0, min = 0, max = 0, scale = 1; + cin >> VecSize; + vector marks; + for (int j = 0; j < VecSize; j++) { + cin >> inp; + marks.push_back(inp); + Average ++; + } + cin >> NCharts; + vector chart(NCharts); + min = *min_element(begin(marks), end(marks)); + max = *max_element(begin(marks), end(marks)); + interval = (max - min) / NCharts; + for (int x : marks) { + i = 0; + while ((x > min + interval * (i + 1))) { + i += 1; + } + chart[i] += 1; + } + max = *max_element(begin(chart), end(chart)); + if ((max+4) > 80) { + scale = (max+4) / 80; + } + for (i = 0; i < NCharts; i++) { + if (chart[i] < 10) { + cout << " "; + } + else if (9 < chart[i] && chart[i]< 100) { + cout << " "; + } + cout << chart[i] << "|"; + max = (chart[i] / scale); + if (scale != 1) { + max -= 1; + } + for (int j = 0; j < max; j++) { + cout << "*"; + } + cout << "\n"; + } +} + diff --git a/LABA1.sln b/LABA1.sln new file mode 100644 index 0000000..c0717d7 --- /dev/null +++ b/LABA1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LABA1", "LABA1.vcxproj", "{D164F324-4243-431D-90CA-53E6B0D0180A}" +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 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Debug|x64.ActiveCfg = Debug|x64 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Debug|x64.Build.0 = Debug|x64 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Debug|x86.ActiveCfg = Debug|Win32 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Debug|x86.Build.0 = Debug|Win32 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Release|x64.ActiveCfg = Release|x64 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Release|x64.Build.0 = Release|x64 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Release|x86.ActiveCfg = Release|Win32 + {D164F324-4243-431D-90CA-53E6B0D0180A}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9BED802C-40FB-4D99-8ED3-BD99380F9484} + EndGlobalSection +EndGlobal diff --git a/LABA1.vcxproj b/LABA1.vcxproj new file mode 100644 index 0000000..930fdc7 --- /dev/null +++ b/LABA1.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {d164f324-4243-431d-90ca-53e6b0d0180a} + LABA1 + 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/LABA1.vcxproj.filters b/LABA1.vcxproj.filters new file mode 100644 index 0000000..daf0a2f --- /dev/null +++ b/LABA1.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