头文件的结构

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

(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 }
原文地址:https://www.cnblogs.com/borter/p/9405944.html