Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Calculate volume of a cone
- #include <iostream>
- #include <string>
- #include <math.h>
- float radius = 1.5;
- float height = 10;
- int main()
- {
- float radius_S = pow(radius, 2);
- std::string radius_S_string = std::to_string(radius_S);
- std::cout << ("Radius^2: " + radius_S_string);
- float radius_StH = radius_S * height;
- std::cout << ("\nRadius^2*height: " + std::to_string(radius_StH));
- float radius_StHtP = radius_StH * M_PI;
- float radius_StHtPdOT = radius_StHtP * 1/3;
- std::cout << ("\nVolume: " + std::to_string(radius_StHtPdOT));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement