當前位置:首頁 » 編程語言 » c語言函數菜單程序
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言函數菜單程序

發布時間: 2022-07-21 02:31:59

c語言編寫菜單程序

#include<stdio.h>
#include<graphics.h>
#include<conio.h>
void main()
{
char str;
int i,k,choice=1;
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
setbkcolor(2);
settextstyle(3,0,3);
outtextxy(140,120,"A. The Mock Clock.");
outtextxy(140,150,"B. The Digital Clock.");
outtextxy(140,180,"C. Exit.");
setlinestyle(0,0,3);
rectangle(170,115,370,145);

/*按上下鍵選擇所需選項*/
for(i=1;i<=100;i++)
{
str=getch();
if(str==72)
{
--choice;
if(choice==0)choice=3;
}
if(str==80)
{
++choice;
if(choice==4)choice=1;
}

if(str==13)break; /*按回車鍵確認*/

/*畫圖做菜單*/

cleardevice();
switch(choice)
{ case 1: setlinestyle(0,0,3);
rectangle(170,115,400,145);

settextstyle(3,0,3);
outtextxy(140,120,"A. The Mock Clock.");
settextstyle(3,0,3);
outtextxy(140,150,"B. The Digital Clock.");
outtextxy(140,180,"C. Exit.");
break;

case 2: setlinestyle(0,0,3);
rectangle(170,145,400,175);
settextstyle(3,0,3);
outtextxy(140,120,"A. The Mock Clock.");

settextstyle(3,0,3);
outtextxy(140,150,"B. The Digital Clock.");
settextstyle(3,0,3);
outtextxy(140,180,"C. Exit.");

break;

case 3: settextstyle(3,0,3);
outtextxy(140,120,"A. The Mock Clock.");
outtextxy(140,150,"B. The Digital Clock.");
settextstyle(3,0,3);
outtextxy(140,180,"C. Exit.");
setlinestyle(0,0,3);
rectangle(170,175,400,205);
break;

}

}
if(i>=100)exit(0);/*如果按鍵超過100次退出*/

switch(choice)/*這里引用函數,實現所要的功能*/
{
case 1: cleardevice();
setbkcolor(4);
settextstyle(3,0,4);
outtextxy(160,120,"No.1 have not built."); break;
case 2: cleardevice();
setbkcolor(4);
settextstyle(3,0,4);
outtextxy(160,150,"No.2 have not built.");
break;
case 3: exit(0);
}
getch();
closegraph();
}

㈡ 用c語言寫一個簡單的菜單程序,一個主函數至少四個子函數急求!!就像這樣的。

分析:問題庫(QAS)用外部的配置文件保存,每次運行前先載入庫中已經建立的問題。然後再進入操作選擇。完整代碼如下:/*1.暫時不考慮漢字;2.可以用鏈表優化;3.將每一種操作封裝成一個函數;*/#include#include#include#include////////////////////////////////////////////////////////////////////////////字元串最大長度#defineMAX_STR_LEN2048//題庫上限#defineMAX_QAS_LEN1024//配置文件路徑#defineQAS_FILE_PATH"d:\\qasconfig.txt"////////////////////////////////////////////////////////////////////////////問題結點typedefstructtagQASNode{charQuestion[MAX_STR_LEN];charAnswer[MAX_STR_LEN];doubleScore;boolIsAnswered;}QASNode;//問題庫QASNode*g_QASLib[MAX_QAS_LEN];intg_QASIndex=0;////////////////////////////////////////////////////////////////////////////添加boolInsertToLib(char*pQuestion,char*pAnswer,doublescore){if(pQuestion==NULL||strcmp(pQuestion,"")==0||pAnswer==NULL)returnfalse;QASNode*pNewNode=(QASNode*)malloc(sizeof(QASNode));memset(pNewNode,0L,sizeof(QASNode));strcpy_s(pNewNode->Question,pQuestion);strcpy_s(pNewNode->Answer,pAnswer);pNewNode->Score=score;g_QASLib[g_QASIndex++]=pNewNode;returntrue;}//隨機一個不重復的序號intGetQuestionIndex(){intretVal=-1;inttryCnt=0;while(tryCnt++IsAnswered){retVal=randVal;break;}}returnretVal;}//////////////////////////////////////////////////////////////////////////intmain(){//打開配置文件FILE*pStream=NULL;if(fopen_s(&pStream,QAS_FILE_PATH,"a+")!=0){printf_s("Opentheconfigfilefailed.\n");return-1;}//載入已有的QASfseek(pStream,0L,SEEK_END);intfileSize=ftell(pStream);fseek(pStream,0L,SEEK_SET);while(!feof(pStream)&&fileSize){if(g_QASIndexQuestion);printf_s("Inputanswer:");chartempA[MAX_STR_LEN]={0};fflush(stdin);gets_s(tempA,MAX_STR_LEN);if(strcmp(tempA,g_QASLib[currentIndex]->Answer)==0){printf("Right!\n");totalSocore+=g_QASLib[currentIndex]->Score;g_QASLib[currentIndex]->IsAnswered=true;}else{printf("Wrong!\n");}}else{printf("你已經答對了所有的問題!\n");}}break;case2:{if(currentIndex!=-1){printf("Quest:%s\nScore=%.2f\n",g_QASLib[currentIndex]->Question,g_QASLib[currentIndex]->Score);}else{printf("請先選擇\"回答問題\"!\n");}}break;case3:{//一次只添加一個問題if(g_QASIndexQuestion,g_QASLib[i]->Answer,g_QASLib[i]->Score);}}break;default:break;}}printf("\n");return0;}運行起來後先建立問題庫!

