modified: ../as2/main.cpp

This commit is contained in:
mooophy
2014-12-05 11:38:58 +13:00
parent 1ec65c245b
commit e7ad8330c7

View File

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