PROGRAMMING

profileZXC!@#
Pizza.cpp

/* Page 108 # 14 Pizza Program */ #include <iostream> #include <iomanip> using namespace std; int main() { int numSmall = 0, numMedium = 0, numLarge = 0, numFamily = 0, totalSold = 0; double pctSmall = 0, pctMedium = 0, pctLarge = 0, pctFamily = 0; cout << "How many small? "; cin >> numSmall; cout << "How many medium? "; cin >> numMedium; cout << "How many large? "; cin >> numLarge; cout << "How many small? "; cin >> numFamily; totalSold = (numSmall + numMedium + numLarge + numFamily); pctSmall = ( (float)numSmall / totalSold ); pctMedium = ( (float)numMedium / totalSold ); pctLarge = ( (float)numLarge / totalSold ); pctFamily = ( (float)numFamily / totalSold ); cout << fixed << setprecision(2); cout << "Percentage of small is " << pctSmall << endl; cout << "Percentage of medium is " << pctMedium << endl; cout << "Percentage of large is " << pctLarge << endl; cout << "Percentage of family is " << pctFamily << endl; system("pause"); return 0; } //main