Answers for "c++ int length"

C++
1

c++ int length

ex: input = 2424, output = 4
static int intlen(int n)
{
  if (n == 0) return 1;
  else if (n < 0) return 2 + static_cast<std::size_t>(std::log10(-n));
  else if (n > 0) return 1 + static_cast<std::size_t>(std::log10(n));
}
Posted by: Guest on October-16-2021
29

range of long long in c++

Long
Data Type	          Size             (in bytes)	Range
long int	            4	         -2,147,483,648 to 2,147,483,647
unsigned long int	    4	         0 to 4,294,967,295
long long int	        8	         -(2^63) to (2^63)-1
unsigned long long int	8	         0 to 18,446,744,073,709,551,615
Posted by: Guest on May-09-2020
5

data types in c++

int myNum = 5;               // Integer (whole number)
float myFloatNum = 5.99;     // Floating point number
double myDoubleNum = 9.98;   // Floating point number
char myLetter = 'D';         // Character
bool myBoolean = true;       // Boolean
string myText = "Hello";     // String
Posted by: Guest on July-28-2020
-1

c++ length of int

unsigned int number_of_digits = 0;

do {
     ++number_of_digits; 
     n /= base;
} while (n);
Posted by: Guest on September-10-2020
-1

length of int c++

sizeof(num);
Posted by: Guest on October-12-2020

Browse Popular Code Answers by Language