//Micah Krosby CS1A Ch. 3, P. 147, # 18
/*******************************************************************************
*
* CALCULATE SLICE QUANTITY IN PIZZA
* _____________________________________________________________________________
*
* This program finds the amount of slices of a specified slice area that should
* be cut into a pizza of a specified diameter.
*
* FORMULAE-
* Area = PI * (Diameter/2)^2
* Slice Quantity = Pizza Area / Slice Area
* _____________________________________________________________________________
*
* INPUTS-
* diameter : Diameter of pizza requested
* sliceArea : Given area of pizza slices
*
* OUTPUTS-
* pizzaArea : Area of pizza requested
* sliceNumber : Number of slices in pizza requested
*
*******************************************************************************/
#include <iostream>
#include <iomanip>
#include <cmath>
#define PI 3.14
using namespace std;
int main() {
float diameter; //INPUT- Diameter of pizza
float sliceArea; //INPUT- Area of one slice
float pizzaArea; //OUTPUT- Area of pizza
float sliceNumber; //OUTPUT- Number of slices in pizza
//Initialize inputs
cout << "Diameter?" << endl;
cin >> diameter;
cout << endl;
sliceArea = 14.125;
//Calculate outputs
pizzaArea = PI * pow(diameter / 2, 2);
sliceNumber = pizzaArea / sliceArea;
//Formatted output
cout << "The amount of slices that should be cut into this pizza is "
<< fixed << setprecision(1) << sliceNumber << ".";
return 0;
}