Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to judge whether a number is an integer by programming?
How to judge whether a number is an integer by programming?
You can refer to the following code:

# include & ltiostream & gt

Use namespace std

int main(){

Floating a;

CIN & gt; & gta;

if(a-(int)a==0)

Cout & lt& lta<& lt "is an integer"

other

Cout & lt& lta<& lt "is not an integer"

Returns 0;

}

Extended data:

C++ correlation function

Double? Tanh(double x) returns the hyperbolic tangent tanh(x) value of x, where x is radian.

Double hypot(double x, double y) returns the length (z) of the hypotenuse of a right triangle.

Double? Ceil(double x) returns the smallest integer not less than x.

Double floor(double x) returns the largest integer not greater than x.

Void srand (unsigned seed) initializes the random number generator.

int? Rand () generates a random number and returns it.

Baidu encyclopedia -C++