code: разделение программы на файлы 2

main
LyzhinAK 22 часов назад
Родитель 42c11155e1
Сommit 74c4e78e81

@ -1,6 +1,7 @@
#include <iostream>
#include <vector>
#include "histogram.h"
#include "text.h"
using namespace std;
@ -22,32 +23,6 @@ input_data() {
return in;
}
void
show_histogram_text(vector <size_t> stolb, size_t bucket) {
const size_t SCREEN_WIDTH = 80;
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
int maxlen = 0;
for (int j = 0; j < bucket; j++)
{
if (maxlen<stolb[j]) maxlen = stolb[j];
}
for (int j = 0; j < bucket; j++)
{
if (stolb[j] < 100) cout << " ";
if (stolb[j] < 10) cout << " ";
cout << stolb[j] << "|";
size_t height = stolb[j];
if (maxlen > MAX_ASTERISK)
{
if (maxlen != stolb[j]) height = MAX_ASTERISK * (static_cast <float> (stolb[j])/maxlen);
else if (maxlen == stolb[j]) height = MAX_ASTERISK;
}
for (int i = 0; i < height; i++) cout << "*";
cout << "\n";
}}
int main()
{

Загрузка…
Отмена
Сохранить