- 3
- 0
- 约4.87千字
- 约 66页
- 2022-08-28 发布于上海
- 举报
;在屏幕上显示:“This is my first program!”
程序代码如下:
# include iostream //包含基本输入输出库文件
using namespace std; //使用命名空间std
int main() //主函数名
{
cout This is my first program! ; //屏幕显示
return 0; //程序结束
};【例1.2】从键盘输入圆的半径,求圆的面积。
程序代码如下:
//*****ex1_2.cpp*****
#include iostream
using namespace std; //声明区
#define PI 3.14159
float sum(float x);
//函数区,以下为main函数
void main()
{
float r,s;
coutInput r:;
cinr;
s=sum(r);
coutr=r s= sendl;
}
//**函数区,以下为sum函数
float sum(float x)
{
return PI*x*x;
};#include iostream
using namespace std;
#define
原创力文档

文档评论(0)