首页 > 代码库 > CodeBlocks调试功能(转)
CodeBlocks调试功能(转)
转自:迂者-贺利坚
http://blog.csdn.net/sxhelijian/article/details/15026159
示例代码:
[cpp] view plaincopyprint?
- #include <iostream>
- using namespace std;
- const double pi=3.1415926;
- int main( )
- {
- float r,a;
- cout<<"输入半径:"<<endl;
- cin>>r;
- a=pi*r*r;
- cout<<"输出面积:";
- cout<<a<<endl;
- return 0;
- }
- float volume(float h,float r)
- {
- return pi*r*r*h;
- }
实践代码:
[cpp] view plaincopyprint?
- #include <iostream>
- using namespace std;
- const double pi=3.1415926;
- int main( )
- {
- int a;
- cout<<"请输入一个数:"<<endl;
- cin>>a;
- if(a = 2)
- cout<<"你2了。";
- else
- cout<<"你不2。";
- return 0;
- }
示例代码:
[cpp] view plaincopyprint?
- #include <iostream>
- using namespace std;
- const double pi=3.1415926;
- float area(float r);
- int main( )
- {
- float r1,a1;
- cin>>r1;
- a1=area(r1);
- cout<<a1<<endl;
- return 0;
- }
- float area(float r)
- {
- float a;
- a = pi*r*r;
- return a;
- }
实践代码:
[cpp] view plaincopyprint?
- #include <iostream>
- using namespace std;
- float max(float x, float y);
- int main ()
- {
- float a,b,c;
- cin>>a>>b;
- c=max(a, b) ;
- cout<<"The max is "<<c<<endl;
- return 0;
- }
- float max(float x, float y)
- {
- float z;
- z=(x<y)? x : y ;
- return z;
- }
示例代码:
[cpp] view plaincopyprint?
- #include<iostream>
- #include<cmath>
- using namespace std;
- int max(int,int);
- int main( )
- {
- int m,a,b;
- a=100;
- b=200;
- m=max(a,b);
- cout<<"最大:"<<m<<endl;
- return 0;
- }
- int max(int x,int y)
- {
- int z;
- if(x>y)
- z=x;
- else
- z=y;
- return z;
- }
实践代码:
[cpp] view plaincopyprint?
- #include <iostream>
- using namespace std;
- float max(float x, float y);
- int main ()
- {
- float a,b,c;
- cin>>a>>b;
- c=max(a, b) ;
- cout<<"The max is "<<c<<endl;
- return 0;
- }
- float max(float x, float y)
- {
- float z;
- z=(x<y)? x : y ;
- return z;
- }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。