#include <iostream>
#include <cmath>
using namespace std;
void print_name()
{
cout<<" ni hao xiaomao"<<endl;
cout<<" ni hao xiaogou"<<endl;
cout<<" ni hao xiaotu"<<endl;
}
int main (){
float pai;
float r;
float s,ss;
pai =3.14;
cout <<"enter r"<<endl;
cin>>r;
s =pai*r*r;
cout <<” r = ”<<r<<" s= "<<s<<endl;
ss =pai*pow(r,2);
cout <<” r = ”<<r<<" ss= "<<ss<<endl;
print_name();
return 0;
}
表达式:
- 优先级: *,/,%,+,-;
- 括号的使用:括号优先;
3、数学库及常用的数学函数: abs(), pow(), sqrt();log()等;
顺序结构:
- 从main()函数开始执行
- 逐条语句执行;
作业:
1、已知正方形的面积是16.0, 编写程序求其边长;
2、编程通过输入设备输入任意非负数的正方形面积,求其对应的边长的值;