add shape

This commit is contained in:
Shayan Abyar 2024-06-11 08:28:05 +03:30
parent 0e1d4e3aad
commit 415572d8e4
1 changed files with 53 additions and 0 deletions

53
Shapecal.cpp Normal file
View File

@ -0,0 +1,53 @@
#include <iostream>
#include <cmath>
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<<s.cubeVolume(3);
return 0;
}