Сравнить коммиты
	
		
			Ничего общего в коммитах. '601f3ebe33ed60a56241c746dd246690530065ef' и '4b8e4c9576a22e4c8d5dd146a554160850f7ff73' имеют совершенно разные истории. 
		
	
	
		
			601f3ebe33
			...
			4b8e4c9576
		
	
		
	| 
		 До Ширина: | Высота: | Размер: 349 B  | 
@ -1,5 +0,0 @@
 | 
				
			|||||||
8
 | 
					 | 
				
			||||||
1 1 1 1 1 1
 | 
					 | 
				
			||||||
2 2 
 | 
					 | 
				
			||||||
2
 | 
					 | 
				
			||||||
700
 | 
					 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								@ -1 +0,0 @@
 | 
				
			|||||||
project.exe <marks.txt >marks.svg
 | 
					 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								
											
												
													Разница между файлами не показана из-за своего большого размера
													Загрузить разницу
												
											
										
									
								@ -1,59 +0,0 @@
 | 
				
			|||||||
#include <iostream>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include "histogram.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//std::vector<size_t>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool
 | 
					 | 
				
			||||||
find_minmax(const std::vector<double> numbers, double& min, double& max)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    if(numbers.empty())
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /*/double/*/ min = numbers[0];//ïîèñê ìèí è ìàêñ
 | 
					 | 
				
			||||||
    /*/ double/*/ max = numbers[0];
 | 
					 | 
				
			||||||
    for (double x : numbers)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (x < min)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            min = x;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else if (x > max)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            max = x;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
std::vector<size_t>
 | 
					 | 
				
			||||||
make_histogram(const std::vector<double> numbers, size_t bin_count)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    std::vector <size_t> bins(bin_count);
 | 
					 | 
				
			||||||
    double min, max;
 | 
					 | 
				
			||||||
    find_minmax(numbers, min, max);
 | 
					 | 
				
			||||||
    double bin_size = (max-min)/bin_count;//ðàçìåð êîðçèíû
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (size_t i = 0; i < numbers.size(); 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]++;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return bins;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,10 +0,0 @@
 | 
				
			|||||||
#ifndef HISTOGRAM_H_INCLUDED
 | 
					 | 
				
			||||||
#define HISTOGRAM_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
std::vector<size_t>
 | 
					 | 
				
			||||||
make_histogram(const std::vector<double> numbers, size_t bin_count);
 | 
					 | 
				
			||||||
#endif // HISTOGRAM_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,7 +0,0 @@
 | 
				
			|||||||
#ifndef HISTOGRAM_INTERNAL_H_INCLUDED
 | 
					 | 
				
			||||||
#define HISTOGRAM_INTERNAL_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool find_minmax(const std::vector<double> numbers, double& min, double& max);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // HISTOGRAM_INTERNAL_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,64 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
#include <iostream>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "histogram.h"
 | 
					 | 
				
			||||||
#include "text.h"
 | 
					 | 
				
			||||||
#include "svg.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using namespace std;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct Input
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    vector<double> numbers;
 | 
					 | 
				
			||||||
    size_t bin_count{};
 | 
					 | 
				
			||||||
    size_t number_count;//êîëè÷åñòâî ÷èñåë
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Input
 | 
					 | 
				
			||||||
