📄 chooselinklist.cpp
字号:
#include"chainbelth.h"
void Chooselinklist(linklist &l,char cmd)
{
int n,i,e,i1,e1;
do{
switch(cmd)
{
case 'c':
printf("Please input a element indicate the length of the chain belt which you want to create:\n");
printf("Please input the number of the elements:\n");
printf("number=");
scanf("%d",&n);
printf("please input the elements you want to create the chain belt:\n");
Createlist(l,n);
printf("The chain belt is:\n");
printout(l);
printf("\n");
break;
case 'C':
printf("Please input a element indicate the length of the chain belt which you want to create:\n");
printf("Please input the number of the elements:\n");
printf("number=");
scanf("%d",&n);
printf("please input the elements you want to create the chain belt:\n");
Createlist(l,n);
printf("The chain belt is:\n");
printout(l);
printf("\n");
break;
case 'i':
printf("Please input a element which you want to add to the chain belt and the position:");
printf("element=");
scanf("%d",&e);
printf("position=");
scanf("%d",&i);
Insertlist(l,i,e);
printf("The changed chain belt is:\n");
printout(l);
printf("\n");
break;
case 'I':
printf("Please input a element which you want to add to the chain belt and the position:\n");
printf("element=");
scanf("%d",e);
printf("position=");
scanf("%d",i);
Insertlist(l,i,e);
printf("The changed chain belt is:\n");
printout(l);
printf("\n");
break;
case 'd':
printf("Please input a position which you want to delete the element on it:\n");
printf("position=");
scanf("%d",&i1);
Deletelist(l,i1,e1);
printf("The deleted element is:");
printf("%d\n",e1);
printf("The changed chain belt is:\n");
printout(l);
printf("\n");
break;
case 'D':
printf("Please input a position which you want to delete the element on it:\n");
printf("position=");
scanf("%d",&i1);
Deletelist(l,i1,e1);
printf("The deleted element is:");
printf("%d\n",e1);
printf("The changed chain belt is:\n");
printout(l);
printf("\n");
break;
case 'n':
reversion(l);
printf("Now the chain belt is:\n");
printout(l);
printf("\n");
break;
case 'N':
reversion(l);
printf("Now the chain belt is:\n");
printout(l);
printf("\n");
break;
case 'p':
printf("The result is:\n");
printout(l);
printf("\n");
break;
case 'P':
printf("The result is:\n");
printout(l);
printf("\n");
break;
case 'q':
exit(0);
break;
case 'Q':
exit(0);
break;
default:
exit(0);
}
printf("Please choose again:\n");
fflush(stdin);
cmd=getchar();
}while(cmd!='q'&&cmd!='Q');
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -