内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

c語(yǔ)言菜單函數(shù) c語(yǔ)言程序菜單

求一個(gè)C語(yǔ)言菜單函數(shù)的程序?

1、對(duì)于窗口組件菜單,需要根據(jù)不同平臺(tái),通過(guò)圖形編程接口,進(jìn)行菜單的編制。

成都創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿(mǎn)足客戶(hù)于互聯(lián)網(wǎng)時(shí)代的大悟網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

例程:

#includestdio.h?

#includegraphics.h?

#includeconio.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);?

/*按上下鍵選擇所需選項(xiàng)*/?

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;?/*按回車(chē)鍵確認(rèn)*/?

/*畫(huà)圖做菜單*/?

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);/*如果按鍵超過(guò)100次退出*/?

switch(choice)/*這里引用函數(shù),實(shí)現(xiàn)所要的功能*/?

{?

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();?

}

2、對(duì)于命令行菜單,直接通過(guò)不斷刷新輸出來(lái)模擬菜單行為。

例程:

#include?stdio.h

#include?stdlib.h?

#include?string.h

int?n,t,k;

int?m;

char?s1[20],s2[20],c;

char?**l;

char?*num[]={"one","two","three","four","five","six","seven","eight","nine","ten"};

void?menu()

{

printf("\n\n\t\t*******************************************************\n");

printf("\t\t**???1.查找字符串S1中S2出現(xiàn)的次數(shù)????????????????????**\n");

printf("\t\t**???2.統(tǒng)計(jì)字符串中大小寫(xiě)字母,數(shù)字出現(xiàn)的次數(shù)????????**\n");

printf("\t\t**???3.將數(shù)字翻譯成英語(yǔ)??????????????????????????????**\n");

printf("\t\t**???4.結(jié)束??????????????????????????????????????????**\n");

printf("\t\t*******************************************************\n");

printf("\t\t?????您的輸入:");

fflush(stdin);

scanf("%d",n);

}

void?check()

{

char?a[20],b[20];

int?j=0,k,m,l=0;

int?t=0,n=0;

printf("請(qǐng)輸入主字符串:\n");

scanf("%s",a);

k=strlen(a);

printf("請(qǐng)輸入子字符串:\n");

scanf("%s",b);

m=strlen(b);

for(n=0;nk;n++)

if(a[n]==b[0])

{

j++;?/*記錄相同的字符數(shù)*/

do

{????

if(a[++n]==b[++t])

{?

j++;

if(j==m)?

{

l++;/*子字符串相同數(shù)*/

j=0;/*判斷后相同字符數(shù)歸零*/

t=-1;/*判斷中if中++t;t將會(huì)歸零*/

}

}

else

{

j=0;

t=0;

break;/*如果不同跳出while循環(huán)讓for使n+1繼續(xù)判斷*/

}

}while(a[n]!='\0');/*查找完字符數(shù)組a結(jié)束*/

}

printf("子字符串出現(xiàn)次數(shù):\n%d\n",l);

}??????????????????????????????????

void?cout()

{

int?n=0,t=0,k=0;

printf("請(qǐng)輸入一個(gè)字符串:\n");

fflush(stdin);/*清除緩沖*/

while((c=getchar())!='\n')

{

if(c='a'c='z')

n++;

if(c='A'c='Z')

t++;

if(c='0'c='9')

k++;

}

printf("有大寫(xiě)字母:\n%d\n",t);

printf("有小寫(xiě)字母:\n%d\n",n);

printf("有數(shù)字:\n%d\n",k);

}

void?number()

{

l=num;

printf("請(qǐng)輸入一個(gè)數(shù)字:(0-10)\n");

fflush(stdin);

scanf("%d",m);

printf("%d對(duì)應(yīng)的英文是:\n%s\n",m,*(l+m-1));

}

void?main()

{

while(1)

{???

system("cls");

menu();

switch(n)

{

case?1:system("cls");check();system("pause");break;

case?2:system("cls");cout();system("pause");break;

case?3:system("cls");number();system("pause");break;

case?4:system("cls");break;

default:system("cls");break;?

}

if(n==4)?break;

}

printf("感謝使用\n");

}

C語(yǔ)言菜單設(shè)計(jì)及功能調(diào)用

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

#includestdio.h

#includewindows.h

//\n1.增加 2.查詢(xún) 3.刪除 4.退出\n");

//聲明函數(shù)

void addnd();

void searchnd();

void printnd();

void charund();

//含 枚舉類(lèi)型 分支switch

enum mmenu{/*定義一個(gè)名為mmenu的枚舉類(lèi)型

可以讓常量有一定的含義(如實(shí)現(xiàn)菜單)*/

addn=1,//默認(rèn)是0,定義為1后 后面的成員也會(huì)自動(dòng)變換(排序)

searchn,

printn,

quitn

};

void main(){

enum mmenu input;

while(1){

printf("菜單\n1.增加 2.查詢(xún) 3.打印 4.退出\n");

scanf("%d",input);

Sleep(500);

system("cls");

switch(input){//case內(nèi)的情況 只能是整型或字符型的常量

case addn:printf("選中了1.增加\n");addnd();break;

case searchn:printf("選中了2.查詢(xún)\n");searchnd();break;

case printn:printf("選中了3.打印\n");printnd();break;

case quitn:printf("選中了4.退出\n");exit(0);break;

default :printf("不在選項(xiàng)內(nèi),請(qǐng)重新輸入!\n");break;}

};

}

void addnd(){//增加

printf("http://請(qǐng)自定義addnd()函數(shù)代碼//\n");

}

void searchnd(){

printf("http://請(qǐng)自定義searchnd()函數(shù)代碼//\n");

}

void printnd(){//打印

printf("http://請(qǐng)自定義printnd()函數(shù)代碼//\n");

}

void charund(){

printf("http://請(qǐng)自定義charund函數(shù)代碼//\n");

}

用c語(yǔ)言制作一個(gè)簡(jiǎn)單的菜單程序,一個(gè)主函數(shù)四個(gè)子函數(shù)

給你一個(gè)簡(jiǎn)單的菜單程序吧。其中的子函數(shù),填充成樓主所需即可。

#include

/*子函數(shù)1*/

fun1() {

printf ("子函數(shù)1\n");

}

/*子函數(shù)2*/

fun2() {

printf ("子函數(shù)2\n");

}

/*子函數(shù)3*/

fun3() {

printf ("子函數(shù)3\n");

}

/*子函數(shù)4*/

fun4() {

printf ("子函數(shù)4\n");

}

int main(void) {

int key; /*命令編號(hào)*/

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("請(qǐng)輸入命令編號(hào)以開(kāi)啟操作:");

/*輸入命令編號(hào)*/

scanf("%d",key);

printf ("\n");

/*switch函數(shù)實(shí)現(xiàn)輸入功能序號(hào)執(zhí)行相應(yīng)函數(shù)*/

switch (key) {

case 1: fun1(); break; /*子函數(shù)1*/

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

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

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

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

default:printf("輸入錯(cuò)誤,請(qǐng)重新輸入!\n\n"); break;

}

/*屏幕暫留*/

if (key!=5) {

printf ("\n");

printf("按Enter鍵繼續(xù)...\n");

printf ("\n");

fflush(stdin);

getch ();

}

} while (key!=5);

/*屏幕暫留*/

fflush(stdin);

getch ();

return 0;

}運(yùn)行結(jié)果

C語(yǔ)言中怎么編制簡(jiǎn)單的菜單,通過(guò)菜單選擇能實(shí)現(xiàn)程序的各項(xiàng)功能

#include iostream

#include stdlib.h

#include conio.h

#include ctype.h

using namespace std;

void xuanzepaixu() //選擇排序函數(shù)

{

printf("待添加,請(qǐng)按任意鍵繼續(xù)...");

getchar();

}

void erfenpaixu() //二分查找函數(shù)

{

printf("待添加,請(qǐng)按任意鍵繼續(xù)...");

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---關(guān)閉 #\n");

printf("\t\t\t#***********************#\n");

printf("\t\t\t 請(qǐng)選擇(1-4) =:");

}

void main()

{

char select;

while(1)

{

menu();

system("COLOR 9f");

scanf("%c",select);

if(select=='3')

break; //返回上級(jí)菜單

else

{

getchar(); //讀入回車(chē)符

if(!isdigit(select)) //如果不是數(shù)字字符

{

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;

}

}

}

}

}

}

分享標(biāo)題:c語(yǔ)言菜單函數(shù) c語(yǔ)言程序菜單
當(dāng)前網(wǎng)址:http://www.rwnh.cn/article38/hicesp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開(kāi)發(fā)、外貿(mào)網(wǎng)站建設(shè)、手機(jī)網(wǎng)站建設(shè)品牌網(wǎng)站建設(shè)、虛擬主機(jī)、企業(yè)網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁(yè)設(shè)計(jì)
天长市| 文登市| 山阳县| 华坪县| 湘乡市| 普安县| 鄂托克旗| 准格尔旗| 岳阳市| 塔河县| 金秀| 北流市| 读书| 富民县| 廉江市| 定结县| 瓮安县| 宁城县| 靖宇县| 广平县| 邵东县| 中卫市| 桃源县| 措勤县| 梁河县| 南漳县| 额敏县| 凉山| 江北区| 佛冈县| 宜丰县| 雷波县| 长子县| 富平县| 收藏| 革吉县| 微山县| 南丰县| 四会市| 滦南县| 鹤壁市|