input_data()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Input in;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    cerr<<"Kol-vo chisel -> ";
 | 
					 | 
				
			||||||
    cin>>in.number_count;
 | 
					 | 
				
			||||||
    //  vector <double> numbers(number_count);//âåêòîð ñ êîëè÷ñåòâîì ýë. number_count
 | 
					 | 
				
			||||||
    in.numbers.resize(in.number_count);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    cerr<<"Vvedite chisla:";
 | 
					 | 
				
			||||||
    cerr<<endl;//çàïîëíåíèå âåêòîðà
 | 
					 | 
				
			||||||
    for(size_t i=0; i<in.number_count; i++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        cin>>in.numbers[i];
 | 
					 | 
				
			||||||
        //cout<<endl;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    cerr<<"vvedite kolvo bins -> ";
 | 
					 | 
				
			||||||
    cin>>in.bin_count;
 | 
					 | 
				
			||||||
    return in;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int main()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
     size_t number_count;//êîëè÷åñòâî ÷èñåë
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Input in = input_data();
 | 
					 | 
				
			||||||
    auto bins = make_histogram(in.numbers, in.bin_count);
 | 
					 | 
				
			||||||
  //  show_histogram_text(bins, in.bin_count);
 | 
					 | 
				
			||||||
    show_histogram_svg(bins,in.number_count,in.bin_count);
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
    //  size_t bin_count;//êîëè÷åñòâî êîðçèí
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //  vector<size_t> bins(bin_count);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								@ -1,58 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
					 | 
				
			||||||
<CodeBlocks_project_file>
 | 
					 | 
				
			||||||
	<FileVersion major="1" minor="6" />
 | 
					 | 
				
			||||||
	<Project>
 | 
					 | 
				
			||||||
		<Option title="project" />
 | 
					 | 
				
			||||||
		<Option pch_mode="2" />
 | 
					 | 
				
			||||||
		<Option compiler="gcc" />
 | 
					 | 
				
			||||||
		<Build>
 | 
					 | 
				
			||||||
			<Target title="Debug">
 | 
					 | 
				
			||||||
				<Option output="bin/Debug/project" 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/project" 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="doctest.h">
 | 
					 | 
				
			||||||
			<Option target="<{~None~}>" />
 | 
					 | 
				
			||||||
		</Unit>
 | 
					 | 
				
			||||||
		<Unit filename="histogram.cpp" />
 | 
					 | 
				
			||||||
		<Unit filename="histogram.h">
 | 
					 | 
				
			||||||
			<Option target="<{~None~}>" />
 | 
					 | 
				
			||||||
		</Unit>
 | 
					 | 
				
			||||||
		<Unit filename="histogram_internal.h">
 | 
					 | 
				
			||||||
			<Option target="<{~None~}>" />
 | 
					 | 
				
			||||||
		</Unit>
 | 
					 | 
				
			||||||
		<Unit filename="main.cpp" />
 | 
					 | 
				
			||||||
		<Unit filename="svg.cpp" />
 | 
					 | 
				
			||||||
		<Unit filename="svg.h">
 | 
					 | 
				
			||||||
			<Option target="<{~None~}>" />
 | 
					 | 
				
			||||||
		</Unit>
 | 
					 | 
				
			||||||
		<Unit filename="text.cpp" />
 | 
					 | 
				
			||||||
		<Unit filename="text.h">
 | 
					 | 
				
			||||||
			<Option target="<{~None~}>" />
 | 
					 | 
				
			||||||
		</Unit>
 | 
					 | 
				
			||||||
		<Extensions>
 | 
					 | 
				
			||||||
			<lib_finder disable_auto="1" />
 | 
					 | 
				
			||||||
		</Extensions>
 | 
					 | 
				
			||||||
	</Project>
 | 
					 | 
				
			||||||
</CodeBlocks_project_file>
 | 
					 | 
				
			||||||
@ -1,34 +0,0 @@
 | 
				
			|||||||
# depslib dependency file v1.0
 | 
					 | 
				
			||||||
1686139391 source:c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\histogram.cpp
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686138404 c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\histogram.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686140688 source:c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\svg.cpp
 | 
					 | 
				
			||||||
	<math.h>
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<conio.h>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	<string>
 | 
					 | 
				
			||||||
	"svg.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686142910 c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\svg.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686138404 source:c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\text.cpp
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	"text.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686138404 c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\text.h
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686142961 source:c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\main.cpp
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
	"text.h"
 | 
					 | 
				
			||||||
	"svg.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,40 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
					 | 
				
			||||||
<CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
	<FileVersion major="1" minor="0" />
 | 
					 | 
				
			||||||
	<ActiveTarget name="Debug" />
 | 
					 | 
				
			||||||
	<File name="text.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="0" topLine="16" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="svg.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="166" topLine="0" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="histogram.cpp" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="441" topLine="8" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="doctest.h" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="0" topLine="72" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="histogram_internal.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="0" topLine="0" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="main.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="107" topLine="0" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="svg.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="2244" topLine="80" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
</CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
@ -1,91 +0,0 @@
 | 
				
			|||||||
#include <math.h>
 | 
					 | 
				
			||||||
#include <iostream>
 | 
					 | 
				
			||||||
#include <conio.h>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
#include "svg.h"
 | 
					 | 
				
			||||||
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, string fill)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    cout << "<rect x='"<<x<<"' y='"<<y<<"' width='"<<width<<"' height='"<<height<<"' stroke='"<<stroke<<"' fill='"<<fill<<"' />";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
show_histogram_svg(const vector<size_t>& bins, size_t number_count, size_t bin_count)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    setlocale(LC_ALL, "Russian");
 | 
					 | 
				
			||||||
    int noi=0;
 | 
					 | 
				
			||||||
    const auto IMAGE_WIDTH = 400;
 | 
					 | 
				
			||||||
    auto IMAGE_HEIGHT = 700;
 | 
					 | 
				
			||||||
    const auto TEXT_LEFT = 20;
 | 
					 | 
				
			||||||
    const auto TEXT_BASELINE = 20;
 | 
					 | 
				
			||||||
    const auto TEXT_WIDTH = 50;
 | 
					 | 
				
			||||||
    const auto BIN_HEIGHT = 30;
 | 
					 | 
				
			||||||
    const auto BLOCK_WIDTH = 10;
 | 
					 | 
				
			||||||
    const auto MAX_WIDTH = IMAGE_WIDTH-TEXT_WIDTH;
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
    cerr<<"Ââåäèòå æåëàåìóþ âûñîòó ñòîëáöà";
 | 
					 | 
				
			||||||
    cerr<<endl;
 | 
					 | 
				
			||||||
    cin>>IMAGE_HEIGHT;
 | 
					 | 
				
			||||||
    if (IMAGE_HEIGHT>700)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        IMAGE_HEIGHT=IMAGE_HEIGHT/bin_count;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//string k;
 | 
					 | 
				
			||||||
//string m;
 | 
					 | 
				
			||||||
    svg_begin(IMAGE_WIDTH,IMAGE_HEIGHT);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    double top = 0; //ìàøòàáèðâîàíèå
 | 
					 | 
				
			||||||
    double max_count = bins[0];
 | 
					 | 
				
			||||||
    for (size_t i = 0; i < bins.size(); i++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (bins[i] > max_count)
 | 
					 | 
				
			||||||
            max_count = bins[i];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    for (size_t bin : bins)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        const double bin_width = (IMAGE_WIDTH - TEXT_WIDTH)*(bin/max_count);
 | 
					 | 
				
			||||||
        svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
 | 
					 | 
				
			||||||
        /*/
 | 
					 | 
				
			||||||
        cout<<"Ââåäèòå öâåò 1 â ôîðìàòå #RRGGBB";
 | 
					 | 
				
			||||||
        cin>> k;
 | 
					 | 
				
			||||||
        cout<<endl;
 | 
					 | 
				
			||||||
        cout<<"Ââåäèòå öâåò 2 â ôîðìàòå #RRGGBB";
 | 
					 | 
				
			||||||
        cin >> m;
 | 
					 | 
				
			||||||
        /*/
 | 
					 | 
				
			||||||
        svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT,"#00CCFF" /*/k/*/,"#0000FF" /*/m/*/);
 | 
					 | 
				
			||||||
        top += BIN_HEIGHT;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    svg_end();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
#ifndef SVG_H_INCLUDED
 | 
					 | 
				
			||||||
#define SVG_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
show_histogram_svg(const std::vector<size_t>& bins, size_t number_count, size_t bin_count);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // SVG_H_INCLUDED
 | 
					 | 
				
			||||||
@ -1,67 +0,0 @@
 | 
				
			|||||||
#include <iostream>
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
#include "text.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using namespace std;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
show_histogram_text(vector<size_t> bins, size_t bin_count)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    size_t max_count=0;
 | 
					 | 
				
			||||||
    for (size_t i =0; i<bin_count; i++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (max_count <bins[i])
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            max_count=bins[i];
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    float procent;
 | 
					 | 
				
			||||||
    for(size_t i=0; i<bin_count; i++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        int procent =(float)bins[i];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (procent<10)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            cout<<"  "<<procent<<" | ";
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if ((procent<100)&&(procent>=10))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            cout<<" "<<procent<<" | ";
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        size_t height = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (max_count>76)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            size_t height = 76 * (static_cast<double>(bins[i]) / max_count);
 | 
					 | 
				
			||||||
            for(size_t j=0; j<=height; j++)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                cout<<"*";
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            for(size_t j=0; j<=bins[i]-1; j++)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                cout<<"*";
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        cout<<endl;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
return;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,7 +0,0 @@
 | 
				
			|||||||
#ifndef TEXT_H_INCLUDED
 | 
					 | 
				
			||||||
#define TEXT_H_INCLUDED
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//std::vector<size_t>
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
show_histogram_text(std::vector<size_t> bins, size_t bin_count);
 | 
					 | 
				
			||||||
#endif // TEXT_H_INCLUDED
 | 
					 | 
				
			||||||
@ -1,42 +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>
 | 
					 | 
				
			||||||
		<Unit filename="doctest.h" />
 | 
					 | 
				
			||||||
		<Unit filename="histogram.cpp" />
 | 
					 | 
				
			||||||
		<Unit filename="histogram_internal.h" />
 | 
					 | 
				
			||||||
		<Unit filename="unittest.cpp" />
 | 
					 | 
				
			||||||
		<Extensions>
 | 
					 | 
				
			||||||
			<lib_finder disable_auto="1" />
 | 
					 | 
				
			||||||
		</Extensions>
 | 
					 | 
				
			||||||
	</Project>
 | 
					 | 
				
			||||||
</CodeBlocks_project_file>
 | 
					 | 
				
			||||||
@ -1,60 +0,0 @@
 | 
				
			|||||||
# depslib dependency file v1.0
 | 
					 | 
				
			||||||
1686139391 source:c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\histogram.cpp
 | 
					 | 
				
			||||||
	<iostream>
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
	"histogram.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686138404 c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\histogram.h
 | 
					 | 
				
			||||||
	<vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686139208 source:c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\unittest.cpp
 | 
					 | 
				
			||||||
	"doctest.h"
 | 
					 | 
				
			||||||
	"histogram_internal.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686138404 c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\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>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1686139466 c:\users\eeego\onedrive\Ðàáî÷èé ñòîë\cs_lab34_aul\project\histogram_internal.h
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -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="histogram_internal.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="205" topLine="0" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="unittest.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="1016" topLine="1" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
	<File name="doctest.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
					 | 
				
			||||||
		<Cursor>
 | 
					 | 
				
			||||||
			<Cursor1 position="112412" topLine="2358" />
 | 
					 | 
				
			||||||
		</Cursor>
 | 
					 | 
				
			||||||
	</File>
 | 
					 | 
				
			||||||
</CodeBlocks_layout_file>
 | 
					 | 
				
			||||||
					Загрузка…
					
					
				
		Ссылка в новой задаче