int menu(c){
int choose;
do{
printf("*MENU\n");
printf("*Press 2 to move down\n");
printf("*Press 4 to move left\n");
printf("*Press 6 to move right\n");
printf("*Press 8 to move up\n");
printf("*Press 5 to switch\n");
printf("*Press 0 to quit\n");
printf("Please enter your choose: ");
scanf("%i",&choose);
if(choose==2){

}else if(choose==4){

}else if(choose==6){

}else if(choose==8){

}else if(choose==5){

}else if(choose==0){
printf("Exit the program!");
}else{
printf("Invalid Input!\n\n");
}
}while(choose!=0);
return 0

The coding abobe show my function for my menu. what i want is it will repeat the menu without going to new line in DOS

i don't understand the exact problem.

what i want is it will repeat the menu without going to new line in DOS

Then just remove \n.

I'm going to go out on a limb and guess that what you want is to clear the screen when redrawing the menu. This will keep the menu in the same physical location for each iteration of the loop.

Since you're calling it "DOS" I can only assume you're using Windows, and as much as I abhore system as a security hole, the easiest way to clear the screen is:

int menu()
{
    int choose;

    system("CLS");

    do {
    ...

Don't forget to include <stdlib.h>, that's where system is declared.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.