(new) code: Добавлен индикатор вывода подсказок prompt

main
Ишутина Елизавета 2 лет назад
Родитель 9ca4920874
Сommit ba843ef1c3

@ -16,14 +16,18 @@ struct Input{
}; };
Input Input
input_data(istream &thread){ input_data(istream &thread, bool &prompt){
//ïðîèçîøëà íàêëàäêà ñ èìåíàìè ïåðåìåííûõ: ïðè íàçâàíèè ïîòîêà in ðóãàåòñÿ íà ñ22, â êîòîðîé ÿêîáû îáúÿâëÿåòñÿ àðãóìåíò
size_t number_count; size_t number_count;
if (prompt) {cerr << "Enter the amount of numbers: " << endl;}
cin >> number_count; cin >> number_count;
Input in; Input in;
in.numbers.resize(number_count); in.numbers.resize(number_count);
if (prompt) {cerr << "Enter the numbers: " << endl;}
for (size_t i = 0; i < number_count; i++) { for (size_t i = 0; i < number_count; i++) {
cin >> in.numbers[i]; cin >> in.numbers[i];
} }
if (prompt) {cerr << "Enter the amount of bins: " << endl;}
cin >> in.bin_count; cin >> in.bin_count;
return in; return in;
} }
@ -32,12 +36,13 @@ int
main(){ main(){
double min = 0, max = 0; double min = 0, max = 0;
size_t font = 0; size_t font = 0;
auto in = input_data(cin); bool prompt = false;
auto in = input_data(cin, prompt);
auto bins = make_histogram(in.numbers, in.bin_count); auto bins = make_histogram(in.numbers, in.bin_count);
//for (auto now: bins) {cout << now << endl;} //for (auto now: bins) {cout << now << endl;}
cin >> font; cin >> font;
if (font < 8) {cerr << "Font value is too small. Please, edit the input file.";} if (font < 8) {(cerr << font << "Font value is too small. Please, edit the input file.");}
else if (font > 32) {cerr << "Font value is too large. Please, edit the input file.";} else if (font > 32) {(cerr << "Font value is too large. Please, edit the input file.");}
else {show_histogram_svg(bins, font);} else {show_histogram_svg(bins, font);}
return 0; return 0;
} }

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