Карелина Мария 2 лет назад
Родитель 70f5dd9f71
Сommit e51f0f0211

Двоичные данные
bin/Debug/devlab1.exe

Двоичный файл не отображается.

@ -1,5 +1,5 @@
# depslib dependency file v1.0
1682334548 source:c:\program files\codeblocks\devlab1\main.cpp
1685054501 source:c:\program files\codeblocks\devlab1\main.cpp
<iostream>
<vector>
<cmath>
@ -24,7 +24,7 @@
1682337558 c:\program files\codeblocks\devlab1\svg.h
<vector>
1682339123 source:c:\program files\codeblocks\devlab1\svg.cpp
1685054342 source:c:\program files\codeblocks\devlab1\svg.cpp
"svg.h"
<iostream>
<vector>

@ -23,8 +23,8 @@ make_histogram(const vector<double> &numbers,size_t bin_count)
{
float lo,hi,dif;
double min, max;
if(!find_minmax(numbers, min, max))
return 1;
// if(!find_minmax(numbers, min, max))
// return 1;
vector <size_t> bins(bin_count) ;
dif=(max - min)/bin_count;
for(int i=0; i < numbers.size(); i++)

@ -12,22 +12,31 @@ struct Input
int bin_count;
};
Input
input_data()
input_data(istream& in)
{
size_t number_count=0;
cerr<<"amount of numbers is ";
cin >> number_count;
Input in;
in.numbers.resize(number_count);
cerr<<"let's intro numbers ";
bool prompt;
if (promt){
cerr<<"amount of numbers is ";
}
in >> number_count;
Input inp;
inp.numbers.resize(number_count);
if (promt){
cerr<<"let's intro numbers ";
}
for (size_t i = 0; i < number_count; i++)
{
cin >> in.numbers[i];
in >> inp.numbers[i];
}
size_t bin_count=0;
if (promt){
cerr<<"amount of bins is ";
cin >> in.bin_count;
return in;
}
in >> inp.bin_count;
return inp;
}
//4199705
//0x71fdf8
@ -35,14 +44,14 @@ input_data()
int main()
{
auto in = input_data();
auto inp = input_data(cin);
//std::cout<<in.bin_count<<endl;
auto bins = make_histogram(in.numbers, in.bin_count);
auto bins = make_histogram(inp.numbers, inp.bin_count);
show_histogram_svg(bins);

Двоичные данные
obj/Debug/histogram.o

Двоичный файл не отображается.

Двоичные данные
obj/Debug/main.o

Двоичный файл не отображается.

Двоичные данные
obj/Debug/svg.o

Двоичный файл не отображается.

@ -4,21 +4,7 @@
using namespace std;
bool inbl(const int& BLOCK_WIDTH)
{
if (BLOCK_WIDTH>30)
{
cerr<< "too big, please make it smaller\n";
return false;
}
if (BLOCK_WIDTH<3)
{
cerr<< "too small, please make it bigger\n";
return false;
}
return true;
}
void
svg_begin(double width, double height)
@ -56,7 +42,7 @@ show_histogram_svg(vector<long long unsigned int> & bins)
const auto IMAGE_HEIGHT = 300;
const auto TEXT_LEFT = 20;
const auto TEXT_BASELINE = 20;
const auto BLOCK_WIDTH = 20;
const auto TEXT_WIDTH = 50;
const auto BIN_HEIGHT = 30;
const auto MAX_ASTERISK1 = 30;
@ -73,14 +59,7 @@ show_histogram_svg(vector<long long unsigned int> & bins)
int i = 0;
int BLOCK_WIDTH;
while (true){
cerr << "block width: ";
cin >> BLOCK_WIDTH;
if(inbl(BLOCK_WIDTH))
break;
}
auto maxb1 = maxb * BLOCK_WIDTH;

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