C++模拟题—2015.05.docVIP

  • 2
  • 0
  • 约5千字
  • 约 8页
  • 2017-12-17 发布于河南
  • 举报
C模拟题—2015.05

西南财经大学本科期末考试试卷 课程名称:C++语言程序设计 担任教师: 考试学期:201 - 201 学年第学期 专业: 学号: 年级: 姓名: 考试时间:200 年 月 日(星期 ) 午 : -- : 题号 一 二 三 四 五 六 七 八 总分 阅卷人 成绩 出题教师必填:1、考试类型:闭卷[ ] 开卷[ ]( 页纸开卷) 2、本套试题共 2 道大题,共 页,完卷时间 120 分钟。 3、考试用品中除纸、笔、尺子外,可另带的用具有: 计算器[ ] 字典[ ] 教材1本 等 (请在下划线上填上具体数字或内容,所选[ ]内打钩) 考生注意事项:1、出示学生证或身份证于桌面左上角,以备监考教师查验。 2、拿到试卷后清点并检查试卷页数,如有重页、页数不足、空白页及印刷模糊等举手向监考教师示意调换试卷。 3、做题前请先将专业、年级、学号、姓名填写完整。 4、考生不得携带任何通讯工具进入考场。 5、严格遵守考场纪律。 一、阅读程序,填空使得程序完整或者分析程序的执行结果,填写在下表中。 (共30分,每空3分) 【1】 【2】 【3】 【4】 【5】 【6】 【7】 【8】 【9】 【10】 1. 以下程序的执行后,输出的结果是: 【1】 #include iostream using namespace std; int main() { int a=3, b=5; float c=1; double d=0; if(b-a!=c) d+= ++a 1; else d-=c ab; cout d=dendl; return 0; } 2. 以下程序的执行后,输出的结果是: 【2】 #include iostream using namespace std; int main( ) { int i,n=0; for(i=2;i5;i++) { do { if(i%3) continue; n++; }while(!i); n++; } coutn=nendl; return 0; } 3. 填空使得以下程序的功能完整。 该程序使用递归法求从1到n的立方和:?? #include iostream using namespace std; int f(int); int main() { int n,s; coutinput the number n:; cinn; s= 【3】 ; coutThe result is sendl; return 0; } int f(int n) { //递归法求立方和函数 if ( n= =1 ) return 1; else return ( 【4】 ); } 4. 以下程序的执行后,输出的结果是: 【5】 #includeiostream #includestring using namespace std; int main() { char ch1[20]={Good}; char ch2[20]=Morning; strcat(ch1, ); strcat(ch1,ch2); coutstr1=ch1endl; for(int k=0;kstrlen(ch2);k++) { if (ch2[k]=ach2[k]=z) ch2[k]=ch2[k]-(a-A); } coutstr2=ch2endl; return 0; } 5. 阅读程序并填写以下的空白内容,使得程序功能完整。 #includeiostream using namespace std; void square(int x, int y) { x=x*x; y=y*y; } void 【6】 { int max, av

文档评论(0)

1亿VIP精品文档

相关文档