From 415572d8e4a5acdc4790d40890c60e8f89468567 Mon Sep 17 00:00:00 2001 From: Shayan Abyar Date: Tue, 11 Jun 2024 08:28:05 +0330 Subject: [PATCH] add shape --- Shapecal.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Shapecal.cpp diff --git a/Shapecal.cpp b/Shapecal.cpp new file mode 100644 index 0000000..b48a448 --- /dev/null +++ b/Shapecal.cpp @@ -0,0 +1,53 @@ +#include +#include +using namespace std; +#define PI 3.14 +class ShapeCal { +public: + + double KoreVolume(double r) { + return (4.0 / 3.0) * PI * pow(r, 3); + } + + double koreArea(double r) { + return 4 * PI * pow(r, 2); + } + + + double ostovaneVolume(double r, double height) { + return PI * pow(r, 2) * height; + } + + double ostovaneArea(double r, double height) { + return 2 * PI * r * (r + height); + } + + + double coneVolume(double r, double height) { + return (1.0 / 3.0) * PI * pow(r, 2) * height; + } + + double coneArea(double r, double height) { + double l = sqrt(pow(r, 2) + pow(height, 2)); + return PI * r * (r +l); + } + + + double cubeVolume(double a) { + return pow(a, 3); + } + + static double cubeArea(double a) { + return 6 * pow(a, 2); + } +}; + +int main() { + double r = 5.0; + double height = 10.0; + double a = 4.0; + +ShapeCal s; +cout<