code: вынесены функции из основного кода

main
BobrovnikYA 3 месяцев назад
Родитель bef88b1f50
Сommit 6abd58ecf8

3
.gitignore поставляемый

@ -0,0 +1,3 @@
/bin
/obj
/lab01.layout

@ -0,0 +1,54 @@
#include "text.h"
#include <iostream>
#include <vector>
using namespace std;
//gygygygfgcfgrdrtf
void show_histogram_text(const vector <size_t>& bins,size_t bin_count, size_t max_count)
{
const size_t SCREEN_WIDTH = 80;
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
bool scaling = false;
if (max_count > MAX_ASTERISK)
{
scaling = true;
}
for (size_t i = 0; i < bin_count; i++)
{
if (bins[i] < 10)
{
cout << " ";
}
else if (bins[i] < 100)
{
cout << " ";
}
else
{
cout << "";
}
cout << bins[i] << '|';
size_t number_of_stars = bins[i];
if (scaling)
{
if (bins[i] == max_count)
{
number_of_stars = MAX_ASTERISK * 1.0;
}
else
{
number_of_stars = MAX_ASTERISK * (static_cast<double>(bins[i]) / max_count);
}
}
for (size_t j = 0; j < number_of_stars; j++)
{
cout << '*';
}
cout << endl;
}
}

@ -0,0 +1,9 @@
#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

@ -0,0 +1,5 @@
# depslib dependency file v1.0
1746105820 source:c:\users\liza\desktop\lab01\lab01\main.cpp
<iostream>
<vector>
Загрузка…
Отмена
Сохранить