add TO_INFINITE_BASE flag
* add to increment() one more argument (char* brand_new_digit) * add TO_INFINITE_BASE functionality Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
This commit is contained in:
parent
df82e9e3eb
commit
06d3c41779
15
numericx.c
15
numericx.c
|
@ -79,16 +79,16 @@ numeral_infinity(char const* to_first, size_t cases)
|
|||
}
|
||||
|
||||
void
|
||||
increment(numeral_ptr* numeral, char* num_first, char* num_last)
|
||||
increment(numeral_ptr* numeral, char* num_first, char* num_last, char* brand_new_digit)
|
||||
{
|
||||
bool cycled = false;
|
||||
|
||||
if( numeral->symbol == num_last )
|
||||
{
|
||||
if( numeral->next == NULL )
|
||||
numeral->next = new_digit(numeral, num_first);
|
||||
numeral->next = new_digit(numeral, brand_new_digit);
|
||||
else
|
||||
increment(numeral->next, num_first, num_last);
|
||||
increment(numeral->next, num_first, num_last, brand_new_digit);
|
||||
|
||||
cycled = true;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
if( TO_FIRST_NUMBER_VOID )
|
||||
increment(result, to_first, to_last);
|
||||
increment(result, to_first, to_last, to_first);
|
||||
}
|
||||
|
||||
/* increments until it finishes */
|
||||
|
@ -249,12 +249,15 @@ main(int argc, char* argv[])
|
|||
puts("----");
|
||||
print_numeral(result);
|
||||
}
|
||||
increment(result, to_first, to_last);
|
||||
if( TO_INFINITE_BASE )
|
||||
increment(result, to_first, to_last, (to_first + 1));
|
||||
else
|
||||
increment(result, to_first, to_last, to_first);
|
||||
|
||||
if(DEBUG)
|
||||
print_numeral(counting);
|
||||
|
||||
increment(counting, from_first, from_last);
|
||||
increment(counting, from_first, from_last, from_first);
|
||||
}
|
||||
if(DEBUG)
|
||||
puts("----");
|
||||
|
|
Loading…
Reference in New Issue