master
Stepan Siniavskii 2 лет назад
Родитель 112373a5bd
Сommit cabdd614f4

@ -39,12 +39,14 @@
<vector>
<string>
1685953545 source:c:\users\stepa\desktop\lab04\lab04\main.cpp
1685959652 source:c:\users\stepa\desktop\lab04\lab04\main.cpp
<iostream>
"vector"
"svg.h"
<vector>
<conio.h>
"histogram.h"
"curl/curl.h"
"text.h"
"svg.h"
<curl/curl.h>
<sstream>
<string>
@ -96,3 +98,7 @@
1684137360 c:\users\stepa\desktop\lab04\lab04\curl\include\curl\typecheck-gcc.h
1684754566 c:\users\stepa\desktop\lab04\lab04\text.h
<vector>
<cstddef>

@ -2,19 +2,19 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name=".gitignore" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="histogram.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="29" topLine="0" />
<Cursor1 position="0" topLine="3" />
</Cursor>
</File>
<File name="histogram.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name=".gitignore" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="3" />
<Cursor1 position="29" topLine="0" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
<Cursor>
<Cursor1 position="1800" topLine="59" />
<Cursor1 position="1158" topLine="56" />
</Cursor>
</File>
</CodeBlocks_layout_file>

@ -75,46 +75,36 @@ download(const string& address)
int main(int argc, char* argv[])
{
Input input;
Input input;
if (argc > 1)
{
input = download(argv[3]);
int bins_cnt = atoi(argv[2]);
string check = typeid(atoi(argv[2])).name();
if(check != "int"){
cout << "Ââåäèòå ÷èñëî ïîñëå -bins";
return 0;
int bins_cnt = 0;
for (int i = 1; i < argc; i++) {
string arg = argv[i];
if (arg == "-bins") {
if (i + 1 < argc) {
bins_cnt = stoi(argv[i+1]);
if(i + 2 < argc){
input = download(argv[i+2]);
}
else{
input = download(argv[i-1]);
}
i++;
} else {
cout << "Missing argument value for -bins option" << endl;
return 1;
}
}
}
const auto bins = make_histogram(input.numbers, bins_cnt);
show_histogram_svg(bins);
}
else
{
input = input_data(cin, true);
const auto bins = make_histogram(input.numbers, input.bin_count);
show_histogram_svg(bins);
}
//const auto bins = make_histogram(input.numbers, input.bin_count);
}
/*
int main(int argc, char* argv[])
{
Input input;
if (argc > 1)
{
int bins_cnt = atoi(argv[2]);
input = download(argv[3]);
const auto bins = make_histogram(input.numbers, bins_cnt);
}else{
}
else
{
input = input_data(cin, true);
const auto bins = make_histogram(input.numbers, input.bin_count);
show_histogram_svg(bins);
}
}
*/

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