Answers for "how to know if a number is non integer c++"

C++
0

how to check sqrt of number is integer c++

bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
}
Posted by: Guest on May-16-2020
0

c++98 check if character is integer

std::string s = "1234798797";
std::istringstream iss(s);

int num = 0;

if (!(iss >> num).fail()) {
    std::cout << num << std::endl;
}
else {
    std::cerr << "There was a problem converting the string to an integer!" << std::endl;
}
Posted by: Guest on October-04-2020

Code answers related to "how to know if a number is non integer c++"

Browse Popular Code Answers by Language