#include <stdio.h>
#include <stdlib.h>
main()
{
char n,ok;
ok='n';
while(ok=='n')
{
puts("Menu\n");
puts("1. Create a directory\n");
puts("2. delete a directory\n");
puts("3. Show a directory\n");
puts("4. Exit\n");
puts(" Your choice: \n");
n=getchar();
switch (n)
{
case '1' : puts ("you entered 1");
break;
case '2' : puts("you entered 2");
break;
case '3' : puts("you entered 3");
break;
case '4' : puts("you entered 4");
break;
default : puts("Enter a valid number\n");
ok='n';
}
}
}
更新1:
The switch function is not working !