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

C++常见选择填空习题集

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

三、写程序运行结果

1. #include using namespace std; int f1(int a) {

int b=0;

static int c=2; b++; c++;

return a+b+c; }

int main() {

int a=2;

cout<

2. #include using namespace std; void main() { int a=5,b=7,c=10; {

int b=8;

double c=8.8; a=b; {

int c=b; }

cout<

cout<

8,8,8.8 8,7,10

3. #include

using namespace std; int i=10;

int f1(int j) { static int i=20; j=i--; return j; }

int f2(int i) { int j=15;

return i=j+=i; }

void main() {

for (int j=1;j<3;j++)

cout<

20,26 19,27

4. #include using namespace std; int main() {

int max(int a,int b,int c); int max(int a,int b); int a=-11,b=-10,c=-3; cout<

int max(int a,int b,int c) { if (b>a) a=b; if (c>a) a=c; return a; }

int max(int a,int b) {

if (a>b) return a; else return b; } -10 -3

5. #include using namespace std;

long f(int n) {

if (n>2) return (f(n-1)+f(n-2)); else return (n); }

void main() { int a=4,b=2;

cout<

6. #include using namespace std; int a=5; void main() {

int b=a+20; int a=10; {

int a=0,b=0;

for (int i=1;i<6;i++) { a+=i; b+=a; } cout<<\}

cout<<\}

a+b=50 a+b=35

7. 写出下面的程序的运行结果 #include #define N 5 void func() {

static int a; int b=2;

cout<<(a+=3,a+b)<<” ”; }

void main() {

for(int i=1;i

cout<

5 8 11 14

8. #include \

void main() {

int a=5,b=7,c=10;

cout<

int b=8;

float c=8.8;

cout<

a=b; {

int c;

c=b;

cout<

cout<

cout<

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