Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

intlen in c++

// getting the legth of an int by turning it into a string
// works with double and float too

#include <iostream>

int num = 0;

// turning num into a string using std::string
std::string temp = std::to_string(num);

// getting the length using .length()
int len = temp.length();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #intlen
ADD COMMENT
Topic
Name
6+3 =