湖濱散記部落格的樹心幽徑[login][主頁]
547:20191210用DEV-C++設計單向鏈結串列(LinkList)

(1)code:LinkList.cpp

 #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct iRec
{
  char ln[80];
  iRec *next;
} MR;
MR root;
MR *p;
int main(){
  FILE *infile;
  infile = fopen("ansiBoshiamy.cin", "r");
  int c=0;
  while (!feof(infile)) {
      char lns[80];
      fgets (lns , 80 , infile);
      lns[strlen(lns ) - 1] = 0;
    
      p=(MR *)malloc(sizeof(iRec));
      strcpy(p->ln,lns);
      p->next=root.next;
      root.next=p;
      c=c+1;
      if( c >50) break;
   }
  fclose(infile);
  printf("自檔案讀取 %d 行文字\n",c);
 
  MR *cur;
  cur=root.next;
  while(cur!=NULL){
      printf("%d : %s\n",c,cur->ln);
      c=c-1;
      cur=cur->next;
  }
 
  return 0;
}

 

(2)執行結果

自檔案讀取 51 行文字
51 : ,dl 陸
50 : ,dk 玖
49 : ,dj 拾
48 : ,dg 仟
47 : ,df 肆
46 : ,de 壹
45 : ,dc 柒
44 : ,db 捌
43 : %chardef begin
42 : %keyname end
41 : z Z
40 : y Y
39 : x X
38 : w W
37 : v V
36 : u U
35 : t T
34 : s S
33 : r R
32 : q Q
31 : p P
30 : o O
29 : n N
28 : m M
27 : l L
26 : k K
25 : j J
24 : i I
23 : h H
22 : g G
21 : f F
20 : e E
19 : d D
18 : c C
17 : b B
16 : a A
15 : ] 」
14 : [ 「
13 : ; ;
12 : . 。
11 : , ,
10 : ' 、
9 : %keyname begin
8 : %selkey 1234567890
7 : %cname 無蝦米輸入法
6 : %ename Boshiamy
5 : %gen_inp
4 : # 更新日期:2016.07.31
3 : # 支援字數:Unicode 1.0 CJK 字元集全部 20,902 個漢字
2 : # 碼表來源:蝦米族樂園
1 : # 碼表名稱:無蝦米輸入法



select id,article_id,topic,text from lt_articles_text where article_id =547; ok. update lt_articles set num_reads=num_reads +1 where id=547; ok.