Skip to content
Snippets Groups Projects
Commit c33bae66 authored by Kazuyuki Omi's avatar Kazuyuki Omi
Browse files

update main

parent 3f72cdfd
No related branches found
No related tags found
No related merge requests found
File added
No preview for this file type
......@@ -16,13 +16,12 @@ typedef struct setting
int header = -1;
std::vector<std::vector<int>> numbers;
int max_size_vector = 0;
int zaloha = 0;
} setting;
void get_error_100(setting &a)
{
std::cout << "Out of Range" << std::endl;
std::cerr <<"Out of range" << std::endl;
exit(100);
}
void get_error_101(setting &a)
......@@ -33,7 +32,7 @@ void get_error_101(setting &a)
void get_error_102(setting &a)
{
std::cerr << "Invalid configration" << std::endl;
std::cerr << "Invalid configuration" << std::endl;
exit(102);
}
......@@ -46,10 +45,15 @@ void get_error_103(setting &a)
void get_config(setting &a)
{
std::string line;
bool is_equal = false;
while (std::getline(std::cin, line))
{
if (line == "=") break;
if (line == "=")
{
is_equal = true;
break;
}
std::istringstream setting_stream(line);
std::string key;
......@@ -84,7 +88,11 @@ void get_config(setting &a)
setting_stream >> a.header;
}
}
}
if(!is_equal)
{
std::cerr<<"No input of end symbol '='"<<std::endl;
exit(105);
} }
void check_num_of_lettersb4(setting &a, const int &value)
{
......@@ -167,6 +175,7 @@ void print_config(const setting& a)
std::cout<<"config.stretch="<<a.stretch<<std::endl;
if(a.header != -1)
std::cout<<"config.header="<<a.header<<std::endl;
std::cout<<std::endl;
}
void print_roof(setting &a)
......@@ -201,8 +210,6 @@ void print_ABC(setting &a)
print_roof(a);
}
//stretch == 1//一個大きくします。
//それでも中に入りません、ー>#
bool check_num_of_letters(setting &a, const int num)
{
int tmp_length = std::to_string(num).length();
......@@ -222,7 +229,7 @@ void print_all_vectors(setting &a)
std::cout << "|";
std::cout << (a.align == "left" ? std::left : std::right);
for (int j = 0; j < a.max_size_vector; j++)
for (size_t j = 0; j < static_cast<size_t>(a.max_size_vector); j++)
{
if (j < a.numbers[i].size())
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment