cpp06 first try
This commit is contained in:
parent
f77b0eda83
commit
a1d3d379de
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/08/06 16:53:32 by apommier #+# #+# */
|
||||
/* Updated: 2022/08/06 18:29:37 by apommier ### ########.fr */
|
||||
/* Updated: 2022/08/06 19:41:49 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -49,7 +49,7 @@ void printConversion(double nbr)
|
||||
if (nbr <= FLT_MAX && nbr >= -FLT_MAX)
|
||||
{
|
||||
std::cout << "float: " << static_cast<float>(nbr);
|
||||
if (static_cast<float>(nbr) == floor(nbr))
|
||||
if (nbr - static_cast<int>(nbr) == 0.0)
|
||||
std::cout << ".0";
|
||||
std::cout << "f" << std::endl;
|
||||
}
|
||||
@ -58,7 +58,7 @@ void printConversion(double nbr)
|
||||
|
||||
//double cast
|
||||
std::cout << "double: " << static_cast<double>(nbr);
|
||||
if (static_cast<double>(nbr) == floor(nbr))
|
||||
if (nbr - static_cast<int>(nbr) == 0.0)
|
||||
std::cout << ".0";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user