如题,C语言编程 要求运用函数,希望有大神能够来帮助一下

2025-02-24 04:56:01
推荐回答(1个)
回答1:

#include
void manu(){
system("cls");
printf("======================================\n");
printf(" Please choose one of the following:\n");
printf(" 1) Copy files\n");
printf(" 2)move files\n");
printf(" 3) Remove files\n");
printf(" 4) quit\n");
printf("Enter the number of your choice:\n");
printf("======================================\n");
}
int getv(int xj, int sj){
int v;
do {
manu();
scanf("%d",&v);
if (v>=xj && v<=sj) break;
} while(1);
return v;
}

int main()
{
int x;
x = getv(1,4);
switch(x){
case 1: printf("I will do copy files\n");break;
case 2: printf("I will do move files\n");break;
case 3: printf("I will do erase files\n");break;
case 4: return 0;
}
return 0;
}