头文件由三部分内容组成:

(1)头文件开头处的版权和版本声明。

(2)预处理块。

(3)函数和类结构声明等。

 

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 const double PI=3.1416;
 6 int main(int argc, char** argv) {
 7     //声明3个变量
 8     double r,l,s; 
 9    
10     //输入圆的半径
11     cout<<"r=";                  
12     cin>>r; 
13 
14     //计算圆的周长
15     l=2*PI*r; 
16     cout<<"l="<<l<<endl; 
17      
18     //计算圆的面积
19     s=PI*r*r; 
20     cout<<"s="<<s<<endl;  
21     return 0;
22 }

 

相关文章:

  • 2021-09-20
  • 2022-12-23
  • 2021-04-26
  • 2022-02-09
  • 2022-12-23
  • 2021-10-29
猜你喜欢
  • 2021-06-11
  • 2021-05-28
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
相关资源
相似解决方案