为了账号安全,请及时绑定邮箱和手机立即绑定

​编写c++程序

​编写c++程序

C++
yuantongxin 2015-11-15 16:32:31
编写程序。采用数据分散管理策略和集中管理策略,分别编写一个求长方形面积的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;
}


查看完整回答
反对 回复 2015-11-15
  • 1 回答
  • 1 关注
  • 1888 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信