A beginner seeking guidance

I have been trying for a quite a while to detect why the program runs but doesnt show the final calculated outputs. Can anyone suggest me what is wrong in the given lines of code.

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
 #include <iostream>
#include <cmath> 
#include<iomanip>

using namespace std;
 
const double PI = 3.141592654;
double x;

void ConeVolume(double x, double n);

int main()
{
	double removedSectorLength;  
    double PaperRad;
    double paperCupBaseRad; //r
    double paperCupHeight; //h
    double paperCupVol;
    double PaperCircum;
    double maxVolume;

    //  Program Introduction to User ...
    cout << "\n\t ************************************************"    
         << "\n\t * Simple program that calculates a Max Volume  *"    
         << "\n\t * cup-like container from ciruclar paper sheet *"    
         << "\n\t *      with a pie-shaped wedge cut out.        *"    
         << "\n\t ************************************************"   
         << "\n\n" << endl;     
    
 	cout << fixed << showpoint << setprecision(6);   

    cout << "Enter the radius of the circular paper in inches: ";
    cin >> PaperRad;
    cout << endl;

    x = 0.00;
    removedSectorLength = 0.0;
    PaperCircum = 2 * PI * PaperRad;

    cout << fixed << showpoint << setprecision(2);

    while (x <= PaperCircum)
    {
        paperCupBaseRad = PaperRad  - (x / (2 * PI));
        paperCupHeight = sqrt(PaperRad * PaperRad - paperCupBaseRad * paperCupBaseRad);

        paperCupVol = (1.0 / 3.0) * PI * (paperCupBaseRad * paperCupBaseRad) * paperCupHeight;

        if (paperCupVol <= maxVolume)      
        {
            maxVolume = paperCupVol;
            removedSectorLength = x;
        }

        x = x + 0.01;
    }

    cout << "Length of the removed sector: " << removedSectorLength << " inch"<< endl;
    cout << "\nMax Volume " << maxVolume << " cubic inches"<< endl;

    //  Simple Hold Screen Code for Command Prompt C++ Compilers
    char holdscr;     // This character and section is to hold screen open
    cout << "\n\n\tPress a character and Enter to exit program. ";
    cin >> holdscr;     

	return 0;
}
What is this even supposed to do?
This is a program which calculates the max volume of a cup like container from circular paper sheet with a pie-shaped wedge cut out. It was a part of my assignment. I am stuck with the last part for almost 2 hours.
What does the while loop do?
Topic archived. No new replies allowed.