摘要: 以前的博客是csdn的 http://blog.csdn.net/xtayaitak 阅读全文
posted @ 2010-10-27 01:17 瓜蛋 阅读(185) 评论(0) 推荐(0) 编辑
摘要: /* 789 - seven hundred and eighty nine */ /*思路:这人题思路很简单但是用c++程序实现起来比较繁琐,看了答案才知道 可以把 switch(){case}可以改成数组。哎。效率就是不行呀~! 如 char *a[]={"","one","two".........}*/ #include #include using namespace std;... 阅读全文
posted @ 2010-10-27 01:13 瓜蛋 阅读(280) 评论(0) 推荐(0) 编辑
摘要: /*输入一个自然数,将该自然数的每一位数字反序输出,例如:输入 12345,输出54321*/ #include using namespace std; /* int main() { cout>ch; cout=0;i--) { cout>num; do { digit=num%10; num=num/10; cout0); return 0; ... 阅读全文
posted @ 2010-10-27 01:12 瓜蛋 阅读(1051) 评论(0) 推荐(0) 编辑
摘要: 难点:怎么把行标i 和每行显示的数据的个数联系起来,怎么找出i和j的关系? */ #include using namespace std; int main() { int i,j; for(i=1;i0;j--) cout=1;i--) { for(j=(4-i)*2;j>0;j--) cout<<" "; for(j=1;j<=2*i-1;j++) ... 阅读全文
posted @ 2010-10-27 01:11 瓜蛋 阅读(208) 评论(0) 推荐(0) 编辑
摘要: /*直角三角形三条边满足勾股定律。编写程序,找出三角边长度小于50的所有三角形。*/ /*思路:设三边为a b c 玫举所有小于50的三角形。先测试能不能三角形。然后再测试勾股定律。*/ /*注意:直角三角形三边长3 4 5和4 3 5是同一个三角形。*/ #include using namespace std; int main() { int a,b,c,i=0; int cou... 阅读全文
posted @ 2010-10-27 01:11 瓜蛋 阅读(550) 评论(0) 推荐(0) 编辑
摘要: /*判断是否为回文数 例如:18981 思路:数字当成字符串数组,数组的下标访问每个元素判断是否为回文数。*/ #include using namespace std; int main() { char ch[30]; cout>ch; cout=len-1) cout<<"是回文数"<<endl; else cout<<"不是回文数"<<endl; /*if... 阅读全文
posted @ 2010-10-27 01:10 瓜蛋 阅读(312) 评论(0) 推荐(0) 编辑
摘要: /* 1 空格4次 数字1次 2 2 空格3次 数字2次 3 3 3 空格2次 数字3次 4 4 4 4 5 5 5 5 5 */ #include using namespace std; int const N=5; int main() { for(int i=1;i<=N;i++) { for(int j=1;j<=N-i... 阅读全文
posted @ 2010-10-27 01:10 瓜蛋 阅读(188) 评论(0) 推荐(0) 编辑
摘要: /*输出以下图案 * cout using namespace std; int main() { for(int i=1;i0;i--) { for(int j=1;j<=7-i;j++) cout<<" "; for(j=1;j<=i;j++) cout<<"* "; cout<<endl; } } 阅读全文
posted @ 2010-10-27 01:10 瓜蛋 阅读(161) 评论(0) 推荐(0) 编辑
摘要: /*找出10000以内的同构数 同构数 376*376=141376 思路:1、输入一个数num 先判断是几位数。记住数位length。 2、然后算它(num)的平方, square。 3、取square的后length位的数值temp 4、temp与num相等,则是同构数。 */ #include #include using namespace std; int... 阅读全文
posted @ 2010-10-27 01:09 瓜蛋 阅读(2409) 评论(0) 推荐(0) 编辑
摘要: http://topic.csdn.net/u/20101002/08/1106d03a-dfef-499d-aad9-5d85af21fecb.html?72693 阅读全文
posted @ 2010-10-27 01:08 瓜蛋 阅读(111) 评论(0) 推荐(0) 编辑