Presentation is loading. Please wait.

Presentation is loading. Please wait.

C++ Programming HW14 Speaker : Ching-Chen Chang Date: 2008/05/23.

Similar presentations


Presentation on theme: "C++ Programming HW14 Speaker : Ching-Chen Chang Date: 2008/05/23."— Presentation transcript:

1 C++ Programming HW14 Speaker : Ching-Chen Chang Date: 2008/05/23

2 Assignment 1 Write an SDI application which draws rectangles with different hatching styles as follows. You should use a for-loop to draw the rectangles.

3 Assignment 1 (Cont.)

4 In WinDGI.h /* Hatch Styles */ #define HS_HORIZONTAL 0 /* ----- */ #define HS_VERTICAL 1 /* ||||| */ #define HS_FDIAGONAL 2 /* \\\\\ */ #define HS_BDIAGONAL 3 /* ///// */ #define HS_CROSS 4 /* +++++ */ #define HS_DIAGCROSS 5 /* xxxxx */

5 Assignment 2 Each dice has face values 1, 2, 3, 4, 5, 6 and the probability that face with value 1 will be on top is 1/6. Assume the probability of each value to be on top is the same. When you throw two dices, the summation of the top two faces will be within the range (inclusive) 2..12. But their probability is not equally likely or 1/12. The probability that the sum will be two is 1/36, but the probability that some will be three is 2/36 and so on.

6 Assignment 2 (Cont.) Let N denote the number of throws. Write an SDI application to simulate the occurrence of each value within the range 2..12 when N = 100. Store the occurrence of all values in an integer array, and draw a bar chart showing their heights which is proportional to the number of their occurrence. The usage of random number generator was introduced in HW 9 in last semester.HW 9 A sample output is shown as below. You may click the "New Document" button in the toolbar to generate new simulation.

7 Assignment 2 (Cont.)

8 Note Deadline:2008/5/23 10:00 AM Upload to the following link  http://ms11.voip.edu.tw/cs102/ http://ms11.voip.edu.tw/cs102/ Project Name  e.g. HW14_91234567 Compress the folder to a ZIP or RAR file

9 Demo 94321014, 94321018, 94321019, 94321021, 94321022, 94321024, 94321027, 94321028, 94321032, 94321036, 94321037, 94321042 Demonstrate their programs to Prof. Wu.


Download ppt "C++ Programming HW14 Speaker : Ching-Chen Chang Date: 2008/05/23."

Similar presentations


Ads by Google