「🗑️」 clean: cleanup things and slightly improved ex02/main.cpp
This commit is contained in:
@@ -13,8 +13,6 @@ Date::Date(void)
|
||||
|
||||
Date::Date(std::string str)
|
||||
{
|
||||
// check format (4 char & isdigit into dash into 2 char isdigit & < 1 && isdigit & < 2, and same for day except ahah funny cuz 30 and 31 and 28 and 29 agfjasfgfjahkfga)
|
||||
_value = 0;
|
||||
for (size_t i = 0; str[i]; ++i)
|
||||
{
|
||||
if (!isdigit(str[i]) && !((i == (str.length() - 6) || i == (str.length() - 3)) && str[i] == '-'))
|
||||
@@ -23,6 +21,8 @@ Date::Date(std::string str)
|
||||
throw std::invalid_argument("invalid date.");
|
||||
}
|
||||
}
|
||||
|
||||
_value = 0;
|
||||
for (std::string::iterator it = str.begin(); it < str.end(); ++it)
|
||||
{
|
||||
if (!isdigit(*it))
|
||||
|
||||
Reference in New Issue
Block a user