循环结构作业c语言,C语言循环结构练习题带答案(最新整理)
《C語言循環結構練習題帶答案(最新整理)》由會員分享,可在線閱讀,更多相關《C語言循環結構練習題帶答案(最新整理)(10頁珍藏版)》請在人人文庫網上搜索。
1、第 5 章循環結構程序設計練習題1. 單項選擇題(1) 語句 while (!e);中的條件!e 等價于A。A. e=0B. e!=1C. e!=0D. e(2) 下面有關 for 循環的正確描述是D。A. for 循環只能用于循環次數已經確定的情況B. for 循環是先執行循環體語句,后判定表達式C. 在 for 循環中,不能用 break 語句跳出循環體D. for 循環體語句中,可以包含多條語句,但要用花括號括起來(3)C 語言中D。A. 不能使用 do-while 語句構成的循環B. do-while 語句構成的循環必須用 break 語句才能退出C. do-while 語句構成的循環。
2、,當 while 語句中的表達式值為非零時結束循環D. do-while 語句構成的循環,當 while 語句中的表達式值為零時結束循環(4)C 語言中 while 和 do-while 循環的主要區別是A。A. do-while 的循環體至少無條件執行一次B. while 的循環控制條件比 do-while 的循環控制條件嚴格C. do-while 允許從外部轉到循環體內D. do-while 的循環體不能是復合語句(5) 以下程序段C。第 5 章 循環結構程序設計41int x=-1; dox=x*x;while (!x);A. 是死循環B. 循環執行二次C. 循環執行一次D. 有語法錯誤。
3、(6) 下列語句段中不是死循環的是 C 。A. i=100;while (1)i=i%100+1;if (i=20) break;B. for (i=1;i+)sum=sum+1;C. k=0; do+k; while (k main()int i;for (i=4;i main()int num=0;while (num main()int s=0,k;for (k=7;k=0;k-)switch(k)case 1:case 4:case 7: s+; break; case 2:case 3:case 6: break;case 0:case 5: s+=2; break;cout mai。
4、n()int i=1,s=3; dos+=i+;if (s%7=0)continue; else+i; while (s main()int i,j;for (i=4;i=1;i-)cout main()int i,j,k;for (i=1;i main()int i,j,k;for (i=1;i0;k-) cout main()int i,j,k;for (i=1;i0;i-)for (j=1;j=20-3*i;j+) cout ;for (k=1;k=2*i-1;k+) cout*;coutendl;輸出結果:*“”“”At the end, Xiao Bian gives you a p。
5、assage. Minand once said, people who learn to learn are very happy people. In every wonderful life, learning is an eternal theme. As a professional clerical and teaching position, I understand the importance of continuous learning, life is diligent, nothing can be gained, only continuous learning ca。
6、n achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edited by my studio professionals, there may be errors in the document, if there are errors, please correct, thank you。
總結
以上是生活随笔為你收集整理的循环结构作业c语言,C语言循环结构练习题带答案(最新整理)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux+android4.2键值关系
- 下一篇: linux音频时钟bclk,linux