<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0048)http://www.icst.pku.edu.cn/CompCourse/exer1.html -->
<HTML><HEAD><TITLE>第一次作业</TITLE>
<META content=en-us http-equiv=Content-Language>
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<STYLE>H2 {
FONT-FAMILY: Arial; FONT-SIZE: 16pt; LINE-HEIGHT: 173%; MARGIN: 13pt 0cm; TEXT-ALIGN: justify; TEXT-JUSTIFY: inter-ideograph
}
H3 {
FONT-FAMILY: "Times New Roman"; FONT-SIZE: 16pt; LINE-HEIGHT: 173%; MARGIN: 13pt 0cm; TEXT-ALIGN: justify; TEXT-JUSTIFY: inter-ideograph
}
P.MsoNormal {
FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify; TEXT-JUSTIFY: inter-ideograph; mso-style-parent: ""
}
</STYLE>
</HEAD>
<BODY>
<H2 align=center style="TEXT-ALIGN: center"><SPAN
style="FONT-FAMILY: 黑体">第一次作业</SPAN></H2>
<H3><SPAN style="FONT-FAMILY: 宋体">作业要求:</SPAN></H3>
<P align=left class=MsoNormal style="TEXT-ALIGN: left"><SPAN lang=EN-US
style="FONT-SIZE: 14pt">1. </SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">请选课的同学每人从两个练习中挑选一个</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 14pt">2. 10</SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">月底之前交给梅铮: </SPAN><SPAN lang=EN-US
style="FONT-SIZE: 14pt"><A
href="mailto:kevinmei@pku.edu.cn">kevinmei@pku.edu.cn</A></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 14pt">3. </SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">提交内容:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 42pt; TEXT-INDENT: -21pt"><SPAN
lang=EN-US style="FONT-FAMILY: Wingdings; FONT-SIZE: 12pt">n<SPAN
style="FONT-FAMILY: Times New Roman; FONT-SIZE: 7pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal">
</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体">练习的代码以及有关的文件,要保证作业老师能够重新生成可执行代码。</SPAN><SPAN
lang=EN-US>(</SPAN><SPAN style="FONT-FAMILY: 宋体">打成一个</SPAN><SPAN
lang=EN-US>zip</SPAN><SPAN style="FONT-FAMILY: 宋体">包</SPAN><SPAN
lang=EN-US>)</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 42pt; TEXT-INDENT: -21pt"><SPAN
lang=EN-US style="FONT-FAMILY: Wingdings">n<SPAN
style="FONT-FAMILY: Times New Roman; FONT-SIZE: 7pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal">
</SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">完整的练习报告。注意,请提交电子文档。</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 14pt">4. </SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">如有不清楚的地方,请通过</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 14pt">email</SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">联系</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US> </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 14pt">5.</SPAN><SPAN
lang=EN-US> </SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 13.5pt">实验报告样本文件下载:</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 13.5pt"><A
href="http://www.icst.pku.edu.cn/CompCourse/report-temp.doc">report-temp.doc</A></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 13.5pt">6. </SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 13.5pt">这次作业占总成绩的</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 13.5pt">10%</SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 13.5pt">。</SPAN></P>
<P class=MsoNormal><span style="font-family: 宋体; font-size: 13.5pt">7.不允许使用MFC或ATL。</span></P>
<P class=MsoNormal><SPAN lang=EN-US> </SPAN></P>
<H3><SPAN style="FONT-FAMILY: 宋体">练习</SPAN><SPAN lang=EN-US>1</SPAN></H3>
<P align=left class=MsoNormal style="TEXT-ALIGN: left; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">题目:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体">实现任意数制间的转换,数制表达形式自定</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">要求:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体">做成一个进程内</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN
style="FONT-FAMILY: 宋体">组件,客户通过自定义接口调用其功能</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">提交:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体">组件程序所有代码,以及测试用的客户代码</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">注意:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体">自己用</SPAN><SPAN lang=EN-US>C++</SPAN><SPAN
style="FONT-FAMILY: 宋体">定义</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN
style="FONT-FAMILY: 宋体">接口并实现接口。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">要点:实现自定义的</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 14pt">COM</SPAN><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">接口</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><span style="font-family: 宋体; font-size: 14pt">提示:</span>实现的接口包括一个函数,实现任意进制之间的转换,要求自己定义数据表示格式。</P>
<P class=MsoNormal style="TEXT-INDENT: 21pt">
比如说:字符串——“2R100010101”表示2进制数100010101</P>
<P class=MsoNormal style="TEXT-INDENT: 21pt">
——“16R5E6”表示16进制数5E6</P>
<P class=MsoNormal style="TEXT-INDENT: 21pt">
——“100R36,43,5”表示100进制数36,43,5(即十进制数364305)</P>
<P class=MsoNormal style="TEXT-INDENT: 21pt">
转换方法是:把十进制数当成中间数据(是否有更好的方法?)。</P>
<P class=MsoNormal style="TEXT-INDENT: 21pt">
当然还需考虑到小数的情况。</P>
<P class=MsoNormal><SPAN lang=EN-US> </SPAN></P>
<H3><SPAN style="FONT-FAMILY: 宋体">练习</SPAN><SPAN lang=EN-US>2</SPAN></H3>
<P align=left class=MsoNormal style="TEXT-ALIGN: left; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">题目:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体">实现</SPAN><SPAN lang=EN-US>1950</SPAN><SPAN
style="FONT-FAMILY: 宋体">-</SPAN><SPAN lang=EN-US>2050</SPAN><SPAN
style="FONT-FAMILY: 宋体">年间公历与农历的相互转换</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">要求:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体">做成一个进程内</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN
style="FONT-FAMILY: 宋体">组件,客户通过自定义接口调用其功能</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体; FONT-SIZE: 14pt">提交:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: 21pt"><SPAN
style="FONT-FAMILY: 宋体">组件程序所有代码,以及测试用的客户代码</SPAN></P>
<P class=MsoNormal style="TEXT-IN