Type casting in C++ allows you to convert a variable from one type to another. This can be done using several methods, including C-style casts, static_cast
, dynamic_cast
, const_cast
, and reinterpret_cast
.
” float “
In C++, float
is a fundamental data type used to represent single-precision floating-point numbers. It is typically used to store decimal numbers with a fractional component and is defined by the IEEE 754 standard. The float
type is generally 4 bytes (32 bits) in size, which allows it to represent a wide range of values, though with limited precision compared to double
.
Program-1
input:
output:
Circle
In C++, a “circle” isn’t a built-in concept but can be represented using a class or a struct to encapsulate the properties and behaviors of a circle. This typically includes the circle’s radius and potentially its center coordinates (x, y). Additionally, methods can be provided to calculate properties like the area, circumference, and other relevant operations.
Program-2
input:
output: