​编写c++程序

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

yuantongxin
浏览 1935回答 1
1回答

denmushi

#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; }
打开App,查看更多内容
随时随地看视频慕课网APP