c 语言线性链表,c语言线性链表(C language linear list).doc

c语言线性链表(C language linear list)

c语言线性链表(C language linear list)

# stdio.h > in <

# stdlib.h > in <

# string.h > in <

# define max _ length 35

typedef struct

{

char nb [15];

char name [15];

int c1, c2, c3;

} element;

element with _ (max length);

int n;

int sd ();

int inser _ sheet (int i, element with []);

int delete (int i, _ sheet element with []);

void print _ sheet element with a [], int n);

int locate _ sheet element with a [], int n, char x, []);

int chang _ sheet (int i, element with []);

er (void);

void main ()

{er ();

print _ leaf (s, n);

sd (a);

printf ("\ n% d", getchar ());

while (getchar () = = '')

{sd ();

getchar ();

}

}

int inser _ sheet (int i, element with [])

{

int j;

if (n = = max _ length) | | (< 1) | | (i > n + 1)) return (0);

for (j = n; j > = i; j -) with [j + 1] = s [j].

printf ("input data for inserting (nb name c1 c2 c3) \ n - >");

while (! (scanf ("% s% s% d% d% d", [even].nb, [even].name, & [i].c1, & [i].c2, & [i].c3)) & & scanf ("% s"))

printf ('\ t \ t - > - < 数据错误 ");

n + +; return (1);

}

int delete (int i, _ sheet element with [])

{

int j;

if ((< 1) | | (i > n) return (0);

for (j = i + 1; j < = n; j + +)

{

strcpy ([j - 1).nb with [j].nb); strcpy ([- 1].name with [j].name);

with [j - 1).c1 = s [j].c1; (j - 1).c2 = s [j].c2; (j - 1).c3 = s [j].c3;

}

n -; return (1);

}

void print _ sheet element with a [], int n)

{

int i;

if (n > max _ length) return;

printf ("well." tnb \ t \ tname \ t \ tc1 \ tc2 \ tc3 \ t ");

printf ("------------------------------------------------------------------------- \ n");

for (i = 1; i < = n; i + +)

printf ("%.2d \ t% \ t% \ t \ t% d% d \ t \ t% d \ t", i, [even].nb, [and].name, [even].c1, [even].c2, [even].c3);

}

int locate _ sheet element with a [], int n, char x [])

{

int i;

for (i = 1; i < = n; i + +) if (! strcmp (s [i].nb, x)) return (i);

return (0);

}

int chang _ sheet (int i, element with [])

{

if ((< 1) | | (i > max _ length + 1)) return (0);

printf ("input data for updating: \ n - >");

if (! scanf ("% s% s% d% d% d", [even].nb, [ev

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值