把1函数给您做了一个调整,您看一下,下次写代码还是严谨点,函数声明与函数体的函数名都不一样。
#include <stdlib.h>
#include <stdio.h>
void menu1();
void menu2();
int main()
{
int x;
do
{
system("cls");
printf("\n\n\n\n\n\n\n\n");
printf("\t\t\t\t\t1:顺序表\n");
printf("\t\t\t\t\t2:链表\n");
printf("\t\t\t\t\t3:退出\n");
printf("\n\t\t\t\t\t请输入您的选择(1-3)=:");
re:
scanf("%d",&x);
switch(x)
{
case 1:
menu1();
break;
case 2:
menu2();
break;
case 3:
exit(1);
break;
default:
printf("error Please reput input:");
goto re;
break;
}
}while(1);
return 0;
}
void menu1()
{
int y;
system("cls");
printf("\n\n\n\n\n\n\n\n");
printf("\t\t\t\t\t1:创建顺序线性表\n");
printf("\t\t\t\t\t2:求顺序线性表的长度\n");
printf("\t\t\t\t\t3:按序号取顺序表元素\n");
printf("\t\t\t\t\t4:按值查找顺序表\n");
printf("\t\t\t\t\t5:插入元素\n");
printf("\t\t\t\t\t6:删除元素\n");
printf("\t\t\t\t\t7:输出顺序线性表\n");
printf("\t\t\t\t\t8:返回\n");
do
{
printf("\t\t\t\t\t\t请输入您的选择(1-8)=:");
reTwo:
scanf("%d",&y);
switch(y)
{
case 1:
printf("这里是创建顺序线性表"); break;
case 2:
printf("这里是求顺序线性表的长度");break;
case 3:
printf("这里是按序号取顺序表元素"); break;
case 4:
printf("这里是按值查找顺序表"); break;
case 5:
printf("这里是插入元素"); break;
case 6:
printf("这里是删除元素"); break;
case 7:
printf("这里是输出顺序线性表"); break;
case 8:
return ;
break;
default:
printf("error");
goto reTwo;
break;
}
}while(1);
return ;
}
void menu2()
{
int z;
while(1)
{
system("cls");
printf("\n\n\n\n\n\n\n\n");
printf("\t\t\t\t\t1:创建链式线性表\n");
printf("\t\t\t\t\t2:求链式线性表的长度\n");
printf("\t\t\t\t\t3:按序号取链表元素\n");
printf("\t\t\t\t\t4:按序号取链表元素\n");
printf("\t\t\t\t\t5:插入元素\n");
printf("\t\t\t\t\t6:删除元素\n");
printf("\t\t\t\t\t7:输出链式线性表\n");
printf("\t\t\t\t\t8:返回\n");
printf("\t\t\t\t\t\t请输入您的选择(1-8)=:");
scanf("%d",&z);
}
// if(z==8) break;
switch(z)
{
case 1:printf("这里是创建链式线性表"); break;
case 2:printf("这里是求链式线性表的长度"); break;
case 3:printf("这里是按序号取链表元素"); break;
case 4:printf("这里是按序号取链表元素"); break;
case 5:printf("这里是插入元素"); break;
case 6:printf("这里是删除元素"); break;
case 7:printf("这里是输出链式线性表");break;
default:printf("error"); break;
}
return ;
}
|