Сравнить коммиты
	
		
			Ничего общего в коммитах. '133ecfbbb67c3394f4ae9ab0adc4848e84d5fac4' и '41b5ffe3cdfbd340446735e7714d90ebd9f1d08f' имеют совершенно разные истории. 
		
	
	
		
			133ecfbbb6
			...
			41b5ffe3cd
		
	
		
	@ -1,2 +0,0 @@
 | 
				
			|||||||
/bin
 | 
					 | 
				
			||||||
/obj
 | 
					 | 
				
			||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
-----BEGIN OPENSSH PRIVATE KEY-----
 | 
					 | 
				
			||||||
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABAqjR8VKL
 | 
					 | 
				
			||||||
iXqwsebTTkYzLtAAAAGAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIAMVcWMSwkHQ796Q
 | 
					 | 
				
			||||||
v12uM1/L9QSqCC1guyCtw8nZgqYaAAAAoAX6y1g+sl014TmIQ7zX/gv2ngRTEKBcujJq8O
 | 
					 | 
				
			||||||
UqkMywAQC10aGheZuBego39vP3S84Tf+kKNzxIUWu+kRpbgi4x2bIc5/kYbYh76DGK+o9z
 | 
					 | 
				
			||||||
zCGU6ju3j1fNVHknGYkR0aw2SSu9/Q8GjU+xMd5Rdqj567rbHY/w7Qt8ZYImEKVvYoO/6G
 | 
					 | 
				
			||||||
BenNIJk2c3S/lY26lh51GG9DF9PKMrnWNhZIY=
 | 
					 | 
				
			||||||
-----END OPENSSH PRIVATE KEY-----
 | 
					 | 
				
			||||||
@ -1 +0,0 @@
 | 
				
			|||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAMVcWMSwkHQ796Qv12uM1/L9QSqCC1guyCtw8nZgqYa aleks@DESKTOP-3A8L66V
 | 
					 | 
				
			||||||
											
												
													Разница между файлами не показана из-за своего большого размера
													Загрузить разницу
												
											
										
									
								@ -1,42 +0,0 @@
 | 
				
			|||||||
#include "histogram.h"
 | 
					 | 
				
			||||||
#include "histogram_internal.h"
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
using std::vector;
 | 
					 | 
				
			||||||
