c语言函数调用自己定义的函数里面加菜单使用自己的函数!
发布网友
发布时间:2022-04-23 18:07
我来回答
共1个回答
热心网友
时间:2022-05-07 16:35
void FunctionChoice()
{
int index = 0, flag = 0;
int x, y, z;
while(flag != 1)
{
system("cls");
printf("------Menu------\n");
printf("0. Exit\n");
printf("1. jiafa\n");
printf("2. jiafa\n");
// more function...
printf("\n\nEnter x and y : ");
scanf("%d %d", &x, &y);
printf("\n\nChoose function : ");
scanf("%d", &index);
switch(index)
{
case 0:
flag = 1;
break;
case 1:
z = jia(x, y);
break;
case 2:
z = jian(x, y);
break;
// more...
}
printf("\n\nz = %d\n\n", z);
getchar();
}
}
追问还是出错