Hello

The program will ask the user to select from the menu options, then call that function.

Can you tell me is there a better way to write this switch statement. My programming does not work well, and l am wondering is there a better way to write this type of program.

One more quick question, what is the keyword that allows you to clear the screen, so when a menu option is selected it will display a new screen.

My code is below

Thanks in advance

VB Code:
  1. #include "stdio.h"
  2. #include "ctype.h"
  3. #include "conio.h"
  4.  
  5. //Function prototypes
  6. void Divide(void);
  7. void Multiply(void);
  8. void Subtrack(void);
  9. void Add(void);
  10.  
  11. void main(void)
  12. {
  13.     int MenuOption = 0;
  14.     char Exit = NULL;
  15.  
  16.     printf("Welcome to Mr Calculator");
  17.     printf("\n[1] Add");
  18.     printf("\n[2] Subtract numbers");
  19.     printf("\n[3] Divide numbers");
  20.     printf("\n[4] Multiply numbers");
  21.     printf("\n[5] Exit from program");
  22.  
  23.     do{
  24.         printf("\nPlease choose a option from the menu: ");
  25.         scanf("%d",&MenuOption);
  26.  
  27.         switch(MenuOption)
  28.         {
  29.             case(1):
  30.                 //Function to add
  31.                 break;
  32.             case(2):
  33.                 //Function to subtract
  34.                 break;
  35.             case(3):
  36.                 //Function to divide
  37.                 break;
  38.             case(4):
  39.                 //Function to multiply
  40.                 break;
  41.             case(5):
  42.                 printf("Are you sure you want to exit this program (y/n): ");
  43.                 Exit = getchar();
  44.                 Exit = toupper(Exit);
  45.             default:
  46.                 printf("Invalid - input, please re-enter");
  47.         }
  48.     }while(MenuOption != 'Y');
  49. }
  50.  
  51. void Add(void)
  52. {
  53.     //Code to go here
  54. }
  55.  
  56. void Subtract(void)
  57. {
  58.     //Code to go here
  59. }
  60.  
  61. void Multiply(void )
  62. {
  63.     //Code to go here
  64. }
  65.  
  66. void divide(void )
  67. {
  68.     //Code to go here
  69. }