辅导EEE101留学生、讲解C/C++编程、辅导modular program、讲解C/C++语言

- 首页 >> C/C++编程

EEE101 C Programming and Software Engineering 1 – ASSESSMENT 2

Assessment Number 2

Contribution to Overall Marks 15%

Issue Date Monday, 22nd October, 2018 (Week 6)

Submission Deadline Monday, 5th November, 2018 at 09:00 (9am) (Week 8)

Assessment Overview

This assessment aims at testing some basic concepts of C programming in particular the use

of functions to produce basic modular program structures. It also reinforces the routine of

code development using the software development process (SDP) presented in Lecture 1 and

followed in Assessment 1. The five steps of the software development process you need to

follow are:

1. Problem statement: formulate the problem.

2. Analysis: determine the inputs, outputs, variables, etc

3. Design: define the list of steps (the algorithm) needed to solve the problem.

4. Implementation: the C code has to be submitted as a separate file. Just indicate here the

name of the file.

5. Testing: explain how you have tested and verified your C program.

Exercise

Write a C Program that will allow you to play a user determined number of games of rock,

scissors, paper (石头, 剪刀, 布) against the computer. The game should ask for the players

name. The game should draw pictures of the rock the paper and the scissors to show what the

player and computer have selected. After the chosen number of games have been played, the

program should determine who won or if it was a draw and output the information on the

screen. The printing of each output selection and the generation of the computers selection

should each be carried out in separate functions (not in function main()). The final win lose or

draw result for the match can be determined and printed from either main() or another

function.

Advice

This may initially appear very difficult, it is suggested that you first write down the steps that

the program needs to perform and in what order (sequence). You may find it helpful to

produce a flow chart and then think about how to do each part e.g:

Introduce the game

Ask for and obtain the players name

Ask for the number of games to be played

Ask for the players selection of rock paper or scissors

Generate the computers selection

Draw and state the selections on the screen then determine the winner or if it is a draw

…and so on

Consider that to repeat the game process for the number of games required you should use a

loop. Produce the program one step at a time e.g. firstly for a single game, then work out how

to create the loop. Work out how to display (draw) the outputs on the screen.

To make the screen pause for a number of milliseconds you can use the function Sleep();

where the should be a number in milliseconds (e.g. Sleep(3000) would pause the system

for 3 seconds). This function can be found in the windows.h header file. Alternatively, if you

would like to make the system wait till the user presses a key you can use system(“pause”);.

This function can be found in the stdlib.h header file.

Also, if you would like to clear anything that has been printed in the output window you can

use the function system(“cls”);. This function can be found in the stdlib.h header file

Example Code

To help you get started, a program for a guessing game is provided together with this

assessment, see character_game.c. The game involves two players choosing a secret character

and then the players taking turns to guess each other’s character. Note that this is only to offer

you ideas for writing your own program. You should not try to adapt the code to produce

your work, this would be more difficult than writing your own.

What should be submitted?

You should submit the followings:

1) A short report (up to a few pages of text) detailing:

a) SDP steps 1 to 3 in the report (Report + Specification + Analysis + Algorithm Design)

(40%)

b) SDP step 4 (Implementation(35%) + Robustness(5%)): your C source code including

the comments. (40%). Do not paste the code into your report.

c) SDP step 5 in the report (testing): you will explain your testing methodology

including: what you wanted to test, how you have tested it and the outcome of your

tests. (20%). Note: you do not need to include screenshots of results.

Please refer to the file “EEE101 Marking Guidelines Assignment 2” on ICE for a

detailed marking scheme.

2) The report in Microsoft Word or pdf format and C source code of your implementation

should be zipped into a single file, i.e. the zip file will contain 2 files, one document and

one source code. (It is a good practice to include comments in your code stating the aim

of the program, what are the inputs, what are the outputs, which algorithm is used, who is

the author and so on.)

The naming of Report (.docx or .pdf), Source Code (.c) and Compressed file (.zip or .rar)

StudentID_LastName_FirstName_AssignmentNumber.docx or .pdf

StudentID_ AssignmentNumber.c

StudentID_LastName_FirstName_AssignmentNumber.zip or .rar

For example

123456789_Einstein_Albert_2.docx

123456789_2.c

Zipped together into:

123456789_Einstein_Albert_2.zip

How the work should be submitted?

Should be submitted electronically through ICE so that the marker can run your programs

during marking. Feedback and your grade will also be given through ICE.

Remember that you are responsible for ensuring that your C code will run in Visual Studio

2015 and that if it does not without documentary explanation you may get a 0 mark for your

implementation.


站长地图