1 Star 0 Fork 1

gf721/C++练手

forked from 邓永盛/C++练手 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
04-函数重载.cpp 384 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include <iostream>
using namespace std;
const double PI = 3.1415926535;
double area(double radius)
{
return radius*radius*PI;
}
double area(double width,double height)
{
return height * width;
}
int main()
{
double r,h,w;
cout<<"请输入圆的半径:";
cin>>r;
cout<<"圆的面积为:"<<area(r)<<endl;
cout<<"请输入矩形的长和宽:";
cin>>w>>h;
cout<<"矩形的面积为:"<<area(h,w);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/gf721/cpp-practice.git
git@gitee.com:gf721/cpp-practice.git
gf721
cpp-practice
C++练手
master

搜索帮助