云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > C语言题库

C语言题库

  • 62 次阅读
  • 3 次下载
  • 2025/6/15 2:14:44

#include void yesno(char ch) { switch (ch) { case 'Y': case 'y':cout<<\ break ; case 'N': case 'n':cout<<\ break ; } }

void main() {char ch;

cout<<\请输入一个字母'Y','y'或'n','N':\cin>> ch ; yesno(ch); }

8、以下程序的运行结果是 9 。 #include int a=5;int b=7; plus(int x,int y)

{int z;z=x+y;return z; }

void main() { int a=4,b=5;cout<

9、以下程序的功能是 1 2 6 24 120 。 #include int fac(int n)

{static int f=1;f=f*n;return(f); }

void main() { int i;for(i=1;i<=5;i++) cout<

10、以下程序的输出结果是 2 。 #include int m=13;

int fun(int x,int y) { int m=3; return(x*y-m); }

29

void main() { int a=7,b=5; cout<

解:在主函数中调用fun(a,b)时,m=3是内部变量,返回x*y-m=7*5-3=32。然而主函数中m是外部变量,m=13,所以程序的输出结果(32/13的结果值)为:2。 11、以下程序的执行结果是 4 4 。 #include void func(int ); void main() { int k=4; func(k); func(k); }

void func(int a) { int m=0; m=m+a; cout<

12、以下程序的执行结果是 a=10,b=3 。 #include int a,b; void main() { int swap(); a=3;b=10; swap(); cout<<\}

swap() { int temp; temp=a; a=b; b=temp; }

13、以下程序的执行结果是 x=4 。 #include int x; sub()

30

{ x=4; }

void main() { sub(); cout<<\}

14、以下程序的执行结果是 a=5 a*a=25 a*a*a=8。#include int a=5; void p1(); void p2(); void main() { cout<<\ p1(); p2(); }

void p1() { cout<<\ a=2; }

void p2() { cout<<\}

15、以下程序的执行结果是1.x=3 2.x=6 3.x=1 4.x=3。

#include int x=5; void p1(); void p2(); void main() { int x=3; cout<<\ p1(); p2();

31

cout<<\}

void p1() { x=x+1; cout<<\}

void p2() { int x=1; cout<<\}

16、以下程序的运行结果是 max is 2 。 #include int max(int x,int y); void main() { int a=1,b=2,c; c=max(a,b); cout<<\}

int max(int x,int y) { int z; z=(x>y)?x:y; return(z); }

17、以下程序的运行结果是 10 20 40 40 。 #include int x1=30,x2=40; void sub(int x,int y) { x1=x; x=y; y=x1; return; }

void main() { int x3=10,x4=20; sub(x3,x4); sub(x2,x1); cout<

32

搜索更多关于: C语言题库 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

#include void yesno(char ch) { switch (ch) { case 'Y': case 'y':cout<<\ break ; case 'N': case 'n':cout<<\ break ; } } void main() {char ch; cout<> ch ; yesno(ch); } 8、以下程序的运行结果是 9 。 #include int a=5;int b=7; plus(int x,int y) {int z;z=x+y;return z; } void m

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com