自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 1.6 1-13,1-14

1-13pseudocode:read a word , EOF to stopif the word is ' ' or '/t' or '/n'if the pre state is INpush count to a[i]add i oncecount=0if the word is not a ' ' and '/t' and '/n'if the pre state is OUTupdate the state to INadd count onceupdate lasts to state#in

2011-03-28 10:01:00 177

转载 Difference between pointer and array

 Can anybody tell me difference between the bellow statements?char *p = "This is test"; char a[] = "This is test";ANS:When you declare char p[] you are declaring an array of chars (which is accessible to be both read and written), and this array is init

2011-03-24 23:30:00 261

原创 1-5.4Word Counting (1-11 ,1-12)

1-11Ques:How do you test the word count program? What kinds of input are most likely to uncover bugs if there are any?Ans:I use a state "IN" or "OUT" to represent the char receiving now is in a word or not, a count for counting words,and a flag stores last

2011-03-24 20:02:00 287

原创 1-5.3 Line Counting (1-8, 1-9, 1-10)

1-8:Write a program to count blanks, tabs, and newlines#include int main() { int c; int i=j=k=0; while(c=getchar()!=EOF) { if(c==' ')//or if(c==0x20) i++; if(c=='/t') j++; if(c=='/n')

2011-03-21 22:11:00 246

原创 literal constants

字符常量包含一个或多个字符,周围使用单引号围起来,如:‘a’   'xy'    '0'但是也需要注意某些特殊的字符是例外:单引号(‘),反斜线(/),双引号(”)等单引号:    /'   双引号:    /"问号:       /?反斜线:    //“/x”是十六进制的意思,后面跟十六进制的数字字符“/o、/oo、/ooo”(o为任意一个八进制字符),代表八进制的字符

2011-03-21 20:50:00 522

原创 位图算法(编程珠玑例题)

输入:一个最多包含n个正整数的文件,最大不超过一千万,每个数最多只出现一次,数据之间没有明显的关联输出:升序排列的整数列表要求:只有大约1MB的内存可用,磁盘空间充足,运行时间最多不超过1分钟,10秒左右就可以不需要优化分析:1MB的内存只能存储大约250000个int型整数,远远低于1千万的要求,但是每个int型整数有32位,如果用第i位的0,1来表示数据i的存在与否,一千万的整数需要1000 0000/32=312500个整数,他们将占有312500*4=1250000个比特,即大约1.2MB的内存#i

2011-03-15 23:26:00 944 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除