Pure Programmer
Blue Matrix


Cluster Map

Project: Milky Way Volume Estimate

Estimate the volume of the [[Milky Way]] Galaxy. Assume that the Milky Way Galaxy can be modeled by a disk with radius of 52,850 light-years and thickness of 1,000 light-years. Also assume a central bulge modeled as a sphere of radius 10,000 light-years. The disk should have a 10,000 light-year hole in it so we don't double count the volume included in the sphere.

See [[Cylinder#Right_circular_hollow_cylinder_(cylindrical_shell)|Cylinder Volume]] and [[Sphere#Enclosed_volume|Sphere Volume]]

Output
$ g++ -std=c++17 MilkyWayVolume.cpp -o MilkyWayVolume -lfmt $ ./MilkyWayVolume The Milky Way volume ≈ 9.957e+12 light-year³

Solution