C++
来源:互联网 发布:智慧树网络教育平台 编辑:程序博客网 时间:2024/06/14 08:03
/************************************************************
· Copyright (C) 田鑫
· File Name:计算矩形的周长和面积(函数版本)
· Description:
· Function List:
· Compiler Environment:Visual Studio 2017
· History:<2017.3.20> <Create project> <田鑫>
*************************************************************/
#include <iostream>
using namespace std;
float area(float a, float b);
float circu(float a, float b);
int main(void)
{
float a, b;
cout << "请输矩形的两条边(Tab/Enter/space分隔):";
cin >> a >> b;
cout << "周长等于:" << circu(a, b) << endl;
cout << "面积等于:" << area(a, b) << endl;
system("pause");
return 0;
}
/* 求面积 */
float area(float a, float b)
{
return a * b;
}
/* 求周长 */
float circu(float a, float b)
{
return 2 * (a + b);
· Copyright (C) 田鑫
· File Name:计算矩形的周长和面积(函数版本)
· Description:
· Function List:
· Compiler Environment:Visual Studio 2017
· History:<2017.3.20> <Create project> <田鑫>
*************************************************************/
#include <iostream>
using namespace std;
float area(float a, float b);
float circu(float a, float b);
int main(void)
{
float a, b;
cout << "请输矩形的两条边(Tab/Enter/space分隔):";
cin >> a >> b;
cout << "周长等于:" << circu(a, b) << endl;
cout << "面积等于:" << area(a, b) << endl;
system("pause");
return 0;
}
/* 求面积 */
float area(float a, float b)
{
return a * b;
}
/* 求周长 */
float circu(float a, float b)
{
return 2 * (a + b);
}
运行结果:
0 0
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- C
- c
- C
- x264_param_t参数注解
- 网页style常用的属性
- CodeForces 300E Empire Strikes Back
- Java中的内存和效率优化(持续更新)
- android 图片加载库 Glide 的使用介绍
- C++
- MyEclipse 10汉化教程
- 字符串上的动态规划算法应用
- I2C Timing Item
- 【工作笔记】从零开始学ElasticSearch( 九)—— 高级扩展:分布式CRUD
- eclipse maven 请求的操作无法在使用用户映射区域打开的文件上执行
- House Robber
- 如何让孩子爱上设计模式 ——20.解释器模式(Interpreter Pattern)
- Sublime Text快捷键: