code: добавил prompt
Этот коммит содержится в:
7
main.cpp
7
main.cpp
@@ -14,11 +14,13 @@ struct Input
|
||||
};
|
||||
|
||||
Input
|
||||
input_data(istream& in)
|
||||
input_data(istream& in, bool prompt)
|
||||
{
|
||||
size_t number_count;
|
||||
if (prompt)
|
||||
cerr<<"Enter number count: ";
|
||||
in >> number_count;
|
||||
if (prompt)
|
||||
cerr << "Enter numbers : " << endl;
|
||||
|
||||
Input ik;
|
||||
@@ -27,6 +29,7 @@ input_data(istream& in)
|
||||
{
|
||||
cin >> ik.numbers[i];
|
||||
}
|
||||
if (prompt)
|
||||
cerr<< "Enter bin count: ";
|
||||
cin >> ik.bin_count;
|
||||
return ik;
|
||||
@@ -34,7 +37,7 @@ input_data(istream& in)
|
||||
|
||||
int main()
|
||||
{
|
||||
auto in = input_data(cin);
|
||||
auto in = input_data(cin, true);
|
||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||
show_histogram_svg(bins);
|
||||
getch();
|
||||
|
||||
16
svg.cpp
16
svg.cpp
@@ -4,21 +4,9 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "svg.h"
|
||||
//#include "sr.h"
|
||||
|
||||
//using namespace std;
|
||||
//
|
||||
//double sr(const vector<size_t>& bins) {
|
||||
// size_t totalHeight = 0;
|
||||
// for (size_t bin : bins) {
|
||||
// totalHeight += bin;
|
||||
// }
|
||||
//
|
||||
// return static_cast<double>(totalHeight) / bins.size();
|
||||
//}
|
||||
|
||||
|
||||
#include "sr.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
svg_begin(double width, double height)
|
||||
|
||||
Ссылка в новой задаче
Block a user