欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當前位置:主頁 > 軟件編程 > C語言 >

C語言程序打豆豆(函數(shù)版)

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C語言|點擊: 次

【項目】

設計一個程序,能重復地在顯示下面的信息:

  • 1. 吃飯
  • 2. 睡覺
  • 3. 打豆豆
  • 0. 退出
  • 請選擇(0-3):

根據(jù)用戶輸入的選項,輸出一句提示性的話語(將來會對應實現(xiàn)某個功能)。輸入0,則退出。
要求將各功能定義專門的函數(shù)。

參考解答:

#include <stdio.h>
#define EAT '1'
#define SLEEP '2'
#define HITDOUDOU '3'
#define CRY '4'
#define WITHDRAW '0'
char getChoice();
void eat();
void sleep();
void hitdoudou();
void cry();
int main()
{
  char cChioce;
  while(1)
  {
    cChioce = getChoice();
    if (cChioce==EAT)
      eat();
    else if (cChioce==SLEEP)
      sleep();
    else if (cChioce==HITDOUDOU)
      hitdoudou();
    else if (cChioce==CRY)
      cry();
    else if (cChioce==WITHDRAW)
      break;
    else
    {
      printf("\007選擇錯誤!\n");
    }
  }
  return 0;
}
char getChoice()
{
  char c;
  printf("\n ********************\n");
  printf(" * 1. 吃飯     *\n");
  printf(" * 2. 睡覺     *\n");
  printf(" * 3. 打豆豆    *\n");
  printf(" * 4. 找豆豆媽訴苦 *\n");
  printf(" * 0. 退出     *\n");
  printf(" ********************\n");
  printf(" 請選擇(0-4):");
  fflush(stdin);
  scanf("%c", &c);
  return c;
}
void eat()
{
  printf(" 我吃吃吃... ...\n");
}
void sleep()
{
  printf(" 我睡覺覺... ...\n");
}
void hitdoudou()
{
  printf(" 我打打打... ...\n");
}
void cry()
{
  printf(" 哇! 你家豆豆骨頭硬,害得我手疼... ...\n");
}

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對我們的支持。如果你想了解更多相關內容請查看下面相關鏈接

上一篇:wxWidgets實現(xiàn)無標題欄窗口拖動效果

欄    目:C語言

下一篇:C語言實現(xiàn)學生選課系統(tǒng)完整版

本文標題:C語言程序打豆豆(函數(shù)版)

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/450.html

網(wǎng)頁制作CMS教程網(wǎng)絡編程軟件編程腳本語言數(shù)據(jù)庫服務器

如果侵犯了您的權利,請與我們聯(lián)系,我們將在24小時內進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權所有