第十四周项目6-阅读程序
来源:互联网 发布:企业建站优化方案 编辑:程序博客网 时间:2024/05/16 05:12
#include <iostream>using namespace std;int main(){ int a [6]={2,-3,4,-6,-8,10}, i; for (i=0;i<6;i++) { if(a[i]<0) continue; cout<<a[i]<<" "; } cout<<endl; return 0;}
#include <iostream>using namespace std;int main( ){ int y=53,i=0,j,a[8]; do { a[i++]=y%2; y=y/2; }while(y!=0) ; for(j=i-1;j>=0;j--) cout<<a[j]; cout<<endl; return 0;}
#include <iostream>using namespace std;int main( ){ char ch[]={"12yue25ri"}; int i,s=0; for(i=0;ch[i]>='0' && ch[i]<='9';i++) s=10*s+ch[i]-'0'; cout<<s<<endl; return 0;}
#include <iostream>using namespace std;int main( ){ int n=0; char str[80]="Beijing-China 2008"; cout<<str<<endl; while(str[n]!='\0') str[n++]=str[n]>='a'&&str[n]<='z'?str[n]-'a'+'A':str[n]; cout<<str<<endl; return 0;}
#include <iostream>using namespace std;int main( ){ int x[2][3]={5,4,6,7,8,9}; int m[2],i,j; for (i=0;i<2;i++) { m[i]=x[i][0]; for(j=1;j<3;j++) if(x[i][j]<m[i]) m[i]=x[i][j]; } for (i=0;i<2;i++) cout<<m[i]<<endl; return 0;}
#include <iostream>using namespace std;int main( ){ int a[4][4]={1,2,4,7,2,3,5,8,4,5,6,9,7,8,9,10}; int i,j,found=0; for(i=0;j<4;i++) for(j=0;j<=i;j++) if(a[i][j]!=a[j][i]) { found=1; break; } if(found) cout<<"No!"<<endl; else cout<<"Yes!"<<endl; return 0;}
#include <iostream>#include <iomanip>using namespace std;int main(){ int a[5][5]={0},i,j,k; k=1; for (i=0;i<5;i++) for (j=i;j>=0;j--) a[j][i-j]=k++; for (i=0;i<5;i++) { for (j=0;j<5-i;j++) cout<<setw(4)<<a[i][j]; cout<<endl; } return 0;}
#include <iostream>using namespace std;void reverse(int a[],int n);int main( ){ int b[10]={1,2,3,4,5,6,7,8,9,10}; int i,s=0; reverse(b,8); for(i=5;i<10;i++) s+=b[i]; cout<<s<<endl; return 0;}void reverse(int a[],int n){ int i,t; for(i=0;i<n/2;i++) { t=a[i]; a[i]=a[n-1-i]; a[n-1-i]=t; }}
#include <iostream>using namespace std;void f(int a[],int i,int j);int main( ){ int b[10]={1,2,3,4,5,6,7,8,9,10}; int i,s=0; f(b,0,9); for(i=5;i<10;i++) s+=b[i]; cout<<s<<endl; return 0;}void f(int a[],int i,int j){ int t; if(i<j) { t=a[i]; a[i]=a[j];a[j]=t; f(a,i+1,j-1); }}
#include <iostream>using namespace std;int f(int n);int main(){ cout<<f(5)<<” “; cout<<f(8)<<endl; return 0; }int f(int n){ static int a=2; int b=0; a+=n; b+=a; return b;}
@ Mayuko
0 0
- 第十四周项目6阅读程序
- 第十四周项目6-阅读程序
- 第十四周项目6-阅读程序(3)
- 第十四周项目六 阅读程序(4、5、6)
- 第十四周项目六 阅读程序(6)
- 第十四周项目六:阅读程序
- 第十四周项目六阅读程序
- 第十四周项目六之阅读程序
- 第十四周项目六 阅读程序 (7)
- 第十四周项目六 阅读程序 (8)
- 第十四周项目六 阅读程序 (9)
- 第十四周项目 阅读程序 1
- 第十四周项目 阅读程序 2
- 第十四周项目 阅读程序 3
- 第十四周项目:阅读程序(一)
- 第十四周项目:程序阅读(二)
- 第十四周项目:程序阅读(三)
- 第十四周阅读程序
- Unity逃离地球学习(酷跑)学习总结
- 3D语音天气球(源码分享)——创建可旋转的3D球
- ajax同步、异步执行简单理解与证明
- NYOJ 60、75、113
- 最短路径算法学习
- 第十四周项目6-阅读程序
- MFC 处理 HTTP 请求的基本方法
- android 自定义View【2】对话框取色&色盘取色的实现
- Cocos2d-x 遮罩的实现 : ClippingNode
- 如何压缩mysql ibdata1文件
- PLA(principal component analysis ) 参考资料
- Servlet生命周期与工作原理
- 有个非计算机专业的问我:怎么学写游戏?
- Android 视频 H.264 编码文章集合