repl.it
@TheGman753/

Circle Calculator

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <cmath>
#include <complex>
#include <cfloat>
#include <climits>
#include <cstdio>
using namespace std;
void line(),pause();
const double pi = 3.14159;

int main()
{
  int r,h;
    cout << "\tMade by TheGman753" << endl;
    line();
    cout << "Input radius(r), the press ENTER: ";
    cin >> r;
    long double base;
    base = r;
    cout << "Input height(h) (Only if dome, if not, put 0): ";
    cin >> h;
    long double otherbase;
    otherbase = h;
    line();
    int exponent = 2;
    cout << "\tIf circle" << endl;
    line();
    cout << "\tEvaluations" << endl;
    pause();
    cout << "     Diameter: " << 2 * r << endl;
    cout << "\t Area: " << pi * pow(base, exponent) << endl;
    cout << "Circumference: " << 2 * pi * r << endl;
    line();
    cout << "\tIf half-circle" << endl;
    line();
    cout << "\tEvaluations" << endl;
    pause();
    cout << "\t Area: " << pi * r * r / 2 << endl;
    cout << "Circumference: " << 2 * pi * r / 2 << endl;
    line();
    cout << "\tIf dome" << endl;
    line();
    cout << "\tEvaluations" << endl;
    pause();
    cout << "Radius of Curvature: " << pow(base, exponent) * pow(otherbase, exponent) / 2 * h << endl;
    cout << "Circumference of Base: " << 2 * pi * r << endl;
    cout << "Floor Area: " << pi * pow(base, exponent) << endl;
    cout << "Surface Area: " << pi * (pow(otherbase, exponent) + pow(base, exponent)) << endl;
    cout << "volume: " << 0.52360 * h * (3 * pow(base, exponent) + pow(otherbase, exponent)) << endl;
    line();
    int reexponent = 3;
    cout << "\tIf sphere" << endl;
    line();
    cout << "\tEvaluations" << endl;
    pause();
    cout << "\tVolume: " << 4.18879 * pow(base, reexponent) << endl; 
    cout << "Surface Area: " << 4 * pi * pow(base, exponent) << endl;
    line();
    return 0;
}
void line()
{
  cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
}
void pause()
{
  cout << "" << endl;
}
?