㈢ C語言中怎麼編制簡單的菜單,通過菜單選擇能實現程序的各項功能

#include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
using namespace std;
void xuanzepaixu() //選擇排序函數
{
printf("待添加,請按任意鍵繼續...");
getchar();
}
void erfenpaixu() //二分查找函數
{
printf("待添加,請按任意鍵繼續...");
getchar();
}

void menu() //主菜單
{
system("cls"); //清屏
printf("\n\t\t\t 菜單\n");
printf("\t\t\t#***********************#\n");
printf("\t\t\t# 1選擇排序 #\n");
printf("\t\t\t# 2二分查找 #\n");
printf("\t\t\t# 3返回 #\n");
printf("\t\t\t# 4---關閉 #\n");
printf("\t\t\t#***********************#\n");
printf("\t\t\t 請選擇(1-4) =:");
}
void main()
{
char select;
while(1)
{
menu();
system("COLOR 9f");
scanf("%c",&select);
if(select=='3')
break; //返回上級菜單
else
{
getchar(); //讀入回車符
if(!isdigit(select)) //如果不是數字字元
{
printf("\n\7Your select may be wrong, must enter the digit!\n");_getch();
}
else
{

switch (select)
{
case '1': xuanzepaixu();break;
case '2': erfenpaixu();break;
case '4':exit(0); //直接退出
default:
{
printf("\n\7\7Your selected digit may be wrong, select again!\n");
_getch();
break;
}
}
}
}
}

}

㈣ C語言編寫菜單

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
//值傳遞
voidfun1(chara)
{
a='b';
}
//地址傳遞
charfun2(char*a)
{
*a='a';
return*a;
}
//動態分配數組
voidfun3(char*&a)
{
a=(char*)malloc(sizeof(char));
}
charcaidan()
{
charchoose[5];
printf(" *************************************** ");
printf("┌──────┐ ");
printf("│菜單│ ");
printf("__________________________________ ");
printf("│1,按值傳遞| ");
printf("│2,按地址傳遞| ");
printf("│3,動態數組演示| ");
printf("│4,退出| ");
printf("└────────────────┙ ");
printf("************************************** ");
do
{
printf("請輸入您的選擇(1-4):");
scanf("%s",choose);
}while(strcmp(choose,"1")&&strcmp(choose,"2")&&strcmp(choose,"3")&&strcmp(choose,"4"));
//返回選擇的菜單,注意如果輸入太長這里會異常,因為choose[5],只申請了5個位元組。
returnchoose[0];
}
voidmain()
{
//執行菜單的選擇
while(1)
{
switch(caidan())
{
case'1':
{
chara='a';
fun1(a);
//按值傳遞內容不變
break;
}
case'2':
{
charb='b';
chara=fun2(&b);
//按地址傳遞內容會變
break;
}
case'3':
{
char*p=NULL;
fun3(p);
//動態數組分配成功
break;
}
case'4':exit(0);
}
}

}

㈤ C語言菜單程序編寫

#include
<stdio.h>
#include
<math.h>
void
armstrong(int
a)
{
int
i;
int
n
=
1;
int
b
=
a;
int
s
=
0;
while(b
/=
10)
n++;
b
=
a;
for(i
=
0;
i
<
n;
i
++){
s
+=
(int)pow(b%10,
n);
b
/=
10;
}
if(s
==
a){
printf("%d
是水仙花數!\n",
a);
}else{
printf("%d
不是水仙花數!\n",
a);
}
}
void
prime(int
a)
{
int
i;
if(a
<
2)
{
printf("%d
不是素數!\n",
a);
return
;
}
for(i
=
2;
i
<
a;
i
++){
if(a
%
i
==
0)
{
printf("%d
不是素數!\n",
a);
return
;
}
}
printf("%d
是素數!\n",
a);
}
void
max(int
a,
int
b,
int
c)
{
if(b
>
a)
a
=
b;
if(c
>
a)
a
=
c;
printf("最大值是:%d\n",
a);
}
void
factorial(int
a)
{
int
i;
int
f
=
1;
for(i
=
a;
i
>1;
i
--)
f
*=
i;
printf("%d
的階乘是:%d\n",
a,
f);
}
int
main(int
argc,
char
**argv)
{
int
a,
b,
c;
int
type
;
int
run
=
1;
printf("本程序可完成某些數學計算:\n");
printf(
"***********************************\n"
"*
1.判斷一個數是否為水仙花數。
*\n"
"*
2.判斷一個數是否為素數。
*\n"
"*
3.求三個數的最大值。
*\n"
"*
4.求一個數的階乘。
*\n"
"*
0.退出。
*\n"
"***********************************\n");
do{
printf("請按菜單進行選擇(0-4):");
scanf("%d",
&type);
switch(type){
case
0:
while(1){
getchar();
printf("你確定退出嗎?(y/n)");
a
=
getchar();
switch(a){
case
'y':
run
=
0;
break;
case
'n':
run
=
1;
break;
default:
break;
}
if((a
==
'y')
||
(a
==
'n'))
break;
}
break;
case
1:
printf("請輸入一個數:");
scanf("%d",
&a);
armstrong(a);
break;
case
2:
printf("請輸入一個數:");
scanf("%d",
&a);
prime(a);
break;
case
3:
printf("請輸入三個數:");
scanf("%d%d%d",
&a,
&b,
&c);
max(a,
b,
c);
break;
case
4:
printf("請輸入一個數:
");
scanf("%d",
&a);
factorial(a);
break;
default:
break;
}
}while(run);
return
0;
}

㈥ C語言菜單選項程序

改一下試試:

int main(){
void (void);
void han(void);
void shu(void);
void fen(int x);
void xun(int x);
char chose,s[20];
int n;
for(;;){
printf("1:分支程序 2:循環程序 3:函數程序 4:數組程序 5:指針程序 0:退出 選擇數字:");
scanf("%s",s); chose=s[0];
switch(chose){
case'1':printf("這是個銷售量與其相應等級的分支程序,請輸入相應銷售量! ");
scanf("%d",&n);
fen(n);
break;
case'2':printf("這是個求0——n累加之和的循環結構,輸入n,下面為其值! ");
scanf("%d",&n);
xun(n);
break;
case'3':printf("這是一個求最大公約數的函數程序,請輸入兩個數的值! ");
han();
break;
case'4':printf("這是一個數組逆行排序的數組程序,請輸入10個整數! ");
shu();
break;
case'5':printf("這是一個用指針求一個三個數的數組和的指針程序,請輸入這三個數! ");
();
break;
case'0':exit(1);
default:break;
}
}
return 0;
}

㈦ 求一個C語言菜單函數的程序

1、對於窗口組件菜單,需要根據不同平台,通過圖形編程介面,進行菜單的編制。

常式:

#include<stdio.h>
#include<graphics.h>
#include<conio.h>
voidmain()
{
charstr;
inti,k,choice=1;
intgd=DETECT,gm;
initgraph(&gd,&gm,"");
setbkcolor(2);
settextstyle(3,0,3);
outtextxy(140,120,"A.TheMockClock.");
outtextxy(140,150,"B.TheDigitalClock.");
outtextxy(140,180,"C.Exit.");
setlinestyle(0,0,3);
rectangle(170,115,370,145);
/*按上下鍵選擇所需選項*/
for(i=1;i<=100;i++)
{
str=getch();
if(str==72)
{
--choice;
if(choice==0)choice=3;
}
if(str==80)
{
++choice;
if(choice==4)choice=1;
}
if(str==13)break;/*按回車鍵確認*/
/*畫圖做菜單*/
cleardevice();
switch(choice)
{case1:setlinestyle(0,0,3);
rectangle(170,115,400,145);
settextstyle(3,0,3);
outtextxy(140,120,"A.TheMockClock.");
settextstyle(3,0,3);
outtextxy(140,150,"B.TheDigitalClock.");
outtextxy(140,180,"C.Exit.");
break;
case2:setlinestyle(0,0,3);
rectangle(170,145,400,175);
settextstyle(3,0,3);
outtextxy(140,120,"A.TheMockClock.");
settextstyle(3,0,3);
outtextxy(140,150,"B.TheDigitalClock.");
settextstyle(3,0,3);
outtextxy(140,180,"C.Exit.");
break;
case3:settextstyle(3,0,3);
outtextxy(140,120,"A.TheMockClock.");
outtextxy(140,150,"B.TheDigitalClock.");
settextstyle(3,0,3);
outtextxy(140,180,"C.Exit.");
setlinestyle(0,0,3);
rectangle(170,175,400,205);
break;
}
}
if(i>=100)exit(0);/*如果按鍵超過100次退出*/
switch(choice)/*這里引用函數,實現所要的功能*/
{
case1:cleardevice();
setbkcolor(4);
settextstyle(3,0,4);
outtextxy(160,120,"No.1havenotbuilt.");break;
case2:cleardevice();
setbkcolor(4);
settextstyle(3,0,4);
outtextxy(160,150,"No.2havenotbuilt.");
break;
case3:exit(0);
}
getch();
closegraph();
}


2、對於命令行菜單,直接通過不斷刷新輸出來模擬菜單行為。

常式:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
intn,t,k;
intm;
chars1[20],s2[20],c;
char**l;
char*num[]={"one","two","three","four","five","six","seven","eight","nine","ten"};
voidmenu()
{
printf(" ******************************************************* ");
printf(" **1.查找字元串S1中S2出現的次數** ");
printf(" **2.統計字元串中大小寫字母,數字出現的次數** ");
printf(" **3.將數字翻譯成英語** ");
printf(" **4.結束** ");
printf(" ******************************************************* ");
printf(" 您的輸入:");
fflush(stdin);
scanf("%d",&n);
}
voidcheck()
{

chara[20],b[20];
intj=0,k,m,l=0;
intt=0,n=0;
printf("請輸入主字元串: ");
scanf("%s",a);
k=strlen(a);
printf("請輸入子字元串: ");
scanf("%s",b);
m=strlen(b);
for(n=0;n<k;n++)
if(a[n]==b[0])
{
j++;/*記錄相同的字元數*/
do
{
if(a[++n]==b[++t])
{
j++;
if(j==m)
{
l++;/*子字元串相同數*/
j=0;/*判斷後相同字元數歸零*/
t=-1;/*判斷中if中++t;t將會歸零*/
}
}
else
{
j=0;
t=0;
break;/*如果不同跳出while循環讓for使n+1繼續判斷*/
}
}while(a[n]!='');/*查找完字元數組a結束*/
}
printf("子字元串出現次數: %d ",l);
}
voidcout()
{
intn=0,t=0,k=0;
printf("請輸入一個字元串: ");
fflush(stdin);/*清除緩沖*/
while((c=getchar())!=' ')
{
if(c>='a'&&c<='z')
n++;
if(c>='A'&&c<='Z')
t++;
if(c>='0'&&c<='9')
k++;
}
printf("有大寫字母: %d ",t);
printf("有小寫字母: %d ",n);
printf("有數字: %d ",k);
}
voidnumber()
{
l=num;
printf("請輸入一個數字:(0-10) ");
fflush(stdin);
scanf("%d",&m);
printf("%d對應的英文是: %s ",m,*(l+m-1));
}
voidmain()
{
while(1)
{
system("cls");
menu();
switch(n)
{
case1:system("cls");check();system("pause");break;
case2:system("cls");cout();system("pause");break;
case3:system("cls");number();system("pause");break;
case4:system("cls");break;
default:system("cls");break;
}
if(n==4)break;
}
printf("感謝使用 ");
}

㈧ 用c語言製作一個簡單的菜單程序,一個主函數四個子函數

給你一個簡單的菜單程序吧。其中的子函數,填充成樓主所需即可。
#include
/*子函數1*/
fun1() {
printf ("子函數1\n");
}
/*子函數2*/
fun2() {
printf ("子函數2\n");
}
/*子函數3*/
fun3() {
printf ("子函數3\n");
}
/*子函數4*/
fun4() {
printf ("子函數4\n");
}
int main(void) {
int key; /*命令編號*/
do {
system("cls"); /*清屏*/
/*列印菜單*/
printf ("======================================================\n");
printf (" #\t功能詳情\n");
printf ("------------------------------------------------------\n");
printf (" 1\t功能1\n");
printf (" 2\t功能2\n");
printf (" 3\t功能3\n");
printf (" 4\t功能4\n");
printf (" 5\t退出\n");
printf ("======================================================\n");
printf ("\n");
printf("請輸入命令編號以開啟操作:");
/*輸入命令編號*/
scanf("%d",&key);
printf ("\n");
/*switch函數實現輸入功能序號執行相應函數*/
switch (key) {
case 1: fun1(); break; /*子函數1*/

case 2: fun2(); break; /*子函數2*/

case 3: fun3(); break; /*子函數3*/

case 4: fun4(); break; /*子函數4*/

case 5: printf("程序結束!按任意鍵退出...\n\n"); break;

default:printf("輸入錯誤,請重新輸入!\n\n"); break;
}
/*屏幕暫留*/
if (key!=5) {
printf ("\n");
printf("按Enter鍵繼續...\n");
printf ("\n");
fflush(stdin);
getch ();
}
} while (key!=5);
/*屏幕暫留*/
fflush(stdin);
getch ();
return 0;
}運行結果

㈨ 用C語言製作一個簡單實用菜單的程序。

#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<ctype.h>
usingnamespacestd;
voidxuanzepaixu()//選擇排序函數
{
printf("待添加,請按任意鍵繼續...");
getchar();
}
voiderfenpaixu()//二分查找函數
{
printf("待添加,請按任意鍵繼續...");
getchar();
}

voidmenu()//主菜單
{
system("cls");//清屏
printf(" 菜單 ");
printf(" #***********************# ");
printf(" #1選擇排序# ");
printf(" #2二分查找# ");
printf(" #3返回# ");
printf(" #4---關閉# ");
printf(" #***********************# ");
printf(" 請選擇(1-4)=:");
}
voidmain()
{
charselect;
while(1)
{
menu();
system("COLOR9f");
scanf("%c",&select);
if(select=='3')
break;//返回上級菜單
else
{
getchar();//讀入回車符
if(!isdigit(select))//如果不是數字字元
{
printf(" 7Yourselectmaybewrong,mustenterthedigit! ");_getch();
}
else
{

switch(select)
{
case'1':xuanzepaixu();break;
case'2':erfenpaixu();break;
case'4':exit(0);//直接退出
default:
{
printf(" 77Yourselecteddigitmaybewrong,selectagain! ");
_getch();
break;
}
}
}
}
}

}

㈩ 怎樣用C語言編寫菜單

  1. 對於窗口組件菜單,需要根據不同平台,通過圖形編程介面,進行菜單的編制。

    常式:

    #include<stdio.h>
    #include<graphics.h>
    #include<conio.h>
    voidmain()
    {
    charstr;
    inti,k,choice=1;
    intgd=DETECT,gm;
    initgraph(&gd,&gm,"");
    setbkcolor(2);
    settextstyle(3,0,3);
    outtextxy(140,120,"A.TheMockClock.");
    outtextxy(140,150,"B.TheDigitalClock.");
    outtextxy(140,180,"C.Exit.");
    setlinestyle(0,0,3);
    rectangle(170,115,370,145);
    /*按上下鍵選擇所需選項*/
    for(i=1;i<=100;i++)
    {
    str=getch();
    if(str==72)
    {
    --choice;
    if(choice==0)choice=3;
    }
    if(str==80)
    {
    ++choice;
    if(choice==4)choice=1;
    }
    if(str==13)break;/*按回車鍵確認*/
    /*畫圖做菜單*/
    cleardevice();
    switch(choice)
    {case1:setlinestyle(0,0,3);
    rectangle(170,115,400,145);
    settextstyle(3,0,3);
    outtextxy(140,120,"A.TheMockClock.");
    settextstyle(3,0,3);
    outtextxy(140,150,"B.TheDigitalClock.");
    outtextxy(140,180,"C.Exit.");
    break;
    case2:setlinestyle(0,0,3);
    rectangle(170,145,400,175);
    settextstyle(3,0,3);
    outtextxy(140,120,"A.TheMockClock.");
    settextstyle(3,0,3);
    outtextxy(140,150,"B.TheDigitalClock.");
    settextstyle(3,0,3);
    outtextxy(140,180,"C.Exit.");
    break;
    case3:settextstyle(3,0,3);
    outtextxy(140,120,"A.TheMockClock.");
    outtextxy(140,150,"B.TheDigitalClock.");
    settextstyle(3,0,3);
    outtextxy(140,180,"C.Exit.");
    setlinestyle(0,0,3);
    rectangle(170,175,400,205);
    break;
    }
    }
    if(i>=100)exit(0);/*如果按鍵超過100次退出*/
    switch(choice)/*這里引用函數,實現所要的功能*/
    {
    case1:cleardevice();
    setbkcolor(4);
    settextstyle(3,0,4);
    outtextxy(160,120,"No.1havenotbuilt.");break;
    case2:cleardevice();
    setbkcolor(4);
    settextstyle(3,0,4);
    outtextxy(160,150,"No.2havenotbuilt.");
    break;
    case3:exit(0);
    }
    getch();
    closegraph();
    }
  2. 對於命令行菜單,直接通過不斷刷新輸出來模擬菜單行為。

    常式:

    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    intn,t,k;
    intm;
    chars1[20],s2[20],c;
    char**l;
    char*num[]={"one","two","three","four","five","six","seven","eight","nine","ten"};
    voidmenu()
    {
    printf(" ******************************************************* ");
    printf(" **1.查找字元串S1中S2出現的次數** ");
    printf(" **2.統計字元串中大小寫字母,數字出現的次數** ");
    printf(" **3.將數字翻譯成英語** ");
    printf(" **4.結束** ");
    printf(" ******************************************************* ");
    printf(" 您的輸入:");
    fflush(stdin);
    scanf("%d",&n);
    }
    voidcheck()
    {

    chara[20],b[20];
    intj=0,k,m,l=0;
    intt=0,n=0;
    printf("請輸入主字元串: ");
    scanf("%s",a);
    k=strlen(a);
    printf("請輸入子字元串: ");
    scanf("%s",b);
    m=strlen(b);
    for(n=0;n<k;n++)
    if(a[n]==b[0])
    {
    j++;/*記錄相同的字元數*/
    do
    {
    if(a[++n]==b[++t])
    {
    j++;
    if(j==m)
    {
    l++;/*子字元串相同數*/
    j=0;/*判斷後相同字元數歸零*/
    t=-1;/*判斷中if中++t;t將會歸零*/
    }
    }
    else
    {
    j=0;
    t=0;
    break;/*如果不同跳出while循環讓for使n+1繼續判斷*/
    }
    }while(a[n]!='');/*查找完字元數組a結束*/
    }
    printf("子字元串出現次數: %d ",l);
    }
    voidcout()
    {
    intn=0,t=0,k=0;
    printf("請輸入一個字元串: ");
    fflush(stdin);/*清除緩沖*/
    while((c=getchar())!=' ')
    {
    if(c>='a'&&c<='z')
    n++;
    if(c>='A'&&c<='Z')
    t++;
    if(c>='0'&&c<='9')
    k++;
    }
    printf("有大寫字母: %d ",t);
    printf("有小寫字母: %d ",n);
    printf("有數字: %d ",k);
    }
    voidnumber()
    {
    l=num;
    printf("請輸入一個數字:(0-10) ");
    fflush(stdin);
    scanf("%d",&m);
    printf("%d對應的英文是: %s ",m,*(l+m-1));
    }
    voidmain()
    {
    while(1)
    {
    system("cls");
    menu();
    switch(n)
    {
    case1:system("cls");check();system("pause");break;
    case2:system("cls");cout();system("pause");break;
    case3:system("cls");number();system("pause");break;
    case4:system("cls");break;
    default:system("cls");break;
    }
    if(n==4)break;
    }
    printf("感謝使用 ");
    }