Slash

习惯在追逐的过程中不断去完善自己;当你不再去追逐,你自我完善的脚步也就停滞下来了。

导航

随笔分类 -  c/c++

C学习细节
摘要:近来已经重做了几次系统了,原来放在桌面的一些临时帮助性文件几次都面临着没有及时备份而伴随系统一块Format,看来还是放在blog中较为放心! scanf()读取字符时遇到空格,制表位\t,换行符\n时停止读取 strlen()遇到空格符\0停止计算,且计算字符串实际字符长度 getchar()读取输入设备下一个字符 putc... 阅读全文

posted @ 2006-04-15 01:18 Slash 阅读(365) 评论(1) 推荐(0)

(C语言)数组与指针的使用
摘要:1#include 2#define SIZE 5 3void CopybyArray(double ar[],double target[],int); 4void CopybyPoint(double *ar,double *target,int); 5void DisplayNum(double *array,int); 6double MaxNum(double *array,int)... 阅读全文

posted @ 2006-02-27 00:57 Slash 阅读(610) 评论(0) 推荐(0)

(C语言)实现对任意浮点型数据从十进制到二进制的转换
摘要:输入任意字符型数据,并输入小数点保留位数,输出其二进制形式,代码如下: 1#include 2#include 3void printBinaryInt(unsigned long); 4void printBinaryFloat(float,int); 5int main(void) 6{ 7 float num; 8 int len; 9 printf("I... 阅读全文

posted @ 2006-02-26 12:26 Slash 阅读(2989) 评论(0) 推荐(0)

(C语言)较小数据求素数
摘要:1include 2#include 3int main(void) 4{ 5 int p; 6 printf("Input num:"); 7 8 if(scanf("%d",&p)==1) 9 {10 if(p>2)11 {12 for(int i=2;i<=p;i++)13... 阅读全文

posted @ 2006-02-26 02:59 Slash 阅读(590) 评论(1) 推荐(0)

(C语言)二分算法实现简单猜数
摘要:1#include 2int guessnum(int,int); 3char correntchar(void); 4int main(void) 5{ 6 char ch; 7 int min=1;int max=100; 8 int value; 9 printf("Pick a integer form 1 to 100,then I will try to g... 阅读全文

posted @ 2006-02-26 02:53 Slash 阅读(759) 评论(0) 推荐(0)

(C语言)菜单浏览程序中彻底清除缓冲区中的换行符'\n'
摘要:在做一些交互式程序时,用户输入模式有缓冲输入和非缓冲输入两种情况。关于非缓冲输入,它主要体现在如游戏或其它一些使用鼠标操作的软件中,能及时快速响应用户输入。而非缓冲输入则是将用户输入信息暂存在缓冲区中,用户在提交确认之前还能够进行更改,如控制台输入。闲话少说,这次练习是关于 getchar() 与 scanf() 接受字符输入,同时要清除用于确认输入的换行符,虽说代码不多,但要控制... 阅读全文

posted @ 2006-02-26 02:25 Slash 阅读(1355) 评论(0) 推荐(0)