📄 http:^^athos.rutgers.edu^dcs_library^111^procedures.html
字号:
Date: Tue, 14 Jan 1997 20:02:28 GMT
Server: NCSA/1.5.2
Last-modified: Thu, 01 Feb 1996 16:05:16 GMT
Content-type: text/html
Content-length: 2589
<html><head><title>CS111 Spring 96 Procedures Project</title></head><body><h1>CS111 Spring 96</h1><h2>Procedures Project</h2><h3>Due L7</h3><h3>By Louis Steinberg</h3>The purpose of this assignment is apply what you have learned aboutprocedures and parameters to the task of actually writing a program.The actual computations will be trivial - the point is to use a good,modular structure of procedures, and to use parameters properly tocommunicate data to and from the procedures.<p>Suppose we have two people (call them Player 1 and Player 2), who haveplayed several games of tic tac toe. They have kept track of how manygames each player won, and now they want to compute what percent ofthe games they each won. To make things very simple, we will assumethat none of the games ended in a tie - that is, one or the otherplayer won each time.<p>Write a program that reads the number of games each player won, andprints the percentage each won. For instance, a run of the programmight look like this:<p><pre> COMPUTE PERCENTAGE OF WINS How many games did player 1 win? 4 How many games did player 2 win? 8 Player 1 won 33.3333 % of the games. Player 2 won 66.6666 % of the games.</pre><p>The numbers 4 and 8 were typed by the person using the program, and therest was printed on the screen by the program.<p><b>Hints:</b><p><ul><li>Your program does not have to space things exactly this way - e.g. yourprogram might print<pre> How many games did player 1 win?</pre><li>Your program may print more or less digits for the percentages, e.g.it may print 66.66 or 66.666666.<li>Since there are no ties, the total number of games is just the sumof the number of games player 1 won and the number player 2 won.<li>Make your program as modular as the program on pages 132-133 of thetextbook. Your main program should consist of nothing but commentsand procedure calls. Also, when your program does essentially thesame piece of computation or printing more than once, use a procedureor function to do the work instead of duplicating the statements thatdo that computation or printing.</ul><p>Hand in a printout of your program, and a printout of a run of yourprogram.<p><b>**** YOU MUST PUT YOUR NAME, SECTION NUMBER, ID NUMBER, AND TA'S NAME IN A COMMENT AT THE BEGINNING OF YOUR PROGRAM ****</b><br>E.g:<p><pre> Program ProcedureProject (input, output); { Bobby Jones } { 1234-56-78} { Section 16 } { TA: J. Smith}</pre><p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -