2017华南理工大学网络教育《高级语言程序设计C++》平时作业
更新时间:2023-09-16 23:40:01 阅读量: 高中教育 文档下载
- 华南理工大学网络教育平台推荐度:
- 相关推荐
一、分析程序,写输出结果
1. #include
#include
for( m=1; m<=10; m+=2 ) { k = m/3;
for( i=2; i<=k; i++ )
if( m%i ) cout << m << \ } } 7 9
2. #include
void fun(); void main() {int i;
for(i=1;i<5;i++) fun(); cout< void fun() { static int a; int b=2; a += 2 ; cout<< a+b <<'\\t'; } 4 6 8 10 3. #include int fun(int n) { if(n==0) return 1; return 2*fun(n-1); } void main() { int a=5; cout< 32 4. #include void main() { char *cp=\ for (int i=0 ; i<4; i++ ) cout< Word ord rd d 二、.根据程序功能填空。 1. 程序把10个数存储到一维数组a中,并求该数组中最大值。 #include int a[10]={76,55,95,87,85,83,65,90,77,85}; int *p= a ; max=*p; for( ; p< &a[10] ; p++) if( *p>max ) max= *p ; cout<<\} 2.下面程序的功能是输出1至100之间每位数字的乘积大于每位数的和的数。例如,45两位数字的乘积为4×5=20,和为4+5=9。 #include { int n, k=1, s=0, m; for(n=1; n<=100; n++) { k=1; s=0; 1m=n ; } while( 2m ) { k*=m; s+=m; 3m/=10 ; } if(k>s) cout< } 3.程序对输入的n求s = 1 + 1/23 + 1/33 + … + 1/n3 。 #include {double s; int i, n; cout<<\ s = 0; for (i=1; i 4.函数create从键盘输入整数序列,以输入0为结束。按输入顺序建立单向链表并返回表头。 struct node{int data; node * next;}; node * create() { node *head, *p, *q; p = new node; head = p; cin>>p->data; while( p->data != 0 ) { q = p; p = new node ; q->next = p; cin>>p->data; } if (head == p) head = NULL; else q->next = p ; if (head == NULL) delete p ; return head; } 5.以下程序求方程的全部整数解: 3x + 2y - 7z = 5 ( 0 ≤ x, y, z ≤ 100 ) #include for( x=0; x<=100; x++ ) for( y=0; y<=100; y++ ) { if( ( z=3*x+2*y-5 ) % 7 ) break ; //求出z的值 s=s+(1.0/(n*n*n) ; if( z<=100&&z>=0 ) //检查z的范围 cout << \ } } 三、程序设计 1. 编写函数输出以下形状的图形,其中构成图形的数字和输出的行数通过参数传送。 1 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4 #include int i,n; for (i=0;i<5; i++){ for (n=0;n<2*i-1;n++){ cout< cout< 2. 请编程序,输入两个正整数啊a和b(a the factors of 6 : 2 3 the factors of 7 : no factor the factors of 8 : 2 4 #include int numA,numB; cout<<\Two Numbers:\ cin>>numA>>numB; for (int i=numA;i<=numB;i++) { printFactor(i); } } void printFactor(int i) { cout<<\FACTORS OF \ int *fact=new int(); int n=0; for (int k=2;k if (i%k==0) { fact[n]=k; n++; } } if (n==0) { cout<<\FACTOR\ } else { for (int j=0;j
正在阅读:
2017华南理工大学网络教育《高级语言程序设计C++》平时作业09-16
校民兵工作心得体会03-31
“木炭还原氧化铜”演示实验的改进02-27
小学“大班额论坛”活动汇报材料03-08
物资管理试题09-23
中国画论(1)自考09-19
章庄学校开展教育收费中突出问题专项治理工作实施方案10-14
培养低年级学生良好书写习惯的研究03-07
连加连减顾玉兰20151105-02
- 上海大众、一汽大众、东风日产车型与VIN代号对照表
- 第2章服装原型及原型制作
- 江苏省工商行政管理系统经济户口管理办法及四项制度
- 纪检监察业务知识试题2
- 传感器综合题答案
- 北京第二外国语学院翻硕招生人数及学费
- 初三新编英语教材下册
- 公司庆中秋、迎国庆联欢会客串词
- 向区委常委会汇报安全生产工作材料
- 2006年GCT英语模拟试题(三)及答案解析
- 经济法概念的早期使用
- 我爱做家务课堂教学设计
- 学校安全工作月报表、消防安全排查表、消防隐患排查台账
- 成本会计毕业论文
- 班级文化建设论文
- 2018年天津市高考文科试题与答案汇总(Word版) - 图文
- 铁路论文
- 2017年嵌入式系统设计师考试时间及地点
- 1.111--灾害与突发公共卫生事件应急预案
- 起爆点主图 注意买入 拉升 逃顶源码指标通达信指标公式源码
- 华南理工大学
- C++
- 网络教育
- 程序设计
- 平时
- 作业
- 高级
- 语言
- 2017
- 2017-2018学年下学期期末复习备考高二化学黄金30题含解析专题三 - 图文
- xx镇乡村医生年终考核实施方案
- 2015年中国土壤修复行业发展现状及市场前景预测
- 中国工业排名世界第一的前20个项目
- 初二光学部分物理考试试题
- 《水文地质学基础》实验实习 - 图文
- 对外汉语教学中媒介语使用的调研报告
- 钱乘旦《在传统与变革之间》读书笔记
- 骆驼祥子阅读题及答案
- 三国法学习笔记
- 合同法新旧建设工程示范文本区别
- 审计专业十三五建设规划
- 科学人教版五年级下册 五年级科学下第三单元
- 凝固点降低法测定物质的相对分子质量实验报告
- 练功比武复习题
- 最是书香能致远(定稿)教师讲稿
- 五星级酒店客房设施及配套规范标准
- 2011-2012.1.《离散数学上》试卷B卷
- 呼吸护理病历-肺炎
- 浙江省2004年10月高等教育自学考试 药剂学试题 课程代码03029