freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c程序設(shè)計語言讀書筆記及課后答案-資料下載頁

2025-06-28 10:24本頁面
  

【正文】 while(fgets(lines,MAXLINE,fp) != NULL)40. {41. if(lineno == 1)42. {43. fprintf(stdout,\f)。44. lineno = head(name,++pageno)。45. }46. fputs(lines,stdout)。47. lineno ++。48. if(lineno MAXPAGE MAXTAIL)49. lineno = 1。50. }51. printf(\f)。52. }53. int head(char*name,int pageno)54. {55. int nl=3。56. printf(\n\n)。57. printf(%s\t%d,name,pageno)。58. while(nl++MAXHEAD)59. printf(\n)。60. return nl。61. }第六章(c)1. /*2. Mon Aug 9 16:51:17 CST 2010*/3. include 4. include 5. include 6. include 7. define MAXLEN 1008. define BUFSIZE 1009. struct nlist{10. int lnum。//the line of number11. struct nlist *next。12. }。13. struct tnode{14. struct nlist *lines。15. char *word。16. struct tnode *left。17. struct tnode *right。18. }。19. struct tnode* addtree( struct tnode *, char *,int )。20. void treeprint(struct tnode *)。21. char * mystrdup(char *s)。22. void addin(struct tnode *,int)。23. int mygetword(char *,int )。24. struct tnode* talloc()。25. struct nlist* lalloc()。26. int noiseword(char *)。27. void main()28. {29. struct tnode *root = NULL。30. int nlines = 1。31. char word[MAXLEN]。32. while(mygetword(word,MAXLEN) != EOF)33. {34. if(isalpha(word[0]) amp。amp。 noiseword(word) == 1)35. root = addtree(root,word,nlines)。36. if(word[0] ==39。\n39。)37. nlines++。38. }39. treeprint(root)。40. }41. struct tnode* addtree(struct tnode *p,char *w,int nlines)42. {43. int conp。44. if(p == NULL)45. {46. p = talloc()。 47. pword = mystrdup(w)。//這兒一開始我覺得為什么不直接用w付給pword呢,而要用一個復制函數(shù)呢?后來有些明白,因為pword沒有分配空間,而且每一次調(diào)用pword應該指向不同的位置,不知這樣理解對不對48. plines = lalloc()。 49. plineslnum=nlines。 plinesnext = NULL。 50. pleft = pright = NULL。51. }52. else if((conp=strcmp(pword,w)) == 0)53. addin(p,nlines)。54. else if(conp 0)55. pleft = addtree(pleft,w,nlines)。56. else57. pright = addtree(pright,w,nlines)。58. return p。59. }60. void addin(struct tnode *p, int nlines)61. {62. /* struct tnode *temp。63. templines = plines。64. while(templinesnext !=NULL amp。amp。 templineslnum != nlines)65. templines = templinesnext。66. if(templineslnum != nlines)67. {68. templinesnext = lalloc()。69. templinesnextlnum = nlines。70. templinesnextnext = NULL。71. }*///本段為剛開始的時候自己寫的,只是沒有設(shè)置struct nlist 變量直接用了struct tnode 變量來操作,就是麻煩一點,感覺邏輯上是對的,但是為什么運行時這個地方使得結(jié)果不正確了呢?72. struct nlist *temp。73. temp = plines。74. while(tempnext !=NULL amp。amp。 temp lnum != nlines)75. temp = tempnext。76. if(templnum != nlines)77. {78. tempnext = lalloc()。79. tempnextlnum = nlines。80. tempnextnext = NULL。81. }82. }83. void treeprint(struct tnode *p)84. {85. struct nlist *temp。86. if(p != NULL)87. {88. treeprint(pleft)。89. printf(%s\t,pword)。90. for(temp=plines 。temp != NULL。temp = tempnext)91. printf(%d\t,templnum)。92. printf(\n)。93. treeprint(pright)。94. }95. }96. struct tnode* talloc()97. {98. return (struct tnode *) malloc( sizeof(struct tnode))。99. }100. struct nlist* lalloc()101. {102. return (struct nlist *) malloc (sizeof(struct nlist))。103. }104. int noiseword(char *w)105. {106. static char* word[] = {107. a,108. an,109. and,110. are,111. in,112. is,113. of,114. or,115. that,116. the,117. this,118. to119. }。120. int cond, mid。121. int low=0。122. int high = sizeof(word)/sizeof(word[0])1。123. while(low = high)124. {125. mid = (low + high)/2。126. if((cond =strcmp(w,word[mid]))0)127. low = mid +1。128. else if ( cond 0)129. high = mid 1。130. else 131. return mid。132. }133. return 1。134. }135. char *mystrdup(char *s)136. {137. char *p。138. p=(char *) malloc(strlen(s)+1)。139. if(p != NULL)140. strcpy(p,s)。141. return p。142. }143. int mygetword(char *word,int lim)144. {145. int c,getch()。146. void ungetch(int)。147. char *w = word。148. while(isspace(c=getch()) amp。amp。 c != 39。\n39。)149. 。150. if( c != EOF)151. *w++ = c。152. if( !isalpha(c))153. {154. *w = 39。\039。155. return c。156. }157. for(。lim 0。w++)158. if(!isalnum(*w = getch()))159. {160. ungetch(*w)。161. break。162. }163. *w = 39。\039。164. return word[0]。165. }166. int bufsp = 0。167. char buf[BUFSIZE]。168. int getch()169. {170. return bufsp0?buf[bufsp]:getchar()。171. }172. void ungetch(int c)173. {174. if(bufsp =BUFSIZE)175. printf(error:Buf is overfow\n)。176. else177. buf[bufsp++] = c。178. }Test61(C) Test64(S)1. /*2. Sun Aug 8 23:18:28 CST 2010*/3. include 4. include 5. include 6. include 7. define MAXWORD 5008. define MAXLEN 1009. define BUFSIZE 50010. struct tnode {11. char *word。12. int count。13. struct tnode *left。14. struct tnode *right。15. }。16. struct tnode wnode[MAXWORD]。17. struct tnode *addtree(struct tnode*,char*)。18. int mygetword(char *,int)。19. void treestor(struct tnode*)。20. void myqsort(struct tnode wnode[],int left,int right)。21. struct tnode *talloc(void)。22. char *mystrdup(char*)。23. int bufsp = 0。24. char buf[BUFSIZE]。25. void main()26. {27. struct tnode *root。28. char word[MAXLEN]。29. int i,len=0。30. root = NULL。31. while (mygetword(word,MAXLEN) != EOF)32. {33. if(isalpha(word[0]))34. root = addtree(root,word)。35. len++。36. }37. treestor(root)。38. myqsort(wnode,0,len1)。39. for(i=0。ilen。i++)40. printf(%s\t%d\n,wnode[i].word,wnode[i].count)。41. }42. struct tnode *addtree(struct tnode *p, char *w)43. {44. int cond。45. if(p == NULL) 46. {47. p = talloc()。48. pword = mystrdup(w)。49. pcount = 1。50. pleft=pright = NULL。51. }52. else if((cond=strcmp(pword,w)) == 0)53. pcount++。54. else if(cond 0)
點擊復制文檔內(nèi)容
數(shù)學相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1