上一页 1 ··· 306 307 308 309 310 311 312 313 314 ··· 320 下一页
摘要: /* 3.9 求派的值*/ #include "stdio.h" void main() { int n; double sum=0; for(n=1;n void main() { double i=1, s=1.0, t=1.0; do { t=t*(-1)*((2*i-1)/(2*i+1)); s=s+t; i++; }while (i void... 阅读全文
posted @ 2008-04-19 20:00 emanlee 阅读(4246) 评论(0) 推荐(0) 编辑
摘要: /* 3.6 求3个数中最大值。类似于例 1.2*/ #include void main( ) { int a, b, c, max; printf("\n 请输入3个整数,整数以空格分隔:\n"); scanf("%d%d%d",&a,&b,&c); if(a>b) max=a; else max=b; if(max void ... 阅读全文
posted @ 2008-04-19 19:58 emanlee 阅读(2194) 评论(0) 推荐(0) 编辑
摘要: /* 5.10 编写函数,求Fibonacci数列的第n项 */ #include "stdio.h"int fibonacci(int n); void main(){ int n; printf("求Fibonacci数列的第n项,请输入n\n"); scanf("%d", &n); /* VC6中n要小于 ? */ printf("Fibonacci数列的第%d项为... 阅读全文
posted @ 2008-04-19 19:39 emanlee 阅读(2456) 评论(0) 推荐(0) 编辑
摘要: /* 5.6 编写函数,输出所有水仙花数 */ #include "stdio.h"int isdaffodil( int n ) ; /* isdaffodil函数原型声明 */ void main(){ int i; for( i=100; i999 || n<100) return 0; /* it is not a daffodil */ units=n%10... 阅读全文
posted @ 2008-04-19 18:05 emanlee 阅读(5854) 评论(0) 推荐(0) 编辑
摘要: ★本吧推荐的几个C编译器:http://post.baidu.com/f?kz=2769360 ◆本吧代码格式编辑器:http://post.baidu.com/f?kz=9364381 ◆二进制文件与文本文件的转换:http://post.baidu.com/f?kz=21576218 ◆本吧代码中显示?:http://post.baidu.com/f?kz=50... 阅读全文
posted @ 2008-04-18 23:26 emanlee 阅读(1433) 评论(1) 推荐(0) 编辑
摘要: /* 例 4.19 电文加密,每个字母转换为字母表中循环右移的第三个字母, 解法一 */ #include "stdio.h"void main(){ char s[256]; int i=0; printf("请输入一行字符,之后按回车键\n"); gets(s); while(s[i]!=0) { if(s[i]>=65 && s[i]=88 && s[i]... 阅读全文
posted @ 2008-04-17 16:58 emanlee 阅读(1819) 评论(0) 推荐(0) 编辑
摘要: /* 4.16 5*5矩阵中每行的绝对值最大值,与同行对角线交换*/ #include "stdio.h" #include "math.h"void main(){ int a[5][5]={{1,2,3,4,-5},{3,5,-2,4,2},{4,1,2,3,-2}, {1,3,-2,4,6},{2,2,0,7,4}} ; int i,k,max,s... 阅读全文
posted @ 2008-04-17 16:15 emanlee 阅读(2789) 评论(0) 推荐(0) 编辑
摘要: /* 4.11 fibonacci数列,前15项 1,1,2,3,5,。。。。。*/ #include "stdio.h"void main(){ int f[15]={1,1}, i; for(i=2;i=x) { /* 移动 */ for(k=count;k>i;k--) a[k... 阅读全文
posted @ 2008-04-15 23:06 emanlee 阅读(3361) 评论(0) 推荐(0) 编辑
摘要: /* 3.4 求两点之间的距离,(x1,x2) (y1,y2) 。类似于例3.9 */ #include "stdio.h" #include "math.h" void main() { float x1,y1,x2,y2; double distance; printf("请输入两点(x1,x2) (y1,y2)\n输入示例: 1 1 2 2 即指(1,1)(2,... 阅读全文
posted @ 2008-04-12 22:59 emanlee 阅读(2753) 评论(1) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2008-04-05 11:39 emanlee 阅读(18) 评论(0) 推荐(0) 编辑
上一页 1 ··· 306 307 308 309 310 311 312 313 314 ··· 320 下一页