http:^^www.cs.wisc.edu^~tick^cs110^program1.html
来自「This data set contains WWW-pages collect」· HTML 代码 · 共 95 行
HTML
95 行
Date: Mon, 11 Nov 1996 17:18:46 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Mon, 11 Nov 1996 17:14:43 GMTContent-length: 4572<HTML><HEAD><TITLE>CS 110 Sections 1&2 - Program 1</TITLE></HEAD><BODY><H2><!WA0><!WA0><!WA0><A HREF="http://www.cs.wisc.edu/~tick/cs110.html#assignments" ><!WA1><!WA1><!WA1><IMG SRC="http://www.cs.wisc.edu/~tick/icons/arrowleft.gif" WIDTH=15 HEIGHT=15></A> Program1</H2><HR><H3>Time's Fun When You're Having Flies - Kermit the Frog</H3><DL><DT>Due Date:<DD>Wednesday 11/13/96, 5:00 pm<P><DT>Grade:<DD>25% of your final grade.<P><DT>Text Covered:<DD>Chp. 2,3<P><DT>Problem Description:<DD>For the first program, you're going to write a clock. It'll have the following features:<UL><P><LI>It will ask for the current time; first the hour, then the minute.<LI>Then it will ask how much time is going to pass (again, first number ofhours, then number of minutes).<LI>It will then add the two and print out the new time.</UL><P>This is not simply a case of addition, because you need to keep in mind the following rules for clocks:<UL><P><LI>Clock Hours (both initial and final) is always a number between 1 and 12<LI>Clock Minutes (both initial and final) is always a number between 0 and 59<LI>Add Hours is always a number between 0 and 12<LI>Add Minutes is always a number between 0 and 59</UL><P>So you're going to have to handle<UL><P><LI>Printing an error if you enter an invalid # of hours or minutes<LI>Rollover (if # of minutes > 59 or # of hrs > 12 due to addition...need to figure out when to carry).</UL><P>Try doing out some examples on paper before you start writing the program. It will help you quite a bit. Give yourself some sample times and notice how to solve them. Hint: The MOD statement may help you.<P>Program things in steps. First, program in just reading both sets of hours and minutes. Once you've complied and run that program, and it runs fine, then go on to the next step; Write the lines that deal with reporting an error if you enter a bad number of hours. Once that's working okay, then write the code for adding the hours and printing out the response.<P> <DT>What to Hand In: <DD>Hand in your assignment online by copying your FORTRAN <EM>source code</EM> file "program1.for" and the <EM>compiled executable</EM> file "program1.exe" to your handin directory.<P> Your files are timestamped with the current time when you copy them to your handin directory. This will be used to check they were handed in on time or whether late day penalties apply. <STRONG>Important</STRONG> - Make sure you copy the correct versions of your program files because these are what will be graded.<P> You also have to hand in a printed copy of your FORTRAN <EM>source code</EM> file. <DT>Gradesheet: <DD>The following gradesheet will be used to grade this assignment. Please take a close look at it to make sure you do everything that is required. Note that you will be graded on correct output for the input values given below, so before handing it in you <STRONG>must</STRONG> run your program with these values and manually check that your program gives the correct results in every case.<P> <PRE>Correct Output [18] time = 10 hr, 20 min, add 1 hr, 5 min [3] time = 9 hr, 7 min, add 4 hr, 6 min [3] time = 8 hr, 27 min, add 2 hr, 47 min [3] time = 11 hr, 47 min, add 1 hr, 17 min [3] time = 12 hr, 59 min, add 12hr, 59 min [3] time = 12 hr, 18 min, add 1 hr, 65 min [3]User Interface [8] Useful prompts for inputting times [4] Meaningful display of final time [4]Implementation [18] Correct implementation of formulas [7] Correct use of FORTRAN statements [7] Meaningful variable names [2] Indenting and neatness [2]Documentation [6] Program description [3] Variable definitions and section comments [3]____________________________________________________________________Total (25%) [50] </PRE></DL></BODY><HR><ADDRESS><H5>Copyright © 1996 <!WA2><!WA2><!WA2><A HREF="http://www.cs.wisc.edu/~tick/tick.html">Jeff Lampert</A> (<!WA3><!WA3><!WA3><A HREF="mailto:tick@cs.wisc.edu">tick@cs.wisc.edu</A>). Last modified November 4, 1996.</H5></ADDRESS></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?