- 18
- 0
- 约2.07万字
- 约 56页
- 2019-12-08 发布于广东
- 举报
* * * * * * * * * #include iostream.h void main() { double p,t,sum_e; int i = 1; p = 1; sum_e = 1; do { p=p*i; // 计算i的阶乘 t=1/ p; sum_e=sum_e+t; i = i + 1; //为计算下一项作准备 }while(t0.00001); coutsum_eendl; } * #include iostream.h #include math.h #includeiomanip.h #include stdlib.h void main() { int max, min,x; x=rand()%101+100; //产生一个[100, 200]之间的随机数x coutsetw(4)x; max = x; min =x; // 设定最大数和最小数 for(int i=1;i10;i++) { x=rand()%101+100; //再产生一个[100, 200]之间的随机数x coutsetw(4)x; if(x max)max = x; // 若新产生的随机数大于最大数,则进行替换 if(x min)min = x; // 若新产生的随机数小于最小数,则进行替换 } coutendl最大数:max,最小数:minendl; //输出最大和最小数 } * #include iostream.h #include math.h #includeiomanip.h void main() { int x,y,z; for(x=0;x=100;x++) //可优化为x=19 for(y=0 ;y100;y++)// 可优化为y=33 { z=100-x-y; if(5*x+3*y+z/3.0==100) coutsetw(5)xsetw(5)ysetw(5)zendl; } } * * #include iostream.h void main() { int score; cout 请输入成绩; cin score; if (score = 90) cout 优 endl; else if( (score = 80) (score 90) ) cout 良 endl; else if( (score = 70) (score 80) ) cout 中 endl; else if( (score = 60) (score 70) ) cout 及格 endl; else cout 不及格 endl; } * #include iostream.h void main( ) { char ch; cinch; ch=(ch=A ch=Z)?(ch+32):ch; //判别ch是否大写字母,是则转换 coutchendl; } * #includeiostream.h void main() { int score; int a; coutInput score(0~100):; cinscore; a=score/10; switch(a) { case 10: case 9: cout 优 endl; break; case 8: cout 良 endl; break; case 7: cout 中 endl; break; case 6: cout 及格 endl; break; default: cout不及格 endl; } } * #include iostream.h void main( ) { int i=1,sum=0; while (i=100) { sum=sum+i; i++; } coutsum=sumendl; } * * * * * * * * * * #include iostream.h void main() { double p,t,sum_e; int i = 1; p = 1; sum_e = 1; do { p=p*i; // 计算i的阶乘 t=1/ p; sum_e=sum_e+t; i = i + 1;
您可能关注的文档
- 《自动控制理论》.ppt
- 第6章压电式的传感器.ppt
- 3S技术应用集成教案——第五章3S集成基本原理.ppt
- 微波技术应用第七章微波测量.ppt
- 高三物理一轮复习机械能.ppt
- 墙柱面天棚油漆涂料.ppt
- 计量学ARMA模型自相关函数.ppt
- ArcGIS地理信息系统大全第5章设置AutoCAD属性数据.ppt
- CE认证资料EN标准解读培训.ppt
- 指针,引用与动态内存分配.ppt
- 河北盐山中学等校2025-2026学年上学期高三一模化学试卷(含解析).docx
- 河北正定中学2025-2026学年高一上学期期末考试物理试卷(含解析).docx
- 河北张家口市怀安县2025-2026学年第一学期期末教学综合评价八年级地理试卷(含解析).docx
- 河南安阳市殷都区2025-2026学年第一学期期末教学质量检测七年级地理试卷(含解析).docx
- 河南安阳市滑县2025一2026学年第一学期期末学业质量监测八年级地理试题(含解析).docx
- 河南安阳市林州市2025-2026学年上学期期末考试高一政治试题(含解析).docx
- 河南焦作市武陟县第一中学2025-2026学年高一上学期1月月考语文试卷(含解析).docx
- 河南济源市2025-2026学年上学期期末学业质量调研七年级历史试卷(含解析).docx
- PICC导管并发症的紧急处理与护理.pptx
- 河南鹤壁市2025-2026学年高二上学期期末考试生物试题(含解析).docx
最近下载
- 2026中国饮用水源保护与瓶装水品质关联研究.docx
- 2025+ESICM临床实践指南:成人危重患者的液体治疗+—+第3部分:降阶梯治疗阶段的液体清除解读课件.pptx
- 07CJ03-1:轻钢龙骨石膏板隔墙、吊顶(参考图集).pdf VIP
- 2023年湖北高考政治试卷真题及答案详解(精校版).pdf VIP
- 财务管理学,第三版,张功富,教材配套练习题(附答案)!.pdf VIP
- GB50877-2014 防火卷帘、防火门、防火窗施工及收规范.docx VIP
- 《匹克球运动 场地通用要求及检验方法》.pdf VIP
- 《液压与气压传动 第5版》课后习题答案.docx VIP
- 2025年高中信息技术必修一全册知识点归纳总结(数据与计算).pdf VIP
- 超星尔雅学习通《人人都能上手的AI工具(超星公司)》章节测试答案.docx VIP
原创力文档

文档评论(0)