comments
This commit is contained in:
parent
8992990dc5
commit
ed0dd06804
@ -25,6 +25,11 @@ T ask_question(const string& question)
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns true if answer was 'J'. False if user answered with 'N'
|
||||
* \param question The question for user input.
|
||||
* \return
|
||||
*/
|
||||
bool ask_question(const string& question)
|
||||
{
|
||||
while (true)
|
||||
@ -42,10 +47,16 @@ bool ask_question(const string& question)
|
||||
}
|
||||
}
|
||||
|
||||
auto int_to_string(const unsigned int value, const unsigned int numbers = 0) -> string
|
||||
/**
|
||||
* \brief Converts a int to string and fill up with '0' at first position.
|
||||
* \param value the integer value.
|
||||
* \param digits Number of digits to fill
|
||||
* \return Formatted integer as string
|
||||
*/
|
||||
auto int_to_string(const unsigned int value, const unsigned int digits = 0) -> string
|
||||
{
|
||||
auto str = to_string(value);
|
||||
const auto len = numbers > str.length() ? numbers - str.length() : 0;
|
||||
const auto len = digits > str.length() ? digits - str.length() : 0;
|
||||
for (unsigned int i = 0; i < len; ++i)
|
||||
{
|
||||
str.insert(0, "0");
|
||||
|
Loading…
x
Reference in New Issue
Block a user