//Andrew Alspaugh CS1A Chapter 3. P. 147. #18
//
/*****************************************************************************
*
*Calculate Number of Slices
* __________________________________________________________________________
* This program calculates how many slices any pizza can be divided into
*
* Equation used for solving = pi(d/2)^2/14.125
* _________________________________________________________________________
* INPUT:
* Diameter :Diameter of Pizza
* OUTPUT:
* Area :Area of Pizza
* Slices :Slices per Pizza
****************************************************************************/
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float Diameter; //Input Diameter
float Area; //Output Area
int Slices; //Output Slices
//Input Diameter
cout<<"enter diameter of pizza"<<endl;
cin>>Diameter;
//Use Diameter to Solve for Area
// Area = M_PI * pow((Diameter/2),2.0);
Area = M_PI * Diameter*Diameter/4;
cout<<"Area of Pizza is "<<Area<<endl;
//Divide Area by 14.125 to Solve for Slices
Slices = Area / 14.125;
cout<<"This Pizza has "<< Slices << " slices";
return 0;
}