编写程序。采用数据分散管理策略和集中管理策略,分别编写一个求长方形面积的C++程序。要求:用子函数Area计算长方形面积,主函数main负责输入长宽数据、调用子函数Area求面积,并显示面积的计算结果。
1 回答
已采纳

denmushi
TA贡献9条经验 获得超0个赞
#include <iostream> #include <stdlib.h> using namespace std; double Area(double width,double height); int main(void){ double width = 0,height = 0; cout << "请输入宽和长:"; cin >> width >> height; double S = Area(width,height); cout << "面积为:" << S << endl; system("pause"); return 0; } double Area(double width,double height){ return width*height; }
- 1 回答
- 1 关注
- 1934 浏览
添加回答
举报
0/150
提交
取消