From 88ef70152e4d525235e398562a84e97d0e9c94c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=B8=96=E6=B3=A2?= <2783626707@qq.com> Date: Sun, 5 Nov 2023 08:56:51 +0800 Subject: [PATCH] fix:menu,feat:main function --- main.c | 17 +++++++++++++++++ menuoutput.c | 21 ++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 main.c diff --git a/main.c b/main.c new file mode 100644 index 0000000..288d6f5 --- /dev/null +++ b/main.c @@ -0,0 +1,17 @@ +#include "mysyslib.h" + +int main(){ + char ipt; + while(1){ + ipt = mainMenu(); + if(ipt=='i'){ + }else if(ipt=='o'){ + }else if(ipt=='m'){ + }else if(ipt=='q'){ + break; + }else{ + continue; + } + } + return 0; +} diff --git a/menuoutput.c b/menuoutput.c index be2b293..af044d8 100644 --- a/menuoutput.c +++ b/menuoutput.c @@ -10,10 +10,21 @@ char mainMenu() { } char ipt; scanf("%c",&ipt); + switch(ipt){ + case 'i': + printf("You are trying to Input info\n"); + break; + case 'o': + printf("You are trying to Output info\n"); + break; + case 'm': + printf("You are trying to Make things ordered\n"); + break; + case 'q': + printf("You are about to Quit\n"); + break; + default: + printf("Wrong input\n"); + } return ipt; } - -int main(){ - mainMenu(); - return 0; -}