红色蚂蚁 -- The Red Ant
团结就是力量 -- Union Gives Strength

导航

 

2004年10月13日

摘要: //两个int类型的数据,不用任何的判断语句如if、switch、?:等,找出其中的大值#include <stdio.h>/*intmax( int x,int y ){ int buf[2] = { x, y }; unsigned int z; z = x - y; z >>= 31; return buf[z];}*/intmax( int x,int y ){ i... 阅读全文
posted @ 2004-10-13 13:39 红色蚂蚁 阅读(785) 评论(0) 推荐(0)
 
摘要: //返回指定文件系统的大小及空闲大小#include <sys/vfs.h>#define M(x) (x)*(st.f_bsize/1024)intmain( int argc, char *argv[] ){ struct statfs st; char *fs; int r; fs = "/etc/"; if(argc > 1) fs = argv[1]; r = stat... 阅读全文
posted @ 2004-10-13 13:36 红色蚂蚁 阅读(503) 评论(0) 推荐(0)