Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define UP 4
- #define DOWN 1
- int choice(void);
- int main()
- {
- int menu_ch = choice();
- printf("youve chosen %d\n",menu_ch);
- return 0;
- }
- int choice(void)
- {
- int res_sc, c ;
- do
- {
- printf("menu 1. 2. 3. 4. \n");
- res_sc = scanf("%d",&c);
- if(!res_sc)//if c is not integer
- {
- c = 1000;
- break;
- }
- }while(c<DOWN || c>UP);
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement