title: C++ - Calculate number of slices in a pizza
body: <p>I wrote this program to calculate the number of slices for this size of pizza (diameter) given. But the results seem a bit off...  Any assistance would be much appreciated :)</p>
  
  <p>For example:
  If I input 18 inch pizza, it results in 4.00344 slices...
  If I input 22 inch pizza, it results in 4.8931 slices...</p>
  
  <p>See code below:</p>
  
  <pre><code>    #include &lt;iostream&gt;
  using namespace std;
  int main()
  {
      // Title of CMD Window
      system("title How many Slices are in your Pizza?");
      // Declare variables    
      double  diameter = 0.0,     // Diameter of the pizza
              slices = 0.0,       // No. of slices in the pizza
              area = 0.0,         // Area of the whole pizza
              oneSlice = 14.125;  // Area of one pizza slice
      const double PI = 3.14159;
      // Display prompt   
      cout &lt;&lt; "What is the diameter of the pizza (inches):" &lt;&lt; "\n";
      cin &gt;&gt; diameter;
      //  Calculate the area of the pizza
      area = PI * diameter;
      // Calculate number of slices for the size of pizza given
      slices = area / oneSlice;
      // Display results
      cout &lt;&lt; "\n\n" &lt;&lt; "You have " &lt;&lt; slices &lt;&lt; " slice(s) in this pizza:" &lt;&lt;  "\n\n"
           &lt;&lt; "************************************" &lt;&lt; "\n"
           &lt;&lt; "\tDiameter of pizza= " &lt;&lt; diameter &lt;&lt; "\n"
           &lt;&lt; "\tArea of pizza= " &lt;&lt; area &lt;&lt; "\n"
           &lt;&lt; "************************************" &lt;&lt; "\n";
      system("pause"); 
      return 0;
  } 
  // End of program
  </code></pre>