上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: /*calculate time*/#include <stdio.h>#include <conio.h>#include <time.h>int main(){ /*时间函数举例2 在vc 和win-tc 中结果不同*/ time_t start,end; int i; start=time(NULL); for (i=0;i<30000;i++) printf("\1\1\1\1\1\1\1\1\1\1\n"); end=time(NULL); printf("\1:the different time is %6. 阅读全文
posted @ 2013-03-04 14:39 王井玉 阅读(132) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <conio.h>#include <time.h>int main(){ /*时间函数举1*/ time_t lt; //define a longint time available lt=time(NULL); //system time and date printf(ctime(&lt)); //english format output printf(asctime(localtime(&lt)));//tranfer to tm printf(asctime(gmtime(& 阅读全文
posted @ 2013-03-04 14:14 王井玉 阅读(212) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*打印楼梯同时在楼梯上方打印出两个笑脸*/ int i,j; printf("\1\1\n"); for (i=1;i<11;i++) { for (j=1;j<=i;j++) printf("%c%c",219,219); printf("\n"); } getch(); return 0;} 阅读全文
posted @ 2013-03-04 13:30 王井玉 阅读(792) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*打印出国际象棋棋盘*/ int i,j; for (i=0;i<8;i++) { for (j=0;j<8;j++) { if ((i+j)%2==0) printf("%c",219); else printf(" "); } printf("\n"); } getch(); return 0;} 阅读全文
posted @ 2013-03-04 13:21 王井玉 阅读(246) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*打印9*9乘法口决,i控制行,j控制列*/ int i,j,result; for (i=1;i<10;i++) { for (j=1;j<=i;j++) { result=i*j; printf("%d*%d=%-3d ",j,i,result); } printf("\n"); } getch(); return 0;} 阅读全文
posted @ 2013-03-04 12:33 王井玉 阅读(209) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*很漂亮的案,运行下试试,very beautiful*/ char a=176,b=219; printf("%c%c%c%c%c\n",b,a,a,a,b); printf("%c%c%c%c%c\n",a,b,a,b,a); printf("%c%c%c%c%c\n",a,a,b,a,a); printf("%c%c%c%c%c\n",a,b,a,b,a); printf("%c%c%c%c%c\n",b,a,a,a 阅读全文
posted @ 2013-03-04 12:24 王井玉 阅读(195) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*用*号输出字母C的图案*/ printf("hello C-world\n"); printf(" ****\n"); printf(" **\n"); printf(" **\n"); printf(" ****\n"); getch(); return 0;} 阅读全文
posted @ 2013-03-04 12:09 王井玉 阅读(879) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*输入三个数把这三个数按由小到大的顺序输出*/ int x,y,z,t; scanf("%d %d %d",&x,&y,&z); if (x>y) { t=x; x=y; y=t; } if (x>z) { t=x; x=z; z=t; } if (y>z) { t=y; y=z; z=t; } printf("small to big %d %d %d\n",x,y,z); getch(); return 0;} 阅读全文
posted @ 2013-03-04 11:30 王井玉 阅读(644) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){ /*输入年月日判断这是一年中的第几天.*/ int year,month,day,sum,leap; printf("please input year month day\n"); scanf("%d %d %d",&year,&month,&day); switch(month) { case 1:sum=0;break; case 2:sum=31;break; case 3:sum=59;break; case 4:sum=90;break; case 阅读全文
posted @ 2013-03-04 11:21 王井玉 阅读(1299) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <math.h>int main(){ /*一个整数,加上100后是一个 完全平方数,再加上168后也是 一个完全平方数,求该数是多少*/ long int i,x,y; for (i=1;i<=100000;i++) { x=sqrt(i+100); y=sqrt(i+268); if(x*x==(i+100)&&y*y==(i+268)) printf("\n%d\n",i); } getch(); return 0;} 阅读全文
posted @ 2013-03-04 10:30 王井玉 阅读(514) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页