已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
include stdio h include stdlib h include string h include f2 h include f3 h include f4 h include f5 h define max len 100 int an1 max len 10 0 int an2 max len 10 0 int result max len 10 0 char str1 max len 10 char str2 max len 10 void main int flag 1 printf n printf 1 求和 n printf 2 求差 n printf 3 求积 n printf 4 求商 n printf 5 退出 n printf n while flag 0 printf nPlease input your choice scanf d switch flag default printf The num is not correct please input again n break case 1 add an1 an2 break case 2 jian an1 an2 break case 3 mul an1 an2 break case 4 div an1 an2 break case 5 exit 0 include f2 h include stdio h include stdlib h include string h define max len 100 int add int an1 int an2 char str1 max len 10 char str2 max len 10 scanf s str1 scanf s str2 int i j 存储的字符串整数转换到 an1 中去 j 0 for i strlen str1 1 i 0 i an1 j str1 i 0 j 0 for i strlen str2 1 i 0 i an2 j str2 i 0 for i 0 i 10 看是否进位 an1 i 10 an1 i 1 进位 bool bStartOutput false 跳过多余的零 for i max len i 0 i if bStartOutput printf d an1 i 多余零都跳过则退出 else if an1 i printf The sum is d n an1 i bStartOutput true for j 0 j max len 10 j an1 j 0 an2 j 0 return 0 include f3 h include stdio h include stdlib h include string h define max len 100 int jian int an1 int an2 char str1 max len 10 char str2 max len 10 int i j scanf s str1 scanf s str2 for i 0 i 0 i an1 j str1 i 0 int nlen2 strlen str2 j 0 for i nlen2 1 i 0 i an2 j str2 i 0 for i 0 i max len i if an1 i 0 i if bStartOutput printf d an1 i 多余零都跳过则输出 else if an1 i printf The result is d n an1 i bStartOutput true for i 0 i 0 i an1 j str1 i 0 int nlen2 strlen str2 j 0 for i nlen2 1 i 0 i an2 j str2 i 0 for i 0 i nlen2 i for j 0 j nlen1 j result i j an2 i an1 j for i 0 i 10 result i 1 result i 10 result i 10 bool bStartOutput false 跳过多余的零 for i max len i 0 i if bStartOutput printf d result i 多余零都跳过则退出 else if result i printf The result is d n result i bStartOutput true for j 0 j 0 bool bStartOutput false 跳过多余的零 for i max len i 0 i if bStartOutput printf d result i 多余零都跳过则退出 else if result i printf The result is d n result i bStartOutput true for j 0 j 0 i an1 j str1 i 0 int nlen2 strlen str2 j 0 for i nlen2 1 i 0 i an2 j str2 i 0 if nlen1 nlen2 printf 0 n nlen1 sub an1 an2 nlen1 nlen2 if nlen1 0 bool bStartOutput false 跳过多余的零 for i max len i 0 i if bStartOutput printf d result i 多余零都跳过则退出 else if result i printf The result is d n result i bStartOutput true for j 0 j max len 10 j an1 j 0 an2 j 0 return 0 int sub int p1 int p2 int nlen1 int nlen2 返回值代表的是结果长度 不够减返回 1 刚好减完返回 0 int i if nlen1 0 i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年中考语文一轮复习:统编教材文言文背诵27篇 常考必背知识点汇编
- 医学生基础医学 骨质疏松护理课件
- Unit 3 Weather(单元测试提升卷)-2025人教精通版四年级英语上册
- Unit 2 重点词汇、词性转换、词义辨析及重难点句型梳理-人教版八年级英语上册
- 医学脑机接口诊疗环境场景切换案例教学课件
- 2026年深圳中考数学专项复习 解答中档题型:圆的计算与证明(原卷+解析版)
- 2026年人教版九年级数学上册复习:垂径定理的四类综合题型(压轴题专项训练)原卷版+解析
- TXJBX0097-2025农产品质量安全区块链追溯技术规范
- 第三方支付发展对我国商业银行业务的挑战分析-以支付宝对例
- 《JBT 6367-1992 保护拖链 型式尺寸》(2026年)实施指南
- 国家食源性疾病监测工作手册模板
- 8D报告样板优秀课件
- 急诊医学PPT课件急性意识障碍
- SB/T 11082-2014单用途商业预付卡发卡企业信用评价标准
- GB/T 19188-2003天然生胶和合成生胶贮存指南
- 10000中国普通人名大全
- 部编版语文九年级上册第五单元写作《论证要合理》课件
- 景物描写穿插在记叙文中课件
- 齐鲁工业大学-大学物理(下)期末复习总结
- GA∕T 1780-2021 多道心理测试实验室建设规范
- 陶瓷太阳能集热板
评论
0/150
提交评论