C++ examples for Data Type:float
The modulus operator, %, can't be used with floating-point operands.
You can use the prefix and postfix increment and decrement operators, ++ and -- to a floating-point variable: the variable will be incremented or decremented by 1.0.
#include <iostream> int main()//ww w. j av a 2 s. com { const double pi {3.1414926}; // Circumference of a circle divided by its diameter double a {0.75}; // Thickness of a pizza double z {5.5}; // Radius of a pizza double volume {}; // Volume of pizza - to be calculated volume = pi*z*z*a; std::cout << "volume:" << volume << std::endl; }