亚洲喷奶水中文字幕电影,日本aⅴ高清一区二区三区,欧美亚洲日本国产,欧美日韩亚洲中文字幕

<legend id="flx4p"><abbr id="flx4p"><thead id="flx4p"></thead></abbr></legend>

<mark id="flx4p"><thead id="flx4p"></thead></mark>

      我要投稿 投訴建議

      while語(yǔ)句循環(huán)的規(guī)律

      時(shí)間:2020-12-22 15:03:50 句子 我要投稿

      while語(yǔ)句循環(huán)的規(guī)律

        1.1.1 while循環(huán)

        while循環(huán)結(jié)構(gòu)根據(jù)條件來(lái)執(zhí)行一定次數(shù)的語(yǔ)句塊。

        1. #include

        2. intmain(void){

        3. int i,sum=0;

        4. i=1;

        5. while(i<=100){

        6.sum=sum+i;

        7.i++;

        8. }

        9. printf("%d ",sum);

        10.return0;

        11.}

        【例6-3】統(tǒng)計(jì)從鍵盤(pán)輸入一行字符的個(gè)數(shù)。

        1. #include

        2. intmain(void){

        3. int n=0; 4. printf("input a string: "); 5. while(get)!=' ') n++;

        6. printf("%d",n);

        7. return0;

        8. }

        本例程序中的循環(huán)條件為get)!=' ',其意義是,,只要從鍵盤(pán)輸入的字符不是回車(chē)就繼續(xù)循環(huán)。循環(huán)體n++完成對(duì)輸入字符個(gè)數(shù)計(jì)數(shù)。從而程序?qū)崿F(xiàn)了對(duì)輸入一行字符的字符個(gè)數(shù)計(jì)數(shù)。

        使用while語(yǔ)句應(yīng)注意以下兩點(diǎn)。

        1) while語(yǔ)句中的表達(dá)式一般是關(guān)系表達(dá)或邏輯表達(dá)式,只要表達(dá)式的'值為真(非0)即可繼續(xù)循環(huán)。 1. #include

        2. intmain(void){ 3. int a=0,n;

        4. printf(" input n: ");

        5. scanf("%d",&n);

        6. while(n--)printf("%d ",a++*2);

        7. return0;

        8. }

        本例程序?qū)?zhí)行n次循環(huán),每執(zhí)行一次,n值減1。循環(huán)體輸出表達(dá)式a++*2的值。該表達(dá)式等效于(a*2; a++)。

        2) 循環(huán)體如包括有一個(gè)以上的語(yǔ)句,則必須用{}括起來(lái),組成復(fù)合語(yǔ)句。

      【while語(yǔ)句循環(huán)的規(guī)律】相關(guān)文章:

      英語(yǔ)教學(xué)中如何把握語(yǔ)句規(guī)律提高寫(xiě)作水平的論文11-23

      循環(huán)經(jīng)濟(jì)調(diào)研報(bào)告04-20

      《積的變化規(guī)律 》教學(xué)設(shè)計(jì)03-04

      銀行循環(huán)借款合同范本02-11

      精選司法考試的命題規(guī)律08-08

      對(duì)我市循環(huán)農(nóng)業(yè)發(fā)展情況的調(diào)研報(bào)告07-25

      創(chuàng)業(yè)機(jī)會(huì)有規(guī)律嗎01-24

      考研往年命題規(guī)律總結(jié)06-12

      中考物理復(fù)習(xí)尋求規(guī)律10-15

      小學(xué)數(shù)學(xué)教學(xué)設(shè)計(jì):《找規(guī)律》04-06