⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http:^^www.cs.wisc.edu^~milo^cs302^program5.html

📁 This data set contains WWW-pages collected from computer science departments of various universities
💻 HTML
字号:
Date: Mon, 11 Nov 1996 17:13:01 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Mon, 21 Oct 1996 16:16:23 GMTContent-length: 5325<HTML><HEAD><TITLE>Program 5 - CS 302 Fall 1996 - Section 4</TITLE></HEAD><BODY><H1 ALIGN=CENTER>  <!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><A HREF="http://www.cs.wisc.edu/~cs302">CS 302</A>  Fall 1996 - <!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><A HREF="http://www.cs.wisc.edu/~milo/cs302.html">Section 4</A></H1> <H2 ALIGN=CENTER>Algebraic Language Programming in C++</H2><H4 ALIGN=CENTER>Instructor:   <!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><A HREF="http://www.cs.wisc.edu/~milo">Milo M. Martin</A>   (milo@cs.wisc.edu)</H4><hr><br><H1 ALIGN=CENTER>Program 5</H1><H3 ALIGN=CENTER>Due Wednesday, October 30, 1996</H3> <hr><br><b>Objective</B>: Give the student practice with <tt>switch</tt>statements and <tt>for</tt> loops.<P><H3>Program Description</H3><P>You've been asked by a group of school teachers to help their geometryclasses learn shapes.  They want to reinforce the ideas of differentshapes to their students.  To accomplish this, they would like aprogram that displays a number of different shapes and that allows thestudents to enter the size of the shape as well.  Each shape is to beprinted to the screen using '*' characters, and should be completelyfilled in.  Listed below is a description of how they would like theprogram to run, as well as some examples of the different shapes.  <P>Your program should have two layers of menus, all implemented with a<tt>switch</tt> statement.  The <strong>main menu</strong> consists ofa request for either a 4-sided shape menu, a 3-sided shape menu, or toquit.  The second layer of menus consists of the two separate shapemenus.  <P>      The <strong>4-sided shape menu</strong> should present 5 choices: drawone of four 4-sided shapes (square, rectangle, parallelogram, diamond)or to return back to the main menu.<UL> <LI>A square is a 4-sided shape that has a height the same lengthas its width with right angles between adjacent sides.<LI>A rectangle is a 4-sided shape that may have different lengths forthe height and width, but still has right angles between adjacentsides.<LI>A parallelogram is a 4-sided shape with opposite sides paralleland of equal length.  For this assignment, we are assuming that therequested parallelograms have angles of 45 and 135 degrees only.<LI>A diamond is represented as a 4-sided shape with each side equalin length with the corners pointing up/down and left/right.</UL><P>The following are examples of the four 4-sided shapes:<PRE>*****      *******          ********        ******      *******         ********        ********      *******        ********        **********      *******       ********          ********      *******      ********            *</PRE>Each shape is respectively, a square with sides of length 5, arectangle with sides of height 5 and width 7, a parallelogram withheight 5 and width 8, and a diamond with sides of length 3.  <P>After a shape is selected, your program should request for the lengthsof the shapes sides.  Note that some shapes require only one length(square and diamond) and others require two lengths.  <P>The <strong>3-sided shape menu</strong> should present 5 choices: drawone of four 3-sided shapes (all of which are right isoscelestriangles) or to return back to the main menu.<UL><LI>A right isosceles triangle has two sides of equal length joined at a right angle.</UL>The following are examples of the four 3-sided shapes:<PRE>    *      *          *****      *****   **      **         ****        ****  ***      ***        ***          *** ****      ****       **            *******      *****      *              *</PRE>Notice that these are examples of the four types of triangles eachwith sides of length 5.  In addition, we can name the types by wherethe right angle is in relation to the triangle.  Above we havelower-right, lower-left, upper-left, and upper-right triangles,respectively.  <P>After a shape is selected, your program should request the length ofthe triangle's sides.  Note that the length is that belonging to thesides of equal length, so only one length is needed.  <P>The drawing of all shapes (3 and 4-sided) should be implemented using<tt>for</tt> loops. Each of the eight shapes should have acorresponding function (e.g. <tt>void draw_diamond(int length);</tt>.)  However, the body of a function may include a call to anotherfunction; you might want to consider doing this for similar shapes.<P>Once the shape has been drawn, the program should remain at thecurrent shape menu, for requesting of additional shapes.  <P>The following error checks <U>must</U> be implemented to receive full credit:<UL><LI>Any improper responses during menu selection should result in the user being notified and the menu being presented again.<LI>Valid lengths for all shapes are integer values between 1 and 15 inclusive.</UL><H3>What To Turn In</H3>Once you have your program working you should:<OL><LI>Print out a copy of each of the eight possible shapes.<LI>Print out a copy of your C++ source code.  <LI>Submit an electronic copy of your source code andexecutable as described in the project 1 directions.</OL><P><hr><address>Created by   <!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><A HREF="http://www.cs.wisc.edu/~burnett/burnett.html">Dave Eggleston</A>,  Rob Muenzenberger, and  <!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><A HREF="http://www.cs.wisc.edu/~msteele/msteele.html">Mike Steele</A>.</Address></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -