Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- /****************************************************/
- template <class T>
- int decimal_length(T n) { //requires cmath header
- return 1 + (int)floor(log10(n));
- }
- /****************************************************/
- int main() {
- std::cout << decimal_length(11111111111111) << std::endl; //too lazy to implement big integers
- }
Add Comment
Please, Sign In to add comment