日韩欧乱色一区二区三区在线_久久―日本道色综合久久_欧美日本一区二区_网曝91综合精品门事件在线

千鋒教育-做有情懷、有良心、有品質的職業(yè)教育機構

手機站
千鋒教育

千鋒學習站 | 隨時隨地免費學

千鋒教育

掃一掃進入千鋒手機站

領取全套視頻
千鋒教育

關注千鋒學習站小程序
隨時隨地免費學習課程

當前位置:首頁  >  技術干貨  > c語言經(jīng)典練習題100道(七)

c語言經(jīng)典練習題100道(七)

來源:千鋒教育
發(fā)布人:syq
時間: 2022-07-29 17:23:00 1659086580

  【程序31】 題目:請輸入星期幾的第一個字母來判斷一下是星期幾,如果第一個字母一樣,則繼續(xù)判斷第二個字母。

c語言經(jīng)典練習題

  1.程序分析:用情況語句比較好,如果第一個字母一樣,則判斷用情況語句或if語句判斷第二個字母。

  2.程序源代碼:

#include "stdio.h"

#include "conio.h"

void main(){

  char letter;

  printf("please input the first letter of someday\n");

  while((letter=getch())!='Y')/*當所按字母為Y時才結束*/

  {

    switch (letter)

    {

      case 'S':printf("please input second letter\n");

      if((letter=getch())=='a')

        printf("saturday\n");

        else if ((letter=getch())=='u')

          printf("sunday\n");

          else printf("data error\n");

      break;

      case 'F':printf("friday\n");break;

      case 'M':printf("monday\n");break;

      case 'T':printf("please input second letter\n");

      if((letter=getch())=='u')

        printf("tuesday\n");

        else if ((letter=getch())=='h')

          printf("thursday\n");

        else printf("data error\n");

      break;

      case 'W':printf("wednesday\n");break;

      default: printf("data error\n");

    }

  }

  getch();

}

  ——————————————————————————————————————

  【程序32】 題目:Press any key to change color, do you want to try it. Please hurry up!

  1.程序分析:

  2.程序源代碼:

#include "conio.h"

#include "stdio.h"

void main(void){

  int color;

  for (color = 0; color < 8; color++)

  { 

    textbackground(color);/*設置文本的背景顏色*/

    cprintf("This is color %d\r\n", color);

    cprintf("Press any key to continue\r\n");

    getch();/*輸入字符看不見*/

  }

}

  ——————————————————————————————————————

  【程序33】 題目:學習gotoxy()與clrscr()函數(shù)

  1.程序分析:

  2.程序源代碼:

#include "conio.h"

#include "stdio.h"void main(void){

  clrscr();/*清屏函數(shù)*/

  textbackground(2);

  gotoxy(1, 5);/*定位函數(shù)*/

  cprintf("Output at row 5 column 1\n");

  textbackground(3);

  gotoxy(20, 10);

  cprintf("Output at row 10 column 20\n");

  getch();

}

  ——————————————————————————————————————

  【程序34】 題目:練習函數(shù)調用

  1. 程序分析:

  2.程序源代碼:

#include "stdio.h"

#include "conio.h"

void hello_world(void){

  printf("Hello, world!\n");}void three_hellos(void){

  int counter;

  for (counter = 1; counter <= 3; counter++)

    hello_world();/*調用此函數(shù)*/}void main(void){

  three_hellos();/*調用此函數(shù)*/

  getch();

}

  ——————————————————————————————————————

  【程序35】 題目:文本顏色設置

  1.程序分析:

  2.程序源代碼:

#include "stdio.h"

#include "conio.h"

void main(void){

  int color;

  for (color = 1; color < 16; color++)

  {

    textcolor(color);/*設置文本顏色*/

    cprintf("This is color %d\r\n", color);

  }

  textcolor(128 + 15);

  cprintf("This is blinking\r\n");

  getch();

}

  ——————————————————————————————————————

  更多關于“物聯(lián)網(wǎng)培訓”的問題,歡迎咨詢千鋒教育在線名師。千鋒教育多年辦學,課程大綱緊跟企業(yè)需求,更科學更嚴謹,每年培養(yǎng)泛IT人才近2萬人。不論你是零基礎還是想提升,都可以找到適合的班型,千鋒教育隨時歡迎你來試聽。

tags:
聲明:本站稿件版權均屬千鋒教育所有,未經(jīng)許可不得擅自轉載。
10年以上業(yè)內強師集結,手把手帶你蛻變精英
請您保持通訊暢通,專屬學習老師24小時內將與您1V1溝通
免費領取
今日已有369人領取成功
劉同學 138****2860 剛剛成功領取
王同學 131****2015 剛剛成功領取
張同學 133****4652 剛剛成功領取
李同學 135****8607 剛剛成功領取
楊同學 132****5667 剛剛成功領取
岳同學 134****6652 剛剛成功領取
梁同學 157****2950 剛剛成功領取
劉同學 189****1015 剛剛成功領取
張同學 155****4678 剛剛成功領取
鄒同學 139****2907 剛剛成功領取
董同學 138****2867 剛剛成功領取
周同學 136****3602 剛剛成功領取
相關推薦HOT
主站蜘蛛池模板: 南投市| 克山县| 万山特区| 时尚| 邵阳市| 龙山县| 延寿县| 乌鲁木齐县| 聊城市| 垫江县| 乡宁县| 大丰市| 湟源县| 蕉岭县| 华阴市| 新密市| 镇康县| 鄂托克前旗| 广宗县| 新平| 松江区| 邵东县| 泊头市| 台湾省| 平安县| 泌阳县| 滨州市| 东丽区| 靖远县| 元谋县| 莱阳市| 加查县| 安义县| 临城县| 龙山县| 东平县| 公安县| 鸡泽县| 漾濞| 徐水县| 兰溪市|