- 1、本文档共65页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
acmLearn程序填空练习题答案atmaster·jindongwangacmLearn
Skip to content
Features Business Explore Marketplace Pricing
This repository
Sign in orSign up
· Watch 1
· Star 3
· Fork 3
jindongwang/acmLearn
Code Issues0 Pull requests0 Projects 0
Pulse Graphs
Permalink
Switch branches/tags
· Branches
· Tags
master
Nothing to show
Nothing to show
Find file
acmLearn/练习题/程序填空练习题答案.doc
Fetching contributors…
Cannot retrieve contributors at this time
Raw Blame History
executable file2292 lines (2283 sloc) 61.8 KB
【编写程序题参考答案】
【4.1】参考答案:
#include stdio.h
main( )
{ int year;
float money,rate,total; /* money:本金 rate:月利率 total:本利合计*/
printf(Input money and year =?);
scanf(%f%d, money, year); /* 输入本金和存款年限 */
if(year==1) rate=0.00315; /* 根据年限确定利率 */
else if(year==2) rate=0.00330;
else if(year==3) rate=0.00345;
else if(year==5) rate=0.00375;
else if(year==8) rate=0.00420;
else rate=0.0;
total=money + money * rate * 12 * year; /* 计算到期的本利合计 */
printf( Total = %.2f\n, total);
}
【4.2】参考答案:
#include stdio.h
main( )
{ int year, month, days;
printf(Enter year and month:);
scanf(%d%d, year, month);
switch (month)
{ case 1: case 3: case 5: case 7: case 8: case 10: case 12:
days=31; break; /* 处理大月 */
case 4: case 6: case 9: case 11:
days=30; break; /* 处理小月 */
case 2: if(year%4==0year%100!=0 || year%400==0)
days=29; /* 处理闰年平月 */
else days=28; /* 处理不是闰年平月 */
break;
default: printf(Input error!\n); /* 月份错误 */
days=0;
}
if( days!=0 )
printf(%d, %d is %d days\n, year, month, days);
}
【4.3】参考答案:
#include stdio.h
main ( )
{ float data1, data2; /* 定义两个操作数变量 */
char op; /* 操作符 */
printf(Enter your expression:);
scanf(%f%c%f, data1, op, data2); /* 输入表达式 */
switch(op) /* 根据操作符分别进行处理 */
{ case + : /* 处理加法 */
printf(%.2f+%.2f=%.2f\n, data1, data2, data1+data2); break;
case - : /* 处理减法 */
printf(%.2f-%.2f=%.2f\n, data1, data2, data1-data2); break;
case * : /* 处理乘法 */
printf(%.2f*%.2f=%.2f\n, data1, data2, data1*data2); break;
case / : /* 处理除法 */
if( data2==0 ) /* 若除数为0 */
print
您可能关注的文档
- 3品种鸡蛋外在品质及营养价值的对比分析 - 江苏农业科学.PDF
- 3.4辨别物质的元素组成教案教学.DOC
- 4 2 汽油机进气控制系统及检修 - 发动机电控技术 - 湖北职业技术学院.PPT
- 4 平衡辐射(光子气体).PPT
- 4-1组合逻辑电路1.ppt
- 4-2 有一弹簧振子,振幅为4 ,周期为5 ,将振子经过平衡位置且向正 .DOC
- 4-上舵承座.ppt
- 4 月汇丰中国服务业PMI 增速创20 个月来最低鲁信创投子公司再减持 .PDF
- 4-霉-萧山三中.doc
- 4.1分子荧光及磷光分析一.ppt
- 2025届江西省南昌一中物理高一第一学期期末质量检测模拟试题含解析.doc
- 山东省沂源县二中2025届高三物理第一学期期末检测试题含解析.doc
- 2025届青海省西宁市大通回族土族自治县物理高二第一学期期末联考模拟试题含解析.doc
- 四川省成都市达标名校2025届高三物理第一学期期中综合测试模拟试题含解析.doc
- 海南省重点名校2025届物理高一第一学期期末联考模拟试题含解析.doc
- 福建省龙岩市漳平第一中学2025届高三物理第一学期期中综合测试模拟试题含解析.doc
- 2025届上海市实验中学物理高二第一学期期末质量检测模拟试题含解析.doc
- 2025届四川省绵阳市三台县三台中学实验学校物理高二上期末质量跟踪监视模拟试题含解析.doc
- 2025届湖南师大附中思沁中学物理高二第一学期期中学业质量监测模拟试题含解析.doc
- 2025届山东省安丘市第二中学物理高二第一学期期中质量跟踪监视模拟试题含解析.doc
文档评论(0)