// print function // the number is stored in a vector with the 0th position being the least // significant 'bits' -> go from last to first and concatenate to print // the correct output void print(const vi &v) { for (vi::const_reverse_iterator rit = v.rbegin(); rit != v.rend(); ++rit) { (rit != v.rbegin()) ? printf("%04d", *rit) : printf("%d", *rit); } printf("\n"); }