freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

第四章程序的控制結(jié)構(gòu)-在線瀏覽

2024-08-31 03:41本頁面
  

【正文】 ch=ch32。 } 編程示例 if(ab) { t=a。 b=t。 a=b。 if(bc) max=b。 else max=c。 if(a=0) printf(a equal to zero)。 ? 嵌套的 if語句 輸入 x的值,利用函數(shù)計算 y的值 1 (x0) y= 0 (x=0) 1 (x0) int main( ) {int x,y。x)。 else if(x==0) y=0。 printf(x=%d,y=%d\n,x,y)。 } x0 y=1 x=0 y=0 y=1 N N Y Y 1 (x0) y= 0 (x=0) 1 (x0) if(x0) y= ?1。 else y=1。 else y=0。 y=1。 else y=0。 if(x!=0) if(x0) y= 1。 if(num500) cost=。 else if(num100) cost=。 else cost=0。 else max=c。 else max=c。 if( maxb) max=b。 if(abamp。ac) max=a。amp。 else max=c。 x=表達(dá)式 1 ?表達(dá)式 2 :表達(dá)式 3 表達(dá)式 1 x=表達(dá)式 2 x=表達(dá)式 3 N Y main( ) {char ch。ch)。A39。amp。Z39。 printf(%c\n,ch)。 5.結(jié)果類型:與表達(dá)式 2或表達(dá)式 3相同 三、 switch語句 switch(ch) {case 39。: printf(Good!\n)。 case 39。: printf(Good!\n)。 case 39。: printf(Pass\n)。 case 39。: printf(Fail!\n)。 } ch Good Pass Fail ch==39。 ch==39。 ch==39。 case ch==39。 switch(ch) {csae 39。: case 39。: printf(Good!\n)。 case 39。: printf(Pass\n)。 case 39。: printf(Fail!\n)。 } ch Good Pass Fail ch==39。 ch==39。 ch==39。 case ch==39。 ? 格式: switch (表達(dá)式 ) {case 常量表達(dá)式 1:語句串 1 case 常量表達(dá)式 2:語句串 2 ………… case 常量表達(dá)式 n:語句串 n default :語句串 n+1 } ?表達(dá)式只能是整型、字符型、枚舉類型 ?各常量表達(dá)式中不能有相同的值 ?執(zhí)行完某個分支后, 要用 break語句終止 switch語句的執(zhí)行 ?不同的常量表達(dá)式可以執(zhí)行相同的語句串 switch(ch) {csae A: case B: printf(Good!\n)。 case D: printf(Fail!\n)。A39。B39。 case C: printf(Pass!\n)。 } switch(ch) {csae 39。= ch=39。: printf(Good!\n)。 case D: printf(Fail!} switch(ch) {csae 39。: case 39。: printf(Good!\n)。 case 39。: printf(Pass\n)。 case 39。: printf(Fail!\n)。 } switch(ch) {csae 39。: case 39。: printf(Good!\n)。 case 39。: printf(Pass\n)。 case 39。: printf(Fail!\n)。 } if(ch==39。) goto LB。B39。 if(ch== 39。) goto LC。D39。 LB: printf(Good!\n)。 LD: printf(Fail!\n)。 goto L。 ?break語句用來在執(zhí)行完一個 case分支后,終止switch語句的執(zhí)行。 ?當(dāng)沒有 case子句匹配時,就執(zhí)行 default子句。若無 default子句,此時 switch語句就什么動作也沒有做。 int main( ) { int data1,data2。 printf(Type number operator number\n)。data1,amp。data2)。+39。 break。39。 break。*39。 break。/39。 else printf(%d/%d=%d\n, data1,data2,data1/data2)。 default: printf(Unknow operator!\n)。 printf(Please enter a,b,c:)。a,amp。c)。 if(fabs(a)=1e6) printf(has one roots:%\n,c/b)。 p=b/(2*a)。 if(fabs(disc)1e6) printf(has two equal roots:%\n, p)。 else {printf(has plex roots:\n)。 printf(%% i\n, p,q)。 公里 折扣 250 無 =250 500 2% =500 1000 5% =1000 2022 8% =2022 3000 10% =3000 15% 0 1 4 2 3 5 6 7 8 9 10 11 = 12 int main( ) {int c,s。 printf(Input p,w,s:)。p,amp。s)。 else c=s/ break。 break。 break。 break。 break。break。 printf(freight=%\n,f)。 } int main() { char choice。 //顯示菜單 printf(1. 西紅柿炒雞蛋 \n)。 printf(3. 魚香肉絲 \n)。 printf(請選擇 (03):)。 //選擇 switch(choice) { case 39。: printf(西紅柿炒雞蛋 1份,請稍后 )。 case 39。: printf(宮爆雞丁 1份,請稍后 )。 case 39。: printf(魚香肉絲 1份,請稍后 )。 } printf(\n歡迎光臨 !\n)。 //sum存放和值 sum=sum+3。 ...... sum=sum+100。 //sum存放和值 sum=sum+1。 sum=sum+3。 ...... sum=sum+100。 //sum存放和值 i=1。 i=i+1。 i=i+1。 i=i+1。 i=i+1。 計算 1+2+3+......+100 int i,sum。 i=1。 i++。 sum=sum+i。 sum=0。 i=100 N Y 輸出 sum 計算 1+2+3+......+100 int i,sum。 for(i=1。 i++) { sum+=i。 sum=sum+i。 i=1。 sum=sum+i。 sum=0。 i=100 N Y 輸出 sum sum=sum+i。 i=1。 計算 1+3+5+......+99 sum=sum+i。 sum=0。 i=100 N Y 輸出 sum 計算 13+57......99 sum=sum+s*i。 s=s。 i=1。 i100 N Y 輸出 sum 符號 s,初始為 1; s=s。 輸入 x的值 sum=sum+x。 Y 計算 x1+x2+x3+......+x100 i=1。 sum=sum+s/i。 i++。 輸出 sum N 符號 s,初始為 1; s=s。 sum=0。 do{ sum+=i。 } while(i=100)。 sum=sum+i。 sum=0。 i=100 N Y 輸出 sum 實(shí)現(xiàn)循環(huán)的方式: while do while for if goto 循環(huán)條件 結(jié)束條件 循環(huán)的內(nèi)容 循環(huán)要素: 表達(dá)式 語句 Y N 一、 while語句 表達(dá)式 語句 非 0 0 格式: while(表達(dá)式)語句 ; 語義: 只要表達(dá)式為真 重復(fù)執(zhí)行語句 while語句 循環(huán)體 循環(huán)條件 表達(dá)式 語句 非 0 0 while(表達(dá)式) 語句 ; while語句 int m
點(diǎn)擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1