void find_minmax(const std::vector<double>& numbers, double& min, double& max) {
 | 
					 | 
				
			||||||
    min = numbers[0];
 | 
					 | 
				
			||||||
    max = numbers[0];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (double number : numbers) {
 | 
					 | 
				
			||||||
        if (number < min) {
 | 
					 | 
				
			||||||
            min = number;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (number > max) {
 | 
					 | 
				
			||||||
            max = number;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
std::vector<size_t> make_histogram(const std::vector<double>& numbers, size_t bin_count) {
 | 
					 | 
				
			||||||
    std::vector<size_t> bins(bin_count, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    double min, max;
 | 
					 | 
				
			||||||
    find_minmax(numbers, min, max);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    double bin_size = (max - min) / bin_count;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (double number : numbers) {
 | 
					 | 
				
			||||||
        bool found = false;
 | 
					 | 
				
			||||||
        for (size_t j = 0; (j < bin_count - 1) && !found; j++) {
 | 
					 | 
				
			||||||
            double lo = min + j * bin_size;
 | 
					 | 
				
			||||||
            double hi = min + (j + 1) * bin_size;
 | 
					 | 
				
			||||||
            if ((lo <= number) && (number < hi)) {
 | 
					 | 
				
			||||||
                bins[j]++;
 | 
					 | 
				
			||||||
                found = true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (!found) {
 | 
					 | 
				
			||||||
            bins[bin_count - 1]++;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return bins;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,10 +0,0 @@
 | 
				
			|||||||
#ifndef HISTOGRAM_H_INCLUDED
 | 
					 | 
				
			||||||
#define HISTOGRAM_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
using std::vector;
 | 
					 | 
				
			||||||
std::vector<size_t>
 | 
					 | 
				
			||||||
make_histogram(const std::vector<double>& numbers, size_t bin_count);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // HISTOGRAM_H_INCLUDED
 | 
					 | 
				
			||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
#ifndef HISTOGRAM_INTERNAL_H_INCLUDED
 | 
					 | 
				
			||||||
#define HISTOGRAM_INTERNAL_H_INCLUDED
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
using std::vector;
 | 
					 | 
				
			||||||
void find_minmax(const std::vector<double>& numbers, double& min, double& max);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // HISTOGRAM_INTERNAL_H_INCLUDED
 | 
					 | 
				
			||||||
@ -1,80 +0,0 @@
 | 
				
			|||||||
# depslib dependency file v1.0
 | 
					 | 
				
			||||||
1748812442 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\main.cpp
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
	"text.h"
 | 
					 | 
				
			||||||
	"svg.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748386910 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748730472 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\text.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748808306 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\text.cpp
 | 
					 | 
				
			||||||
	"text.h"
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748392747 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\doctest.h
 | 
					 | 
				
			||||||
	<signal.h>
 | 
					 | 
				
			||||||
	<ciso646>
 | 
					 | 
				
			||||||
	<cstddef>
 | 
					 | 
				
			||||||
	<ostream>
 | 
					 | 
				
			||||||
	<istream>
 | 
					 | 
				
			||||||
	<type_traits>
 | 
					 | 
				
			||||||
	"doctest_fwd.h"
 | 
					 | 
				
			||||||
	<ctime>
 | 
					 | 
				
			||||||
	<cmath>
 | 
					 | 
				
			||||||
	<climits>
 | 
					 | 
				
			||||||
	<math.h>
 | 
					 | 
				
			||||||
	<new>
 | 
					 | 
				
			||||||
	<cstdio>
 | 
					 | 
				
			||||||
	<cstdlib>
 | 
					 | 
				
			||||||
	<cstring>
 | 
					 | 
				
			||||||
	<limits>
 | 
					 | 
				
			||||||
	<utility>
 | 
					 | 
				
			||||||
	<fstream>
 | 
					 | 
				
			||||||
	<sstream>
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<algorithm>
 | 
					 | 
				
			||||||
	<iomanip>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	<atomic>
 | 
					 | 
				
			||||||
	<mutex>
 | 
					 | 
				
			||||||
	<set>
 | 
					 | 
				
			||||||
	<map>
 | 
					 | 
				
			||||||
	<unordered_set>
 | 
					 | 
				
			||||||
	<exception>
 | 
					 | 
				
			||||||
	<stdexcept>
 | 
					 | 
				
			||||||
	<csignal>
 | 
					 | 
				
			||||||
	<cfloat>
 | 
					 | 
				
			||||||
	<cctype>
 | 
					 | 
				
			||||||
	<cstdint>
 | 
					 | 
				
			||||||
	<string>
 | 
					 | 
				
			||||||
	<sys/types.h>
 | 
					 | 
				
			||||||
	<unistd.h>
 | 
					 | 
				
			||||||
	<sys/sysctl.h>
 | 
					 | 
				
			||||||
	<AfxWin.h>
 | 
					 | 
				
			||||||
	<windows.h>
 | 
					 | 
				
			||||||
	<io.h>
 | 
					 | 
				
			||||||
	<sys/time.h>
 | 
					 | 
				
			||||||
	<unistd.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748392232 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram_internal.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748811805 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\svg.cpp
 | 
					 | 
				
			||||||
	"svg.h"
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748810901 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\svg.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	<cstddef>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748808114 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram.cpp
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
	"histogram_internal.h"
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,20 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
					 | 
				
			||||||
<CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
	<FileVersion major="1" minor="0" />
 | 
					 | 
				
			||||||
	<ActiveTarget name="Debug" />
 | 
					 | 
				
			||||||
	<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="893" topLine="30" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="histogram.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="193" topLine="0" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name=".gitignore" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="10" topLine="0" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
</CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
@ -1,38 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
					 | 
				
			||||||
<CodeBlocks_project_file>
 | 
					 | 
				
			||||||
	<FileVersion major="1" minor="6" />
 | 
					 | 
				
			||||||
	<Project>
 | 
					 | 
				
			||||||
		<Option title="laba1" />
 | 
					 | 
				
			||||||
		<Option pch_mode="2" />
 | 
					 | 
				
			||||||
		<Option compiler="gcc" />
 | 
					 | 
				
			||||||
		<Build>
 | 
					 | 
				
			||||||
			<Target title="Debug">
 | 
					 | 
				
			||||||
				<Option output="bin/Debug/laba1" prefix_auto="1" extension_auto="1" />
 | 
					 | 
				
			||||||
				<Option object_output="obj/Debug/" />
 | 
					 | 
				
			||||||
				<Option type="1" />
 | 
					 | 
				
			||||||
				<Option compiler="gcc" />
 | 
					 | 
				
			||||||
				<Compiler>
 | 
					 | 
				
			||||||
					<Add option="-g" />
 | 
					 | 
				
			||||||
				</Compiler>
 | 
					 | 
				
			||||||
			</Target>
 | 
					 | 
				
			||||||
			<Target title="Release">
 | 
					 | 
				
			||||||
				<Option output="bin/Release/laba1" prefix_auto="1" extension_auto="1" />
 | 
					 | 
				
			||||||
				<Option object_output="obj/Release/" />
 | 
					 | 
				
			||||||
				<Option type="1" />
 | 
					 | 
				
			||||||
				<Option compiler="gcc" />
 | 
					 | 
				
			||||||
				<Compiler>
 | 
					 | 
				
			||||||
					<Add option="-O2" />
 | 
					 | 
				
			||||||
				</Compiler>
 | 
					 | 
				
			||||||
				<Linker>
 | 
					 | 
				
			||||||
					<Add option="-s" />
 | 
					 | 
				
			||||||
				</Linker>
 | 
					 | 
				
			||||||
			</Target>
 | 
					 | 
				
			||||||
		</Build>
 | 
					 | 
				
			||||||
		<Compiler>
 | 
					 | 
				
			||||||
			<Add option="-Wall" />
 | 
					 | 
				
			||||||
			<Add option="-fexceptions" />
 | 
					 | 
				
			||||||
		</Compiler>
 | 
					 | 
				
			||||||
		<Unit filename="main.cpp" />
 | 
					 | 
				
			||||||
		<Extensions />
 | 
					 | 
				
			||||||
	</Project>
 | 
					 | 
				
			||||||
</CodeBlocks_project_file>
 | 
					 | 
				
			||||||
@ -1,25 +0,0 @@
 | 
				
			|||||||
# depslib dependency file v1.0
 | 
					 | 
				
			||||||
1748387373 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram.cpp
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748386910 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748388937 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\main.cpp
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
	"text.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748388603 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\text.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1584205420 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\laba1\main.cpp
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748391445 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\text.cpp
 | 
					 | 
				
			||||||
	"text.h"
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,5 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
					 | 
				
			||||||
<CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
	<FileVersion major="1" minor="0" />
 | 
					 | 
				
			||||||
	<ActiveTarget name="Debug" />
 | 
					 | 
				
			||||||
</CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								@ -1,50 +1,112 @@
 | 
				
			|||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
#include "histogram.h"
 | 
					 | 
				
			||||||
#include "text.h"
 | 
					 | 
				
			||||||
#include "svg.h"
 | 
					 | 
				
			||||||
using namespace std;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct Input {
 | 
					using namespace std;
 | 
				
			||||||
    std::vector<double> numbers;
 | 
					 | 
				
			||||||
    size_t bin_count;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Ââîä äàííûõ
 | 
					int main()
 | 
				
			||||||
Input input_data() {
 | 
					{
 | 
				
			||||||
    Input in;
 | 
					    const size_t SCREEN_WIDTH = 80;
 | 
				
			||||||
 | 
					    const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
				
			||||||
    size_t number_count;
 | 
					    size_t number_count;
 | 
				
			||||||
    cerr << "Enter number count: ";
 | 
					    cerr << "Enter number count: ";
 | 
				
			||||||
    cin >> number_count;
 | 
					    cin >> number_count;
 | 
				
			||||||
 | 
					    vector<double> numbers(number_count);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    in.numbers.resize(number_count);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cerr << "Enter numbers: ";
 | 
					    cerr << "Enter number masiv: ";
 | 
				
			||||||
    for (size_t i = 0; i < number_count; i++) {
 | 
					    for (size_t i=0; i<number_count; i++)
 | 
				
			||||||
        cin >> in.numbers[i];
 | 
					    {
 | 
				
			||||||
 | 
					        cin >> numbers[i];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    size_t bin_count;
 | 
				
			||||||
    cerr << "Enter bin count: ";
 | 
					    cerr << "Enter bin count: ";
 | 
				
			||||||
    cin >> in.bin_count;
 | 
					    cin >> bin_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return in;
 | 
					    vector<size_t> 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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (size_t i = 0; i < number_count; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        bool found = false;
 | 
				
			||||||
 | 
					        for (size_t j = 0; (j < bin_count - 1) && !found; j++)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            auto lo = min + j * bin_size;
 | 
				
			||||||
 | 
					            auto hi = min + (j + 1) * bin_size;
 | 
				
			||||||
 | 
					            if ((lo <= numbers[i]) && (numbers[i] < hi))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                bins[j]++;
 | 
				
			||||||
 | 
					                found = true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!found)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            bins[bin_count - 1]++;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					 size_t Maxbins = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Ðàñ÷¸ò ãèñòîãðàììû
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (size_t i = 0; i < bin_count; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (bins[i] > Maxbins)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Maxbins = bins[i];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Âûâîä ãèñòîãðàììû
 | 
					    const size_t MAX_HEIGHT = 76;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (Maxbins <= MAX_HEIGHT)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        for (size_t i = 0; i < bin_count; i++)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (bins[i] < 10)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                cout << " ";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            cout << " " << bins[i] << "|";
 | 
				
			||||||
 | 
					            for (size_t j = 0; j < bins[i]; j++)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                cout << "*";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            cout << endl;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        for (size_t i = 0; i < bin_count; i++)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            size_t height = static_cast<size_t>(MAX_HEIGHT * (static_cast<double>(bins[i]) / Maxbins));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Îñíîâíàÿ ôóíêöèÿ
 | 
					            if (bins[i] < 100)
 | 
				
			||||||
int main() {
 | 
					            {
 | 
				
			||||||
    auto in = input_data();
 | 
					                cout << " ";
 | 
				
			||||||
    auto bins = make_histogram(in.numbers, in.bin_count);
 | 
					            }
 | 
				
			||||||
    show_histogram_svg(bins);
 | 
					            if (bins[i] < 10)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                cout << " ";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            cout << bins[i] << "|";
 | 
				
			||||||
 | 
					            for (size_t j = 0; j < height; j++)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                cout << "*";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            cout << endl;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
											
												Двоичный файл не отображается.
											
										
									
								@ -1,68 +0,0 @@
 | 
				
			|||||||
#include "svg.h"
 | 
					 | 
				
			||||||
#include<iostream>
 | 
					 | 
				
			||||||
using namespace std;
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
svg_begin(double width, double height) {
 | 
					 | 
				
			||||||
    cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
 | 
					 | 
				
			||||||
    cout << "<svg ";
 | 
					 | 
				
			||||||
    cout << "width='" << width << "' ";
 | 
					 | 
				
			||||||
    cout << "height='" << height << "' ";
 | 
					 | 
				
			||||||
    cout << "viewBox='0 0 " << width << " " << height << "' ";
 | 
					 | 
				
			||||||
    cout << "xmlns='http://www.w3.org/2000/svg'>\n";
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
svg_end() {
 | 
					 | 
				
			||||||
    cout << "</svg>\n";
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
svg_text(double left, double baseline, string text)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>";
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
svg_rect(double x, double y, double width, double height, string stroke = "black", string fill = "black")
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    cout << "<rect x='"<<x<<"' y='"<<y<<"' width='"<<width<<"' height='"<<height<<"' stroke='"<<stroke<<"' fill='"<<fill<<"' />";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
show_histogram_svg(const vector<size_t>& bins)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    const auto IMAGE_WIDTH = 400;
 | 
					 | 
				
			||||||
    const auto IMAGE_HEIGHT = 300;
 | 
					 | 
				
			||||||
    const auto TEXT_LEFT = 20;
 | 
					 | 
				
			||||||
    const auto TEXT_BASELINE = 20;
 | 
					 | 
				
			||||||
    const auto TEXT_WIDTH = 50;
 | 
					 | 
				
			||||||
    const auto BIN_HEIGHT = 30;
 | 
					 | 
				
			||||||
    const auto YELLOW = "yellow";
 | 
					 | 
				
			||||||
    const auto PURPLE = "purple";
 | 
					 | 
				
			||||||
    const auto MAX_WIDTH = IMAGE_WIDTH-TEXT_WIDTH;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    svg_begin(IMAGE_WIDTH,IMAGE_HEIGHT);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    double top = 0;
 | 
					 | 
				
			||||||
    double max_count = bins[0];
 | 
					 | 
				
			||||||
    for (size_t i = 0; i < bins.size(); i++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (max_count<bins[i])
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            max_count=bins[i];
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (size_t bin : bins)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        double bin_width = (MAX_WIDTH)*(bin/max_count);
 | 
					 | 
				
			||||||
        svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
 | 
					 | 
				
			||||||
        svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, YELLOW, PURPLE);
 | 
					 | 
				
			||||||
        top += BIN_HEIGHT;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    svg_end();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
#ifndef SVG_H_INCLUDED
 | 
					 | 
				
			||||||
#define SVG_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include <cstddef>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void show_histogram_svg(const std::vector<size_t>& bins);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
@ -1,37 +0,0 @@
 | 
				
			|||||||
#include "text.h"
 | 
					 | 
				
			||||||
#include <iostream>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
using std::vector;
 | 
					 | 
				
			||||||
const size_t SCREEN_WIDTH = 80;
 | 
					 | 
				
			||||||
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
					 | 
				
			||||||
// Âûâîä ãèñòîãðàììû
 | 
					 | 
				
			||||||
void show_histogram_text(const std::vector<size_t>& bins) {
 | 
					 | 
				
			||||||
    size_t max_bin_count = 0;
 | 
					 | 
				
			||||||
    for (size_t bin : bins) {
 | 
					 | 
				
			||||||
        if (bin > max_bin_count) {
 | 
					 | 
				
			||||||
            max_bin_count = bin;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (max_bin_count <= MAX_ASTERISK) {
 | 
					 | 
				
			||||||
        for (size_t bin : bins) {
 | 
					 | 
				
			||||||
            if (bin < 10) std::cout << " ";
 | 
					 | 
				
			||||||
            std::cout << " " << bin << "|";
 | 
					 | 
				
			||||||
            for (size_t j = 0; j < bin; j++) {
 | 
					 | 
				
			||||||
                std::cout << "*";
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            std::cout << std::endl;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        for (size_t bin : bins) {
 | 
					 | 
				
			||||||
            size_t height = static_cast<size_t>(MAX_ASTERISK * (static_cast<double>(bin) / max_bin_count));
 | 
					 | 
				
			||||||
            if (bin < 100) std::cout << " ";
 | 
					 | 
				
			||||||
            if (bin < 10) std::cout << " ";
 | 
					 | 
				
			||||||
            std::cout << bin << "|";
 | 
					 | 
				
			||||||
            for (size_t j = 0; j < height; j++) {
 | 
					 | 
				
			||||||
                std::cout << "*";
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            std::cout << std::endl;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
#ifndef TEXT_H_INCLUDED
 | 
					 | 
				
			||||||
#define TEXT_H_INCLUDED
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
using std::vector;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void show_histogram_text(const std::vector<size_t>& bins);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // TEXT_H_INCLUDED
 | 
					 | 
				
			||||||
@ -1,38 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
					 | 
				
			||||||
<CodeBlocks_project_file>
 | 
					 | 
				
			||||||
	<FileVersion major="1" minor="6" />
 | 
					 | 
				
			||||||
	<Project>
 | 
					 | 
				
			||||||
		<Option title="unittest" />
 | 
					 | 
				
			||||||
		<Option pch_mode="2" />
 | 
					 | 
				
			||||||
		<Option compiler="gcc" />
 | 
					 | 
				
			||||||
		<Build>
 | 
					 | 
				
			||||||
			<Target title="Debug">
 | 
					 | 
				
			||||||
				<Option output="bin/Debug/unittest" prefix_auto="1" extension_auto="1" />
 | 
					 | 
				
			||||||
				<Option object_output="obj/Debug/" />
 | 
					 | 
				
			||||||
				<Option type="1" />
 | 
					 | 
				
			||||||
				<Option compiler="gcc" />
 | 
					 | 
				
			||||||
				<Compiler>
 | 
					 | 
				
			||||||
					<Add option="-g" />
 | 
					 | 
				
			||||||
				</Compiler>
 | 
					 | 
				
			||||||
			</Target>
 | 
					 | 
				
			||||||
			<Target title="Release">
 | 
					 | 
				
			||||||
				<Option output="bin/Release/unittest" prefix_auto="1" extension_auto="1" />
 | 
					 | 
				
			||||||
				<Option object_output="obj/Release/" />
 | 
					 | 
				
			||||||
				<Option type="1" />
 | 
					 | 
				
			||||||
				<Option compiler="gcc" />
 | 
					 | 
				
			||||||
				<Compiler>
 | 
					 | 
				
			||||||
					<Add option="-O2" />
 | 
					 | 
				
			||||||
				</Compiler>
 | 
					 | 
				
			||||||
				<Linker>
 | 
					 | 
				
			||||||
					<Add option="-s" />
 | 
					 | 
				
			||||||
				</Linker>
 | 
					 | 
				
			||||||
			</Target>
 | 
					 | 
				
			||||||
		</Build>
 | 
					 | 
				
			||||||
		<Compiler>
 | 
					 | 
				
			||||||
			<Add option="-Wall" />
 | 
					 | 
				
			||||||
		</Compiler>
 | 
					 | 
				
			||||||
		<Extensions>
 | 
					 | 
				
			||||||
			<lib_finder disable_auto="1" />
 | 
					 | 
				
			||||||
		</Extensions>
 | 
					 | 
				
			||||||
	</Project>
 | 
					 | 
				
			||||||
</CodeBlocks_project_file>
 | 
					 | 
				
			||||||
@ -1,56 +0,0 @@
 | 
				
			|||||||
#define DOCTEST_CONFIG_NO_MULTITHREADING
 | 
					 | 
				
			||||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
 | 
					 | 
				
			||||||
#include "doctest.h"
 | 
					 | 
				
			||||||
#include "histogram_internal.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_CASE("distinct positive numbers") {
 | 
					 | 
				
			||||||
    double min = 0;
 | 
					 | 
				
			||||||
    double max = 0;
 | 
					 | 
				
			||||||
    find_minmax({1, 2}, min, max);
 | 
					 | 
				
			||||||
    CHECK(min == 1);
 | 
					 | 
				
			||||||
    CHECK(max == 2);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
TEST_CASE("distinct negative numbers"){
 | 
					 | 
				
			||||||
    double min = 0;
 | 
					 | 
				
			||||||
    double max = 0;
 | 
					 | 
				
			||||||
    find_minmax({-1, -2}, min, max);
 | 
					 | 
				
			||||||
    CHECK(min == -2);
 | 
					 | 
				
			||||||
    CHECK(max == -1);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
TEST_CASE("vector of the same elements"){
 | 
					 | 
				
			||||||
    double min = 0;
 | 
					 | 
				
			||||||
    double max = 0;
 | 
					 | 
				
			||||||
    find_minmax({3,3,3}, min, max);
 | 
					 | 
				
			||||||
    CHECK(min == 3);
 | 
					 | 
				
			||||||
    CHECK(max == 3);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
TEST_CASE("vector of one elements"){
 | 
					 | 
				
			||||||
    double min = 0;
 | 
					 | 
				
			||||||
    double max = 0;
 | 
					 | 
				
			||||||
    find_minmax({3}, min, max);
 | 
					 | 
				
			||||||
    CHECK(min == max);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
TEST_CASE("mixed positive and negative numbers") {
 | 
					 | 
				
			||||||
    double min = 0;
 | 
					 | 
				
			||||||
    double max = 0;
 | 
					 | 
				
			||||||
    find_minmax({-1, 2, 0, -3, 5}, min, max);
 | 
					 | 
				
			||||||
    CHECK(min == -3);
 | 
					 | 
				
			||||||
    CHECK(max == 5);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_CASE("vector with all negative numbers") {
 | 
					 | 
				
			||||||
    double min = 0;
 | 
					 | 
				
			||||||
    double max = 0;
 | 
					 | 
				
			||||||
    find_minmax({-5, -10, -2}, min, max);
 | 
					 | 
				
			||||||
    CHECK(min == -10);
 | 
					 | 
				
			||||||
    CHECK(max == -2);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEST_CASE("vector with zero") {
 | 
					 | 
				
			||||||
    double min = 0;
 | 
					 | 
				
			||||||
    double max = 0;
 | 
					 | 
				
			||||||
    find_minmax({0, -1, 1}, min, max);
 | 
					 | 
				
			||||||
    CHECK(min == -1);
 | 
					 | 
				
			||||||
    CHECK(max == 1);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,68 +0,0 @@
 | 
				
			|||||||
# depslib dependency file v1.0
 | 
					 | 
				
			||||||
1748392121 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram.cpp
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748386910 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748729850 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\unittest.cpp
 | 
					 | 
				
			||||||
	"doctest.h"
 | 
					 | 
				
			||||||
	"histogram_internal.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748392747 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\doctest.h
 | 
					 | 
				
			||||||
	<signal.h>
 | 
					 | 
				
			||||||
	<ciso646>
 | 
					 | 
				
			||||||
	<cstddef>
 | 
					 | 
				
			||||||
	<ostream>
 | 
					 | 
				
			||||||
	<istream>
 | 
					 | 
				
			||||||
	<type_traits>
 | 
					 | 
				
			||||||
	"doctest_fwd.h"
 | 
					 | 
				
			||||||
	<ctime>
 | 
					 | 
				
			||||||
	<cmath>
 | 
					 | 
				
			||||||
	<climits>
 | 
					 | 
				
			||||||
	<math.h>
 | 
					 | 
				
			||||||
	<new>
 | 
					 | 
				
			||||||
	<cstdio>
 | 
					 | 
				
			||||||
	<cstdlib>
 | 
					 | 
				
			||||||
	<cstring>
 | 
					 | 
				
			||||||
	<limits>
 | 
					 | 
				
			||||||
	<utility>
 | 
					 | 
				
			||||||
	<fstream>
 | 
					 | 
				
			||||||
	<sstream>
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<algorithm>
 | 
					 | 
				
			||||||
	<iomanip>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	<atomic>
 | 
					 | 
				
			||||||
	<mutex>
 | 
					 | 
				
			||||||
	<set>
 | 
					 | 
				
			||||||
	<map>
 | 
					 | 
				
			||||||
	<unordered_set>
 | 
					 | 
				
			||||||
	<exception>
 | 
					 | 
				
			||||||
	<stdexcept>
 | 
					 | 
				
			||||||
	<csignal>
 | 
					 | 
				
			||||||
	<cfloat>
 | 
					 | 
				
			||||||
	<cctype>
 | 
					 | 
				
			||||||
	<cstdint>
 | 
					 | 
				
			||||||
	<string>
 | 
					 | 
				
			||||||
	<sys/types.h>
 | 
					 | 
				
			||||||
	<unistd.h>
 | 
					 | 
				
			||||||
	<sys/sysctl.h>
 | 
					 | 
				
			||||||
	<AfxWin.h>
 | 
					 | 
				
			||||||
	<windows.h>
 | 
					 | 
				
			||||||
	<io.h>
 | 
					 | 
				
			||||||
	<sys/time.h>
 | 
					 | 
				
			||||||
	<unistd.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748392232 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\histogram_internal.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748802937 source:c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\svg.cpp
 | 
					 | 
				
			||||||
	"svg.h"
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1748730522 c:\users\aleks\onedrive\Ðàáî÷èé ñòîë\laba1\svg.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	<cstddef>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,5 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
					 | 
				
			||||||
<CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
	<FileVersion major="1" minor="0" />
 | 
					 | 
				
			||||||
	<ActiveTarget name="Debug" />
 | 
					 | 
				
			||||||
</CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
					Загрузка…
					
					
				
		Ссылка в новой задаче