X-man

导航

CodeBlocks调试功能(转)

转自:迂者-贺利坚

http://blog.csdn.net/sxhelijian/article/details/15026159








示例代码:

  1. #include <iostream>  
  2. using namespace std;  
  3. const double pi=3.1415926;  
  4. int main( )  
  5. {  
  6.     float r,a;  
  7.     cout<<"输入半径:"<<endl;  
  8.     cin>>r;  
  9.     a=pi*r*r;  
  10.     cout<<"输出面积:";  
  11.     cout<<a<<endl;  
  12.     return 0;  
  13. }  
  14.   
  15. float volume(float h,float r)  
  16. {  
  17.     return pi*r*r*h;  
  18. }  







实践代码:

  1. #include <iostream>  
  2. using namespace std;  
  3. const double pi=3.1415926;  
  4. int main( )  
  5. {  
  6.     int a;  
  7.     cout<<"请输入一个数:"<<endl;  
  8.     cin>>a;  
  9.     if(a = 2)  
  10.         cout<<"你2了。";  
  11.     else  
  12.         cout<<"你不2。";  
  13.     return 0;  
  14. }  

 





示例代码:

  1. #include <iostream>  
  2. using namespace std;  
  3. const double pi=3.1415926;  
  4. float area(float r);  
  5. int main( )  
  6. {  
  7.     float r1,a1;  
  8.     cin>>r1;  
  9.     a1=area(r1);  
  10.     cout<<a1<<endl;  
  11.     return 0;  
  12. }  
  13. float area(float r)  
  14. {  
  15.     float a;  
  16.     a = pi*r*r;  
  17.     return a;  
  18. }  

 





实践代码:

  1. #include <iostream>  
  2. using namespace std;  
  3. float max(float x, float y);  
  4. int main ()  
  5. {  
  6.     float a,b,c;  
  7.     cin>>a>>b;  
  8.     c=max(a, b) ;  
  9.     cout<<"The max is "<<c<<endl;  
  10.     return 0;  
  11. }  
  12. float max(float x, float y)  
  13. {  
  14.     float z;  
  15.     z=(x<y)? x : y ;  
  16.     return  z;  
  17. }  

 




示例代码:

  1. #include<iostream>  
  2. #include<cmath>  
  3. using namespace std;  
  4. int max(int,int);  
  5. int main( )  
  6. {  
  7.     int m,a,b;  
  8.     a=100;  
  9.     b=200;  
  10.     m=max(a,b);  
  11.     cout<<"最大:"<<m<<endl;  
  12.     return 0;  
  13. }  
  14. int max(int x,int y)  
  15. {  
  16.     int z;  
  17.     if(x>y)  
  18.         z=x;  
  19.     else  
  20.         z=y;  
  21.     return z;  
  22. }  

 




实践代码:

  1. #include <iostream>  
  2. using namespace std;  
  3. float max(float x, float y);  
  4. int main ()  
  5. {  
  6.     float a,b,c;  
  7.     cin>>a>>b;  
  8.     c=max(a, b) ;  
  9.     cout<<"The max is "<<c<<endl;  
  10.     return 0;  
  11. }  
  12. float max(float x, float y)  
  13. {  
  14.     float z;  
  15.     z=(x<y)? x : y ;  
  16.     return  z;  
  17. }  

 



 

posted on 2014-08-03 20:39  雨钝风轻  阅读(327)  评论(0编辑  收藏  举报