📄 pizza2.cpp
字号:
#include <iostream>using namespace std;// find the price per square inch of pizza// to compare large and small sizes for the best value//// Owen Astrachan// March 29, 1999//double Cost(double radius, double price)// postcondition: returns the price per sq. inch{ return price/(3.14159*radius*radius);}int main(){ double smallRadius, largeRadius; double smallPrice, largePrice; double smallCost,largeCost; // input phase of computation cout << "enter radius and price of small pizza "; cin >> smallRadius >> smallPrice; cout << "enter radius and price of large pizza "; cin >> largeRadius >> largePrice; // process phase of computation smallCost = Cost(smallRadius,smallPrice); largeCost = Cost(largeRadius,largePrice); // output phase of computation cout << "cost of small pizza = " << smallCost << " per sq.inch" << endl; cout << "cost of large pizza = " << largeCost << " per sq.inch" << endl; if (smallCost < largeCost) { cout << "SMALL is the best value " << endl; } else { cout << "LARGE is the best value " << endl; } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -