一、链表实现增删改查

1、链表定义

 1 #include<stdio.h>
2 #include<string.h>
3 #include<windows.h>
4 #include<stdlib.h>
5 #define maxn 10
6 #define N 100005
7 typedef struct //歌曲信息
8 {
9 char author[20],style[20],name[20],belong[50];
10 int is;
11 } songs;
12 typedef struct Sqlist //曲库链表
13 {
14 songs data;
15 struct Sqlist *next;
16 };
17 typedef struct sang //点歌链表
18 {
19 songs data;
20 struct sang *next;
21 };
22 struct sang *que,*str2,*s2,*s22;
23 struct Sqlist *r,*str1,*s1,*s11;

不要问为什么定义的都是指针类型结构体变量,因为一些变量定义指针类型,一些变量定义结构体类型。写着写着我就搞错了。。。。(是我的问题。。。)

链表最重要就是它不需要一次性定义好多此类型结构体,只需要用到一个开一个空间就可以了

2、初始化

1 int Create()  //为各链表分配空间
2 {
3 r=(struct Sqlist *)malloc(sizeof(struct Sqlist)*1);
4 que=(struct sang *)malloc(sizeof(struct sang)*1);
5 que->next=NULL;
6 r->next=NULL;
7 init();
8 return 1;
9 }

这是两个链表,一个链表头为que、另一个链表头为r

3、增加数据(以链表r来举例子)

 1 void Add()  //增添曲库内歌曲
2 {
3 system("cls");
4 str1=r;
5 while(str1->next!=NULL)
6 {
7 str1=str1->next;
8 }
9 s1=(struct Sqlist *)malloc(sizeof(struct Sqlist)*1);
10 printf("请按顺序输入以下内容\n");
11 printf("歌名:作者:曲风:语种:\n");
12 scanf("%s%s%s%s",s1->data.name,s1->data.author,s1->data.style,s1->data.belong);
13 s1->data.is=0;
14 s1->next=NULL;
15 str1->next=s1;
16 printf("添加成功\n");
17 system("pause");
18 }

这里要注意我们定义的s1是一个结构体指针,那么定义的时候是不会给他分配一个此结构体类型的空间的。换句话说,s1指向的地址是随机的。

所以我们要给s1开一个此结构体类型的空间,把里面放满数据。然后加在链表尾部。

注意:这个过程中链表的头节点r指向的地址可不能变。所以要用一个此结构体类型指针去遍历这个链表(我代码中用的是str1)

4、删除

 1 void Delete()  //删除曲库内歌曲
2 {
3
4 int i,id;
5 system("cls");
6 printf("输入你要删除歌曲的编号\n");
7 scanf("%d",&id);
8 printf("编号:歌名:作者:曲风:语种:\n");
9 str1=r;
10 i=0;
11 while(str1->next!=NULL)
12 {
13
14 if(i==id)
15 {
16 s1=str1->next;
17 printf("%d %s %s %s %s\n",i,s1->data.name,s1->data.author,s1->data.style,s1->data.belong);
18 printf("你确定要删除吗?确定输入1,否则输入0\n");
19 scanf("%d",&id);
20 if(id)
21 {
22 str1->next=s1->next;
23 free(s1);
24 }
25 break;
26 }
27 str1=str1->next;
28 i++;
29 }
30 system("pause");
31 }

删除操作的进行需要找到两个位置

1、要删除节点的上一个节点(代码中这个位置由str1来保存)

2、要删除的这个节点 (代码中这个位置由s1来保存)

然后让  (上一个节点指向下一个节点的指针)  指向   (要删除节点指向下一个节点的指针)

理解一波。。。

5、修改

 1 void Modify()  //修改曲库
2 {
3
4 int i,id;
5 system("cls");
6 printf("输入你要修改歌曲的编号\n");
7 scanf("%d",&id);
8 printf("编号:歌名:作者:曲风:语种:\n");
9 str1=r;
10 i=0;
11 while(str1->next!=NULL)
12 {
13
14 if(i==id)
15 {
16 s1=str1->next;
17 printf("%d %s %s %s %s\n",i,s1->data.name,s1->data.author,s1->data.style,s1->data.belong);
18 printf("你确定要修改吗?确定输入1,否则输入0\n");
19 scanf("%d",&id);
20 if(id)
21 {
22 printf("依次输入歌名:作者:曲风:语种:\n");
23 scanf("%s%s%s%s",&s1->data.name,&s1->data.author,&s1->data.style,s1->data.belong);
24 }
25 break;
26 }
27 str1=str1->next;
28 i++;
29 }
30 system("pause");
31 }

