modified: ../as2/main.cpp
This commit is contained in:
@@ -226,15 +226,11 @@ private:
|
|||||||
{
|
{
|
||||||
std::ifstream ifs{fn};
|
std::ifstream ifs{fn};
|
||||||
check_file(ifs);
|
check_file(ifs);
|
||||||
for(std::string expr; !ifs.eof(); /* */)
|
for(std::string expr; !ifs.eof(); )
|
||||||
{
|
{
|
||||||
std::getline(ifs, expr);
|
std::getline(ifs, expr);
|
||||||
for(auto it = expr.cbegin(); it != expr.cend(); ++it)
|
auto it = expr.cbegin();
|
||||||
{
|
for( ; it != expr.cend() and std::isspace(*it); ++it);
|
||||||
if(std::isspace(*it))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(std::isdigit(*it))
|
if(std::isdigit(*it))
|
||||||
{
|
{
|
||||||
auto peek = it;
|
auto peek = it;
|
||||||
@@ -254,7 +250,6 @@ private:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return get_result_and_check();
|
return get_result_and_check();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -270,10 +265,10 @@ int main( int argc, char** argv )
|
|||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
if(argc != 2)
|
if(argc != 2)
|
||||||
throw std::runtime_error{"Cannot read file."};
|
throw std::runtime_error{"Cannot read file.\n"};
|
||||||
}catch (std::runtime_error e)
|
}catch (std::runtime_error e)
|
||||||
{
|
{
|
||||||
std::cerr << e.what() << " Programme terminated.\n";
|
std::cerr << e.what() << "Programme terminated.\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user