Сравнить коммиты
	
		
			10 Коммитов 
		
	
	
		
			ee33b1de9d
			...
			ee8f95e22e
		
	
	| Автор | SHA1 | Дата | 
|---|---|---|
| 
							
							
								
								 | 
						ee8f95e22e | 2 лет назад | 
| 
							
							
								
								 | 
						8d7947bbc6 | 2 лет назад | 
| 
							
							
								
								 | 
						0fc9314af9 | 2 лет назад | 
| 
							
							
								
								 | 
						269ba68d08 | 2 лет назад | 
| 
							
							
								
								 | 
						ec9c2d496f | 2 лет назад | 
| 
							
							
								
								 | 
						0a70cb4524 | 2 лет назад | 
| 
							
							
								
								 | 
						3bc5b7faf2 | 2 лет назад | 
| 
							
							
								
								 | 
						9cfb62adea | 2 лет назад | 
| 
							
							
								
								 | 
						a45098c05a | 2 лет назад | 
| 
							
							
								
								 | 
						b8b28c9f43 | 2 лет назад | 
@ -1,4 +1,6 @@
 | 
				
			|||||||
\.vs
 | 
					\.vs
 | 
				
			||||||
cs-project3.vcxproj
 | 
					cs-project3.vcxproj
 | 
				
			||||||
cs-project3.vcxproj.filters
 | 
					cs-project3.vcxproj.filters
 | 
				
			||||||
 | 
					cs-project3.vcxproj
 | 
				
			||||||
 | 
					cs-project3.exe
 | 
				
			||||||
cs-project3.vcxproj
 | 
					cs-project3.vcxproj
 | 
				
			||||||
											
												
													Разница между файлами не показана из-за своего большого размера
													Загрузить разницу
												
											
										
									
								@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					#include "histogram.h"
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					find_minmax(const vector<double>& numbers, double& min, double& max) {
 | 
				
			||||||
 | 
					    min = numbers[0];
 | 
				
			||||||
 | 
					    for (size_t i = 1; i < numbers.size(); i++) {
 | 
				
			||||||
 | 
					        if (numbers[i] < min) {
 | 
				
			||||||
 | 
					            min = numbers[i];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (numbers[i] > max) {
 | 
				
			||||||
 | 
					            max = numbers[i];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vector<size_t>
 | 
				
			||||||
 | 
					make_histogram(const vector <double>& numbers, size_t bin_count) {
 | 
				
			||||||
 | 
					    double minc, maxc;
 | 
				
			||||||
 | 
					    find_minmax(numbers, minc, maxc);
 | 
				
			||||||
 | 
					    vector<size_t> bins(bin_count);
 | 
				
			||||||
 | 
					    double bin_size = (maxc - minc) / bin_count;
 | 
				
			||||||
 | 
					    size_t bin_max_size = 0;
 | 
				
			||||||
 | 
					    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 = minc + j * bin_size;
 | 
				
			||||||
 | 
					            auto hi = minc + (j + 1) * bin_size;
 | 
				
			||||||
 | 
					            if ((lo <= numbers[i]) && (numbers[i] < hi)) {
 | 
				
			||||||
 | 
					                bins[j]++;
 | 
				
			||||||
 | 
					                found = true;
 | 
				
			||||||
 | 
					                if (bins[j] > bin_max_size) {
 | 
				
			||||||
 | 
					                    bin_max_size = bins[j];
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!found) {
 | 
				
			||||||
 | 
					            bins[bin_count - 1]++;
 | 
				
			||||||
 | 
					            if (bins[bin_count - 1] > bin_max_size) {
 | 
				
			||||||
 | 
					                bin_max_size = bins[bin_count - 1];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return bins;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#pragma once 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					std::vector<size_t>
 | 
				
			||||||
 | 
					make_histogram(const std::vector<double>& numbers, size_t bin_count);
 | 
				
			||||||
@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					find_minmax(const std::vector<double>& numbers, double& min, double& max);
 | 
				
			||||||
@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					#include "text.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const size_t SCREEN_WIDTH = 80;
 | 
				
			||||||
 | 
					const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					show_histogram_text(vector<size_t> bins) {
 | 
				
			||||||
 | 
					    size_t bin_max_size = 0;
 | 
				
			||||||
 | 
					    for (auto bin : bins) {
 | 
				
			||||||
 | 
					        if (bin_max_size < bin) {
 | 
				
			||||||
 | 
					            bin_max_size = bin;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    double k = double(MAX_ASTERISK) / bin_max_size;
 | 
				
			||||||
 | 
					    if (k > 1) {
 | 
				
			||||||
 | 
					        k = 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (size_t bin = 0; bin < bins.size(); bin++) {
 | 
				
			||||||
 | 
					        if (bins[bin] < 100) {
 | 
				
			||||||
 | 
					            cout << " ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (bins[bin] < 10) {
 | 
				
			||||||
 | 
					            cout << " ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        cout << bins[bin] << "|";
 | 
				
			||||||
 | 
					        for (size_t i = 0; i < bins[bin] * k; i++) {
 | 
				
			||||||
 | 
					            cout << "*";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        cout << endl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void show_histogram_text(std::vector<size_t> bins);
 | 
				
			||||||
@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 | 
				
			||||||
 | 
					  <PropertyGroup />
 | 
				
			||||||
 | 
					</Project>
 | 
				
			||||||
											
												
													Разница между файлами не показана из-за своего большого размера
													Загрузить разницу
												
											
										
									
								@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					#include "histogram.h"
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					find_minmax(const vector<double>& numbers, double& min, double& max) {
 | 
				
			||||||
 | 
					    min = numbers[0];
 | 
				
			||||||
 | 
					    for (size_t i = 1; i < numbers.size(); i++) {
 | 
				
			||||||
 | 
					        if (numbers[i] < min) {
 | 
				
			||||||
 | 
					            min = numbers[i];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (numbers[i] > max) {
 | 
				
			||||||
 | 
					            max = numbers[i];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vector<size_t>
 | 
				
			||||||
 | 
					make_histogram(const vector <double>& numbers, size_t bin_count) {
 | 
				
			||||||
 | 
					    double minc, maxc;
 | 
				
			||||||
 | 
					    find_minmax(numbers, minc, maxc);
 | 
				
			||||||
 | 
					    vector<size_t> bins(bin_count);
 | 
				
			||||||
 | 
					    double bin_size = (maxc - minc) / bin_count;
 | 
				
			||||||
 | 
					    size_t bin_max_size = 0;
 | 
				
			||||||
 | 
					    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 = minc + j * bin_size;
 | 
				
			||||||
 | 
					            auto hi = minc + (j + 1) * bin_size;
 | 
				
			||||||
 | 
					            if ((lo <= numbers[i]) && (numbers[i] < hi)) {
 | 
				
			||||||
 | 
					                bins[j]++;
 | 
				
			||||||
 | 
					                found = true;
 | 
				
			||||||
 | 
					                if (bins[j] > bin_max_size) {
 | 
				
			||||||
 | 
					                    bin_max_size = bins[j];
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!found) {
 | 
				
			||||||
 | 
					            bins[bin_count - 1]++;
 | 
				
			||||||
 | 
					            if (bins[bin_count - 1] > bin_max_size) {
 | 
				
			||||||
 | 
					                bin_max_size = bins[bin_count - 1];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return bins;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#pragma once 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					std::vector<size_t>
 | 
				
			||||||
 | 
					make_histogram(const std::vector<double>& numbers, size_t bin_count);
 | 
				
			||||||
@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					find_minmax(const std::vector<double>& numbers, double& min, double& max);
 | 
				
			||||||
@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					#include "text.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const size_t SCREEN_WIDTH = 80;
 | 
				
			||||||
 | 
					const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					show_histogram_text(vector<size_t> bins) {
 | 
				
			||||||
 | 
					    size_t bin_max_size = 0;
 | 
				
			||||||
 | 
					    for (auto bin : bins) {
 | 
				
			||||||
 | 
					        if (bin_max_size < bin) {
 | 
				
			||||||
 | 
					            bin_max_size = bin;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    double k = double(MAX_ASTERISK) / bin_max_size;
 | 
				
			||||||
 | 
					    if (k > 1) {
 | 
				
			||||||
 | 
					        k = 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (size_t bin = 0; bin < bins.size(); bin++) {
 | 
				
			||||||
 | 
					        if (bins[bin] < 100) {
 | 
				
			||||||
 | 
					            cout << " ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (bins[bin] < 10) {
 | 
				
			||||||
 | 
					            cout << " ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        cout << bins[bin] << "|";
 | 
				
			||||||
 | 
					        for (size_t i = 0; i < bins[bin] * k; i++) {
 | 
				
			||||||
 | 
					            cout << "*";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        cout << endl;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void show_histogram_text(std::vector<size_t> bins);
 | 
				
			||||||
@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					#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);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<Project>
 | 
				
			||||||
 | 
					  <ProjectOutputs>
 | 
				
			||||||
 | 
					    <ProjectOutput>
 | 
				
			||||||
 | 
					      <FullPath>C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\x64\Debug\cs-project3.exe</FullPath>
 | 
				
			||||||
 | 
					    </ProjectOutput>
 | 
				
			||||||
 | 
					  </ProjectOutputs>
 | 
				
			||||||
 | 
					  <ContentFiles />
 | 
				
			||||||
 | 
					  <SatelliteDlls />
 | 
				
			||||||
 | 
					  <NonRecipeFileRefs />
 | 
				
			||||||
 | 
					</Project>
 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					  histogram.cpp
 | 
				
			||||||
 | 
					  unittest.cpp
 | 
				
			||||||
 | 
					  Создание кода...
 | 
				
			||||||
 | 
					  cs-project3.vcxproj -> C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\x64\Debug\cs-project3.exe
 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\cs-project3\histogram.cpp;C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\cs-project3\x64\Debug\histogram.obj
 | 
				
			||||||
 | 
					C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\cs-project3\unittest.cpp;C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\cs-project3\x64\Debug\unittest.obj
 | 
				
			||||||
@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:
 | 
				
			||||||
 | 
					Debug|x64|C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\|
 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					^C:\USERS\JUSTYGRASS\DESKTOP\PROGS\2_SEM\3LA\CS-PROJECT3\UNITTEST\CS-PROJECT3\X64\DEBUG\HISTOGRAM.OBJ|C:\USERS\JUSTYGRASS\DESKTOP\PROGS\2_SEM\3LA\CS-PROJECT3\UNITTEST\CS-PROJECT3\X64\DEBUG\UNITTEST.OBJ
 | 
				
			||||||
 | 
					C:\Users\justygrass\Desktop\progs\2_sem\3la\cs-project3\unittest\cs-project3\x64\Debug\cs-project3.ilk
 | 
				
			||||||
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
											
												Двоичный файл не отображается.
											
										
									
								
					Загрузка…
					
					
				
		Ссылка в новой задаче