From 08a02cd0070a1e09a06571b0e93a0c03b777757f Mon Sep 17 00:00:00 2001 From: YashechkinGA Date: Mon, 5 May 2025 16:33:10 +0300 Subject: [PATCH] lab1 --- main.cpp | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..811f52d --- /dev/null +++ b/main.cpp @@ -0,0 +1,141 @@ +#include +#include +#include + +using namespace std; + + +int main() +{ + int g = 0; + size_t number_count; + cerr<< "Enter number count: "; + cin >> number_count;//number_count кол-во оценок на входе + vector numbers(number_count);//number_count=10 + + for (size_t i = 0; i < number_count; i++) + { + cin >> numbers[i]; // 4 4 3 5 3 4 5 5 4 4 + } + int bin_count;//bin_count кол-во корзин + cerr << "Enter bin_count: "; + cin >> bin_count; + vector bins(bin_count);//Необходимо для каждой корзины подсчитать количество попавших в нее чисел + double min = numbers[0]; + double max = numbers[0]; + for (double x : numbers) + { + if (x < min) { + min = x; + } + else if (x > max) { + max = x; + } + } + double bin_size = (max - min) / bin_count; + bool found; + for (size_t i = 0; i < number_count; i++) + { + found = false; + for (size_t j = 0; (j =100) + cout<<""<10) + cout<<" "<=100) + cout<<""<10) + cout<<" "<(bins[i])/max_count); + } + for(int j=0;j10) + cout<<" "<=100) + cout<<" "<<"|"; + if (bins[i]<100 and bins[i]>10) + cout<<" "<<"|"; + if (bins[i]<10) + cout<<" "<<"|"; + for(int j=0;j