第一范文网 - 专业文章范例文档资料分享平台

c++复习题及答案

来源:用户分享 时间:2025/5/28 8:09:18 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

return 0;

答案:8 3.

#in clude using n amespace std; mai n() {int i,j,x=O; for(i=0;i<2;i++) {x++;

for(j=0;j<=3;j++) {if (j%2) con ti nue; x++; } x++; }

cout<< “x=” <

4.

#in clude using n amespace std; mai n() {i nt i;

for(i=1;i<=5;i++)

{if(i %2) cout<< “ * ”; else con ti nue; cout<< “#\; }

cout<< \n” ; }

答案:*#*#*#$ 5.

#in clude using n amespace std; void mai n() { int I,j,a=0; for(l=0;l<2;l++) { for(j=0;j<4;j++) { if(j%2) break;

a++; } a++;

cout<

答案:4 6.

运行以下程序时,从键盘键入 #in clude using n amespace std; void mai n() {char c;

while((c=getchar())!=?) putchar(++c); } 答案:sjhiu 7.

#in clude void mai n() {i nt I;

for(l=1;l<=5;l++) switch(l%2)

{case 0:I++; cout<<\case 1:I+=2; cout<<\default: cout<<\} } 答案:* # 8.

#i nclude using n amespace std; int a=5; int mai n () { int a=10, b=20; { int a=0,b=0;

for (i nt i=1; i<6; i++) {a+=i ; b+=a;} }

cout <

20

right?请给出回车后运行的结果。

#in clude using n amespace std; int k=1;

void f(i nt m) {m+=k; k+=m;

{char k='B'; cout<< k - 'A' <<'\\n'; }

cout<

int mai n() {int i=4; f(i);

cout<

程序的输出第一行是 1 ,第二行是 5 , 6 ,第三行是 4 , 6 10. # in elude

# in elude int main()

{ char a[5]={\

char p1, p2; p仁 p2=a[0]; for (int i=0; i<5; i++)

{ if (strcmp(a[i],p1)>0) p 1= a[i];

if (strcmp(a[i],p2)<0) p2=a[i];

}

cout <

答案:worker cadre

11. #in clude

using n amespace std;

in t m[3][3]={ {1}, {2}, {3} }, n[3][3]={ 1,2, 3 }; int mai n()

{ cout<

程序的输出第一行是 上 ______ ,第二行是_0 _______ 。 12. #in clude

using n amespace std; void f (int s[]) {static int j;

do{s[j]+=s[j+1]; } while (++j<2); }

int mai n()

搜索更多关于: c++复习题及答案 的文档
c++复习题及答案.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0fa3m0liz18xswm2yhl07916095ebr009dl_3.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top