修改就没什么讲的了,和删除操作代码大致上同

6、查

 1 void Show()
2 {
3
4 int i;
5 system("cls");
6 printf("编号:歌名:作者:曲风:语种:\n");
7 str1=r;
8 i=0;
9 while(str1->next!=NULL)
10 {
11 str1=str1->next;
12 printf("%d %s %s %s %s\n",i++,str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
13 }
14
15 system("pause");
16 }

7、文件读写

void init()  //导入文件内容
{
//第一个链表文件读取
int i=0;
char ch;
FILE *fp=NULL;
fp=fopen("songs.txt","a+");
str1=r;
s1=(struct Sqlist *)malloc(sizeof(struct Sqlist)*1);
while(fscanf(fp,"%s%s%s%s",s1->data.name,s1->data.author,s1->data.style,s1->data.belong)!=EOF)
{
s1->data.is=0;
s1->next=NULL;
str1->next=s1;
str1=str1->next;
s1=(struct Sqlist *)malloc(sizeof(struct Sqlist)*1);
}
fclose(fp); //第二个链表文件读取
fp=fopen("sangs.txt","a+");
str2=que;
s2=(struct sang *)malloc(sizeof(struct sang)*1);
while(fscanf(fp,"%s%s%s%s",s2->data.name,s2->data.author,s2->data.style,s2->data.belong)!=EOF)
{
s2->data.is=0;
s2->next=NULL;
str2->next=s2;
str2=str2->next;
s2=(struct sang *)malloc(sizeof(struct sang)*1);
}
fclose(fp);
}
void Quit() //导出数据
{
//第一个链表文件写入
int i;
FILE *fp=NULL;
system("cls");
fp=fopen("songs.txt","w");
str1=r;
while(str1->next!=NULL)
{
str1=str1->next;
fprintf(fp,"%s %s %s %s\n",str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
}
fclose(fp); //第二个链表文件写入
fp=fopen("sangs.txt","w");
str2=que;
while(str2->next!=NULL)
{
str2=str2->next;
fprintf(fp,"%s %s %s %s\n",str2->data.name,str2->data.author,str2->data.style,str2->data.belong);
}
fclose(fp);
printf("文件保存成功,程序运行结束\n");
system("pause");
}

二、C语言编写程序(链表实现)

(1)    录入歌曲语种分类信息,包括:中文,英文,日文,韩文,小语种;
(2)    录入、修改歌曲信息,包括:歌曲编号,歌曲名,演唱者,曲风;删除歌曲;
(3)    可以按歌曲语种分类信息显示歌曲信息。
(4)    可以根据演唱者查询指定演唱者的所有歌曲信息;根据曲风查询指定曲风的所有歌曲信息。
(5)    创建点歌列表。在曲库中按演唱者或曲风进行搜索,若查找成功将此歌曲添加到点歌链表中。
(6)    优先指定歌曲。在点歌列表中选定优先歌曲,将该歌曲移至点歌列表中的指定位置。
(7)    删除点歌列表中歌曲。
4、完成所有功能并能适当添加或完善功能,且理解代码,90分
(界面友好、系统健壮加1~10分不等)

代码:

  1 #include<stdio.h>
2 #include<string.h>
3 #include<windows.h>
4 #include<stdlib.h>
5 #define maxn 10
6 #define N 100005
7 typedef struct //结构体构造歌曲信息
8 {
9 char author[20],style[20],name[20],belong[50];
10 } songs;
11 typedef struct Sqlist //曲库链表
12 {
13 songs data;
14 struct Sqlist *next;
15 };
16 typedef struct sang //点歌链表
17 {
18 songs data;
19 struct sang *next;
20 };
21 struct sang *que,*str2,*s2;
22 struct Sqlist *r,*str1,*s1;//que和r分别表示两个链表的头结点,str用来遍历两个头结点,s用来增加
23 int admin_name[20],admin_password[20],len1; //管理员信息
24 void init()//导入文件的内容
25 {
26 //int i = 0;
27 //char ch;
28 FILE *fp = NULL;
29 fp = fopen("songs.txt","a+");
30 str1 = r;//让str=头结点用来遍历
31 s1 = (struct Sqlist *)malloc(sizeof(struct Sqlist)*1);
32 while(fscanf(fp,"%s%s%s%s",s1->data.name,s1->data.author,s1->data.style,s1->data.belong)!=EOF)
33 {
34 s1->next=NULL;
35 str1->next = s1;
36 str1 = str1->next;
37 s1 = (struct Sqlist *)malloc(sizeof(struct Sqlist)*1);//遍历曲库,并且遍历出一个数据后在开空间
38 }
39 fclose(fp);
40 // fp = fopen("sangs.txt","a+");
41 // str2 = que;
42 // s2 = (struct sang *)malloc(sizeof(struct sang)*1);
43 // while(fscanf(fp,"%s%s%s%s",s2->data.name,s2->data.author,s2->data.style,s2->data.belong)!=EOF)
44 // {
45 // s2->next=NULL;
46 // str2->next = s2;
47 // str2 = str2->next;
48 // s2 = (struct sang *)malloc(sizeof(struct sang)*1);//遍历点歌区的内容
49 // }
50 // fclose(fp);
51 }
52 int space() //为各链表分配空间
53 {
54 r=(struct Sqlist *)malloc(sizeof(struct Sqlist)*1);
55 que=(struct sang *)malloc(sizeof(struct sang)*1);
56 que->next=NULL;
57 r->next=NULL;
58 init();
59 return 1;
60 }
61 void Add() //增添曲库内歌曲
62 {
63 int i;
64 system("cls");
65 str1=r;
66 while(str1->next!=NULL)
67 {
68 str1=str1->next;//让str先成为链表最后一个数据;
69 }
70 s1=(struct Sqlist *)malloc(sizeof(struct Sqlist)*1);
71 printf("输入1继续添加,输入0则返回初始界面\n");
72 scanf("%d",&i);
73 if(i==0)
74 {
75 system("pause");
76 }
77 else
78 {
79 printf("请按顺序输入以下内容\n");
80 printf("歌名:作者:曲风:语种:\n");
81 scanf("%s%s%s%s",s1->data.name,s1->data.author,s1->data.style,s1->data.belong);
82 s1->next=NULL;
83 str1->next=s1;
84 printf("添加成功\n");
85 system("pause");
86 }
87
88 }
89 void Delete()//删除操作对象为曲库
90 {
91 int i,id;
92 system("cls");
93 printf("请输出你要删除的歌曲的编号\n");
94 scanf("%d",&id);
95 printf("编号:歌名:作者:曲风:语种:\n");
96 str1 = r;//遍历查找
97 i = 0;
98 while(str1->next!=NULL)
99 {
100 if(i==id)
101 {
102 s1 = str1->next;
103 printf("%d %s %s %s\n",i,s1->data.name,s1->data.author,s1->data.style,s1->data.belong);
104 printf("你确定要删除吗? 确定删除请输入1,否则请输入0\n");
105 scanf("%d",&id);
106 if(id)
107 {
108 str1->next = s1->next;//直接将要删除的节点的上一个next等于要删除节点的next
109 free(s1);
110 }
111 break;
112 }
113 str1 = str1->next;
114 i++;
115 }
116 system("pause");
117 }
118 void Modify()//修改曲库中数据
119 {
120 int i,id;
121 system("cls");
122 printf("请输入你要修改的编号\n");
123 scanf("%d",&id);
124 printf("编号:歌名:作者:曲风:语种:\n");
125 str1 = r;
126 i = 0;//开始遍历
127 while(str1->next!=NULL)
128 {
129 if(i == id)
130 {
131 s1 = str1->next;
132 printf("%d %s %s %s %s\n",i,s1->data.name,s1->data.author,s1->data.style,s1->data.belong);
133 printf("你确定要修改吗?确定请输入1,取消请输入0\n");
134 scanf("%d",&id);
135 if(id)
136 {
137 printf("请以此输入歌名:作者:曲风:语种:\n");
138 scanf("%s%s%s%s",&s1->data.name,&s1->data.author,&s1->data.style,&s1->data.belong);
139 }
140 break;
141 }
142 str1 = str1->next;
143 i++;
144 }
145 printf("修改成功!");
146 system("pause");
147 }
148 void Select_style()//查找某种曲风的歌曲
149 {
150 int i,m;
151 char s[50];
152 system("cls");
153 printf("输入1继续搜索,输入0则返回初始界面\n");
154 scanf("%d",&m);
155 if(!m)
156 {
157 system("pause");
158 }
159 else{
160 printf("请输入你要查找的曲风\n");
161 scanf("%s",s);
162 printf("编号:歌名:作者:曲风:语种:\n");
163 str1 = r;
164 i = 0;
165 while(str1->next!=NULL)
166 {
167 str1 = str1 ->next;
168 if(strcmp(s,str1->data.style)==0)//比较输入的曲风和该乐曲曲风是否相同
169 {
170 printf("%d %s %s %s %s\n",i,str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
171 }
172 i++;
173 }
174 system("pause");
175 }
176
177 }
178 void Select_name()//根据歌名来进行查找歌曲
179 {
180 int i,m;
181 char s[50];
182 system("cls");
183 printf("输入1继续搜索,输入0则返回初始界面\n");
184 scanf("%d",&m);
185 if(!m)
186 {
187 system("pause");
188 }
189 else
190 {
191 printf("请输入你要查找的歌曲名称\n");
192 scanf("%s",s);
193 printf("编号:歌名:作者:曲风:语种:\n");
194 str1 = r;
195 i = 0;
196 while(str1->next!=NULL)
197 {
198 str1 = str1 ->next;
199 if(strcmp(s,str1->data.name)==0)//比较输入的曲风和该乐曲曲风是否相同
200 {
201 printf("%d %s %s %s %s\n",i,str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
202 }
203 i++;
204 }
205 system("pause");
206 }
207
208 }
209 void Select_author()//根据作者来查找歌曲
210 {
211 int i,m;
212 char s[50];
213 system("cls");
214 printf("输入1继续搜索,输入0则返回初始界面\n");
215 scanf("%d",&m);
216 if(!m)
217 {
218 system("pause");
219 }
220 else
221 {
222 printf("请输入你要查找的作者名字\n");
223 scanf("%s",s);
224 printf("编号:歌名:作者:曲风:语种:\n");
225 str1 = r;
226 i = 0;
227 while(str1->next!=NULL)
228 {
229 str1 = str1 ->next;
230 if(strcmp(s,str1->data.author)==0)//比较输入的曲风和该乐曲曲风是否相同
231 {
232 printf("%d %s %s %s %s\n",i,str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
233 }
234 i++;
235 }
236 system("pause");
237 }
238
239 }
240 void Select_belong()
241 {
242 int i,m;
243 char s[50];
244 system("cls");
245 printf("输入1继续搜索,输入0则返回初始界面\n");
246 scanf("%d",&m);
247 if(!m)
248 {
249 system("pause");
250 }
251 else
252 {
253 printf("请输入你要查找的歌曲语种\n");
254 scanf("%s",s);
255 printf("编号:歌名:作者:曲风:语种:\n");
256 str1 = r;
257 i = 0;
258 while(str1->next!=NULL)
259 {
260 str1 = str1 ->next;
261 if(strcmp(s,str1->data.belong)==0)//比较输入的曲风和该乐曲曲风是否相同
262 {
263 printf("%d %s %s %s %s\n",i,str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
264 }
265 i++;
266 }
267 system("pause");
268 }
269 }
270 void Show()//用来显示曲库中所有的歌曲数据
271 {
272 int i;
273 system("cls");
274 printf("编号:歌名:歌手:曲风:语种: \n");
275 str1 = r;//准备头结点,开始遍历
276 i = 0;//图书编号
277 while(str1->next != NULL)
278 {
279 str1 = str1->next;
280 printf("%d %s %s %s %s\n",i++,str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
281 }
282 system("pause");
283 }
284 void sing_list()
285 {
286 int i;
287 system("cls");
288 printf("编号:歌名:歌手:曲风:语种:\n");
289 str2 = que;
290 i = 0;
291 while(str2->next != NULL)
292 {
293 str2 = str2->next;
294 printf("%d %s %s %s %s\n",i++,str2->data.name,str2->data.author,str2->data.style,str2->data.belong);
295 }
296 system("pause");
297 }
298 void sing()//点歌
299 {
300 //先再曲库中搜索这首歌然后将数据取出来保存在点歌链表的文件夹里
301 int i,id;
302 system("cls");
303 printf("输入你要点歌的歌曲的编号(会移动到点歌列表的表首)\n");
304 scanf("%d",&id);
305 printf("编号:歌名:作者:曲风:语种:\n");
306 str1 = r;
307 i = 0;//循环列表
308 while(str1->next!=NULL)
309 {
310 if(i==id)
311 {
312 s1 = str1->next;
313 printf("%d %s %s %s %s\n",i,s1->data.name,s1->data.author,s1->data.style,s1->data.belong);
314 printf("你确定要点这首歌么?确定请输入1,否则请输入0\n");
315 scanf("%d",&id);
316 if(id)
317 {
318 str2 = que->next;//点歌列表的头结点的next
319 s2 = (struct sang *)malloc(sizeof(struct sang)*1);//分配空间
320 strcpy(s2->data.name,s1->data.name);
321 strcpy(s2->data.author,s1->data.author);
322 strcpy(s2->data.style,s1->data.style);
323 strcpy(s2->data.belong,s1->data.belong);//将搜索到的歌曲的数据复制给s2
324 s2->next = str2;
325 que->next = s2; //将s2放在头结点的后面,即列表首位
326 printf("添加成功\n");
327 }
328 }
329 str1 = str1->next;
330 i++;
331 }
332 system("pause");
333 }
334 void Del()//删除点歌链表中的歌曲
335 {
336 int i,id;
337 system("cls");
338 printf("编号:歌名:作者:曲风:语种: \n");
339 str2 = que;
340 i = 0;//准备遍历
341 while(str2->next!=NULL)
342 {
343 str2 = str2->next;
344 printf("%d %s %s %s %s\n",i++,str2->data.name,str2->data.author,str2->data.style,str2->data.belong);
345 }//输出所有的歌曲
346 printf("请输入你想要删除歌曲的编号,输入-1则退出删除操作\n");
347 scanf("%d",&id);
348 if(id==-1) return ;
349 printf("编号:歌名:作者:曲风:语种:\n");
350 str2 = que;
351 i = 0;
352 while(str2->next!=NULL)
353 {
354 if(i==id)
355 {
356 s2 = str2->next;
357 printf("%d %s %s %s %s\n",i,s2->data.name,s2->data.author,s2->data.style,s2->data.belong);
358 printf("你确定要删除这一首歌嘛?确定请输入1,否则请输入0\n");
359 scanf("%d",&id);
360 if(id)
361 {
362 str2->next = s2->next;//跳过中间这个点
363 free(s2);//清理空间
364 }
365 break;
366 }
367 str2 = str2->next;
368 i++;
369 }
370 system("pause");
371 }
372 void Quit()//导出数据
373 {
374 int i;
375 system("cls");
376 FILE *fp = NULL;
377 fp = fopen("songs.txt","w");
378 str1 = r;
379 while(str1->next!=NULL)
380 {
381 str1 = str1->next;
382 fprintf(fp,"%s %s %s %s\n",str1->data.name,str1->data.author,str1->data.style,str1->data.belong);
383 }//将乐库中的数据写入文件中;
384 fclose(fp);
385 // fp=fopen("sangs.txt","w");
386 // str2=que;
387 // while(str2->next!=NULL)
388 // {
389 // str2=str2->next;
390 // fprintf(fp,"%s %s %s %s\n",str2->data.name,str2->data.author,str2->data.style,str2->data.belong);
391 // }
392 // fclose(fp);
393 printf("文件保存成功,程序运行结束\n");
394 system("pause");
395 }
396 void admin_init()//初始化管理员信息
397 {
398 len1 = 1;
399 admin_name[0] = 123456;
400 admin_password[0] = 123456;
401 }
402 int login()//身份证注册
403 {
404 int i,x,na,pa;
405 system("cls");
406 printf("管理员登陆输出2,输入其他则以普通身份登录\n");
407 scanf("%d",&x);
408 if(x==2)
409 {
410 printf("请输入登录id\n");
411 scanf("%d",&na);
412 for(i =0;i<len1;i++)
413 {
414 if(admin_name[i]==na)
415 {
416 printf("请输入密码\n");
417 scanf("%d",&pa);
418 if(admin_password[i]==pa)
419 {
420 printf("登陆成功!");
421 system("pause");
422 return 2;//2是管理员登陆
423 }
424 else{
425 printf("密码错误\n");
426 system("pause");
427 login();
428 }
429 }
430 else{
431 printf("该用户不存在!\n");
432 system("pause");
433 login();
434 }
435 }
436
437 }
438 printf("登陆成功!\n");
439 return 0;
440 system("pause");//0是普通用户登录
441 }
442 void Menu()
443 {
444 int flag,x,y=space();
445 if(!y) return;
446 admin_init();
447 flag = login();
448 while(1)
449 {
450 system("cls");
451 if(flag==2)//如果是管理员身份
452 {
453 printf ("***********************************************************************************************************************************\n");
454 printf ("***********************************************************************************************************************************\n");
455 printf ("** ktv点歌管理员操作界面 **\n");
456 printf ("***********************************************************************************************************************************\n");
457 printf ("***********************************************************************************************************************************\n");
458 printf ("***********************************************************************************************************************************\n");
459 printf ("***********************************************************************************************************************************\n");
460 printf ("** 丨 丨 **\n");
461 printf ("**********************----------------------------丨[0]查看所有曲库 丨----------------------------********************\n");
462 printf ("** 丨 丨 **\n");
463 printf ("**********************----------------------------丨[1]删除曲库歌曲 丨----------------------------********************\n");
464 printf ("** 丨 丨 **\n");
465 printf ("**********************----------------------------丨[2]修改曲库歌曲 丨----------------------------********************\n");
466 printf ("** 丨 丨 **\n");
467 printf ("**********************----------------------------丨[3]增加曲库歌曲 丨----------------------------********************\n");
468 printf ("** 丨 丨 **\n");
469 printf ("**********************----------------------------丨[4]查找歌曲(歌名) 丨----------------------------********************\n");
470 printf ("** 丨 丨 **\n");
471 printf ("**********************----------------------------丨[5]查找歌曲(演唱者) 丨----------------------------********************\n");
472 printf ("** 丨 丨 **\n");
473 printf ("**********************----------------------------丨[6]查找歌曲(曲风) 丨----------------------------********************\n");
474 printf ("** 丨 丨 **\n");
475 printf ("**********************----------------------------丨[7]查找歌曲(语种) 丨----------------------------********************\n");
476 printf ("** 丨 丨 **\n");
477 printf ("**********************----------------------------丨[8]点歌 丨----------------------------********************\n");
478 printf ("** 丨 丨 **\n");
479 printf ("**********************----------------------------丨[9]删除点歌列表中歌曲 丨----------------------------********************\n");
480 printf ("** 丨 丨 **\n");
481 printf ("**********************----------------------------丨[10]查看点歌列表 丨----------------------------********************\n");
482 printf ("** 丨 丨 **\n");
483 printf ("**********************----------------------------丨[11]结束(将数据保存到文件中) 丨----------------------------********************\n");
484 printf ("** 丨 丨 **\n");
485 printf ("**********************------------------------------------请输入相应数字---------------------------------------********************\n");
486 printf ("***********************************************************************************************************************************\n");
487 printf ("***********************************************************************************************************************************\n");
488 scanf("%d",&x);
489 if(x==0)
490 {
491 Show();
492 }
493 else if(x==1)
494 {
495 Delete();
496 }
497 else if(x==2)
498 {
499 Modify();
500 }
501 else if(x==3)
502 {
503 Add();
504 }
505 else if(x==4)
506 {
507 Select_name();
508 }
509 else if(x==5)
510 {
511 Select_author();
512 }
513 else if(x==6)
514 {
515 Select_style();
516 }
517 else if(x==7)
518 {
519 Select_belong();
520 }
521 else if(x==8)
522 {
523 sing();
524 }
525 else if(x==9)
526 {
527 Del();
528 }
529 else if(x==10)
530 {
531 sing_list();
532 }
533 else if(x==11)
534 {
535 Quit();
536 return;
537 }
538 }
539 else//如果是普通身份用另一个表
540 {
541 printf ("***********************************************************************************************************************************\n");
542 printf ("***********************************************************************************************************************************\n");
543 printf ("** ktv点歌普通用户操作界面 **\n");
544 printf ("***********************************************************************************************************************************\n");
545 printf ("***********************************************************************************************************************************\n");
546 printf ("***********************************************************************************************************************************\n");
547 printf ("***********************************************************************************************************************************\n");
548 printf ("** 丨 丨 **\n");
549 printf ("**********************----------------------------丨[0]查看所有曲库 丨----------------------------********************\n");
550 printf ("** 丨 丨 **\n");
551 printf ("**********************----------------------------丨[1]查找歌曲(歌名) 丨----------------------------********************\n");
552 printf ("** 丨 丨 **\n");
553 printf ("**********************----------------------------丨[2]查找歌曲(演唱者) 丨----------------------------********************\n");
554 printf ("** 丨 丨 **\n");
555 printf ("**********************----------------------------丨[3]查找歌曲(曲风) 丨----------------------------********************\n");
556 printf ("** 丨 丨 **\n");
557 printf ("**********************----------------------------丨[4]查找歌曲(语种) 丨----------------------------********************\n");
558 printf ("** 丨 丨 **\n");
559 printf ("**********************----------------------------丨[5]点歌 丨----------------------------********************\n");
560 printf ("** 丨 丨 **\n");
561 printf ("**********************----------------------------丨[6]删除点歌列表中歌曲 丨----------------------------********************\n");
562 printf ("** 丨 丨 **\n");
563 printf ("**********************----------------------------丨[7]结束 丨----------------------------********************\n");
564 printf ("** 丨 丨 **\n");
565 printf ("**********************------------------------------------请输入相应数字---------------------------------------********************\n");
566 printf ("***********************************************************************************************************************************\n");
567 printf ("***********************************************************************************************************************************\n");
568 scanf("%d",&x);
569 if(x==0)
570 {
571 Show();
572 }
573 else if(x==1)
574 {
575 Select_name();
576 }
577 else if(x==2)
578 {
579 Select_author();
580 }
581 else if(x==3)
582 {
583 Select_style();
584 }
585 else if(x==4)
586 {
587 Select_belong();
588 }
589 else if(x==5)
590 {
591 sing();
592 }
593 else if(x==6)
594 {
595 Del();
596 }
597 else if(x==7)
598 {
599 sing_list();
600 }
601 else if(x==8)
602 {
603 Quit();
604 return;
605 }
606 }
607 }
608 return;
609 }
610 int main()
611 {
612 Menu();
613 return 0;
614 }

c语言实现链表增、删、改、查及文件读写 && 链表实现程序的更多相关文章

  1. iOS sqlite3 的基本使用(增 删 改 查)

    iOS sqlite3 的基本使用(增 删 改 查) 这篇博客不会讲述太多sql语言,目的重在实现sqlite3的一些基本操作. 例:增 删 改 查 如果想了解更多的sql语言可以利用强大的互联网. ...

  2. 好用的SQL TVP~~独家赠送[增-删-改-查]的例子

    以前总是追求新东西,发现基础才是最重要的,今年主要的目标是精通SQL查询和SQL性能优化.  本系列主要是针对T-SQL的总结. [T-SQL基础]01.单表查询-几道sql查询题 [T-SQL基础] ...

  3. iOS FMDB的使用(增,删,改,查,sqlite存取图片)

    iOS FMDB的使用(增,删,改,查,sqlite存取图片) 在上一篇博客我对sqlite的基本使用进行了详细介绍... 但是在实际开发中原生使用的频率是很少的... 这篇博客我将会较全面的介绍FM ...

  4. django ajax增 删 改 查

    具于django ajax实现增 删 改 查功能 代码示例: 代码: urls.py from django.conf.urls import url from django.contrib impo ...

  5. ADO.NET 增 删 改 查

    ADO.NET:(数据访问技术)就是将C#和MSSQL连接起来的一个纽带 可以通过ADO.NET将内存中的临时数据写入到数据库中 也可以将数据库中的数据提取到内存中供程序调用 ADO.NET所有数据访 ...

  6. MVC EF 增 删 改 查

    using System;using System.Collections.Generic;using System.Linq;using System.Web;//using System.Data ...

  7. python基础中的四大天王-增-删-改-查

    列表-list-[] 输入内存储存容器 发生改变通常直接变化,让我们看看下面列子 增---默认在最后添加 #append()--括号中可以是数字,可以是字符串,可以是元祖,可以是集合,可以是字典 #l ...

  8. Go语言之进阶篇mysql增 删 改 查

    一.mysql操作基本语法 1.创建名称nulige的数据库 CREATE DATABASE nulige DEFAULT CHARSET utf8 COLLATE utf8_general_ci; ...

  9. 简单的php数据库操作类代码(增,删,改,查)

    这几天准备重新学习,梳理一下知识体系,同时按照功能模块划分做一些东西.所以.mysql的操作成为第一个要点.我写了一个简单的mysql操作类,实现数据的简单的增删改查功能. 数据库操纵基本流程为: 1 ...

随机推荐

  1. 【Problem】前端项目运行:Module build failed:Error Node Sass does not yet support my current environmen

    我在运行renren-fast-vue前端项目时,安装完依赖cnpm install 启动服务npm run dev 出现问题. Module build failed: Error: Node Sa ...

  2. 【Java】Java注释 - 单行、块、文档注释

    简单记录,Java 核心技术卷I 基础知识(原书第10 版) 注释 我们在编写程序时,经常需要添加一些注释,用来描述某段代码的作用,提高Java源程序代码的可读性,使得Java程序条理清晰. 写代码的 ...

  3. Sentinel上下文创建及执行

    Sentinel上下文创建及执行,入口示例代码: public static void fun() { Entry entry = null; try { entry = SphU.entry(SOU ...

  4. MySQL查询截取分析

    一.查询优化 1,mysql的调优大纲 慢查询的开启并捕获 explain+慢SQL分析 show profile查询SQL在Mysql服务器里面的执行细节和生命周期情况 SQL数据库服务器的参数调优 ...

  5. Java中的NIO进阶

    目录 前言 NIO与多线程 Readable和Writeable的空触发 请求与返回的处理 事件的处理机制 NIO多线程使用的一个例子 前言 之前一篇文章简单介绍了NIO,并附了一个简单的例子,但是自 ...

  6. Python 日志打印之自定义logger handler

    日志打印之自定义logger handler By:授客 QQ:1033553122 #实践环境 WIN 10 Python 3.6.5 #实践代码 handler.py #!/usr/bin/env ...

  7. Socket.IO基础教程

    什么是Socket.IO Socket.IO是一个库,可用于在浏览器和服务器之间进行实时,双向和基于事件的通信.它包括: 使Node.js服务器:来源 | API 为浏览器(可从Node.js的也运行 ...

  8. CSRF Laravel Cross Site Request Forgery protection¶

    Laravel 使得防止应用 遭到跨站请求伪造攻击变得简单. Laravel 自动为每一个被应用管理的有效用户会话生成一个 CSRF "令牌",该令牌用于验证授权用 户和发起请求者 ...

  9. Socket的用法——NIO包下SocketChannel的用法 ———————————————— 版权声明:本文为CSDN博主「茶_小哥」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/ycgslh/article/details/79604074

    服务端代码实现如下,其中包括一个静态内部类Handler来作为处理器,处理不同的操作.注意在遍历选择键集合时,没处理完一个操作,要将该请求在集合中移除./*模拟服务端-nio-Socket实现*/pu ...

  10. Page not found (404) 不被Django的exception中间件捕捉 中间件

    Using the URLconf defined in config.urls, Django tried these URL patterns, in this order: