您好,登錄后才能下訂單哦!
這篇文章主要介紹“Python函數(shù)模塊化程序設(shè)計(jì)的方法”的相關(guān)知識,小編通過實(shí)際案例向大家展示操作過程,操作方法簡單快捷,實(shí)用性強(qiáng),希望這篇“Python函數(shù)模塊化程序設(shè)計(jì)的方法”文章能幫助大家解決問題。
#include <stdio.h>
int main()
{
int iChioce;
do
{
printf("* 1. 吃飯\n");
printf("* 2. 睡覺\n");
printf("* 3. 打豆豆\n");
printf("* 0. 退出\n");
printf("* 請選擇(0-3):");
scanf("%d", &iChioce);
//選擇后的處理
if (iChioce==1)
printf("我吃吃吃...\n");
else if (iChioce==2)
printf("我睡覺覺...\n");
else if (iChioce==3)
printf("我打打打...\n");
else if (iChioce==0)
break;
else
{
printf("\007選擇錯誤!\n");
continue;
}
printf("恭喜你完成了一項(xiàng)工作!\n");
}
while(1);
return 0;
}
#include <stdio.h>
int choose()
void eat();
void sleep();
void hitdoudou();
int main()
{
int iChioce;
do
{
iChioce=choose();
if (iChioce==1)
eat();
else if (iChioce==2)
sleep();
else if (iChioce==3)
hitdoudou();
else if (iChioce==0)
break;
else
{
printf("\007選擇錯誤!\n");
continue;
}
printf("恭喜你完成了一項(xiàng)工作!\n");
}
while(1);
return 0;
}
int choose()
{
int i;
printf("\n* 1. 吃飯\n");
printf("* 2. 睡覺\n");
printf("* 3. 打豆豆\n");
printf("* 0. 退出\n");
printf("* 請選擇(0-3):");
scanf("%d", &i);
return i;
}
void eat()
{
printf("我吃吃吃... ...\n");
}
void sleep()
{
printf("我睡覺覺... ...\n");
}
void hitdoudou()
{
printf("我打打打... ...\n");
}
關(guān)于“Python函數(shù)模塊化程序設(shè)計(jì)的方法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識,可以關(guān)注億速云行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點(diǎn)。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。