摘要: 质数就是只能被1和自身整除的数。1是质数。#include using namespace std;const int UP = 100;bool is(int a){ for(int j=2; j<a; j++) { if(a%j == 0) { return false; } }}void main(){ cout<<1<<endl; for(int i=3; i<=UP; i++) { if(is(i)) { cout<<i<<endl; ... 阅读全文
posted @ 2013-10-19 23:04 清凉一夏o0 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题目:看下面的代码,求输出结果。void foo(int n){ if(n>0) { foo(n-1); cout<<n<<endl; foo(n-2); }}void main(){ foo(4);}输出结果:1 2 3 1 4 1 2 阅读全文
posted @ 2013-10-19 11:12 清凉一夏o0 阅读(336) 评论(0) 推荐(0) 编辑