#include using namespace std;

float circleArea(float r) { // 定义圆的面积函数 float Pi = 3.14; return Pi * r * r; }

int main() { float r; cout << '请输入圆的半径:'; cin >> r; float area = circleArea(r); // 调用圆的面积函数 cout << '圆的面积为:' << fixed << setprecision(2) << area << endl; // 输出结果,保留两位小数 return 0; }


原文地址: https://www.cveoy.top/t/topic/nB1p 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录