关于后端:CPT109-C-Programming

53次阅读

共计 5132 个字符,预计需要花费 13 分钟才能阅读完成。

CPT109 C Programming and Software Engineering 1 – ASSESSMENT 2
Assessment Number 2
Contribution to Overall Marks 50%
Issue Date 08/11/2021
Submission Deadline 06/12/2021 at 00:01
Assessment Overview
This assessment aims to test your ability to design a modular program which makes use of
files and structures. Application of the software development process (SDP) is also under
assessment; the five steps required for your SDP report are:

  1. Problem specification: formulate the problem.
  2. Analysis: determine the inputs, outputs, variables, etc
  3. Algorithm 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 (.c).
    Just indicate here the name of the file. DO NOT paste your code into your report.
  5. Testing: explain how you have tested and verified your C program.
    Things to note:
  6. Submit only what is required.
  7. Include clear comments in your code to make it easy to understand.
  8. Use the C90 standard.
  9. ALL programs MUST compile and run in Visual Studio 2013.
    Exercise
    The game of hangman is a popular children’s word guessing game aimed at improving
    spelling and general knowledge. A secret word is chosen (usually related to a chosen topic
    e.g. a country or a fruit or vegetable) and the player tries to work out what the word is by
    guessing letters. Each time a player correctly guesses a letter in the word, then the letters
    should be filled in at their appropriate location in the word (see below). Note that the letters
    can be guessed in any order. If the player guesses a letter incorrectly, then the hangman’s
    gallows (See Figure 1a) are constructed one line at a time for each wrong letter till the player
    dies after 8 wrong guesses. A possible text-based version of the hangman’s gallows is shown
    in Figure 1b. Example game:
    Secret word entered by player 1 is: Guangzhou
    Displayed on the screen is: ?????????
    Player 2 guesses: G
    Displayed on the screen is: G???g????….and so on
    Figure 1a Hangman Picture Figure 1b Possible text-based drawing
    The secret word should be either entered by a second user or randomly selected by the
    program from a file of words provided. Program users should create a unique password
    protected account which will record their win/lose record, and which can be viewed.
    1
    2
    3
    4
  10. 8
    5
    __
    | |
    | O
    | |
    | / \
    |_________
    6
    Program Requirements
     Allow users to create an account by selecting a username and password. The account
    should be saved in a file (unique to each user), which will contain a structure with the
    password and the win/lose history.
     Once a user is logged in they should be able to:
    Start a new game
    Review their game history
    Clear their game history
    Logout
     On starting a new game, there should be a choice either to play with a random secret
    word chosen from a data file (the filename should be provided) or for another user to
    enter a secret word.
     The player should guess letter one at a time. After each guess either the appropriate blank
    or blanks of the secret word are filled, or the next section of the picture is included, and
    both the current word state and the current hangman picture are displayed.
     If the player completes the word before the hangman picture is complete, they win, if the
    picture is complete first then they lose.
     All variables used must be local.
    Programming Suggestions/Ideas
    The following points are only to provide you with ideas of how to implement the required
    functionality. They do not represent the“best”or only ways to implement the functions.
     All player accounts are structure variables and will be stored in a unique file i.e. one file
    for each player account. Create new accounts by creating a new file with the username
    selected. The login process can be achieved by trying to open a file, if successful the
    structure stored in the file can be copied into the program memory. When the player logs
    out only this one structure needs to be written back to the file.
     Try to create your own functions to simplify the programming task, for example use one
    function to draw the hangman picture.
     Consider how your program should function when there is an invalid input.
     You can design your own figure (it is your interpretation of the game).
     Consider the playability, how can you make the user interaction more interesting for
    example add your own rule such as do not allow vowel letters (a, e, i, o ,u), or maybe
    only 1 vowel letter is allowed. You may wish to display a list of the wrongly guessed
    letters as a reminder to the player

Submission
Your assessment should be submitted electronically through the Learning Mall Online
(LMO). Feedback and your grade will also be given through LMO.
Software Development Process (SDP) report (5 steps) named: studentID_A2.pdf
Sourcecode (.c) file named: studentID_A2_1.c
Data file: data.txt
This is the file containing the words to be used when playing the game against the computer
Submission should be a single compressed file containing at least 3 files:
1234567_A2_1.c
1234567_A2.pdf
data.txt
1234567_A2.zip
Compressed folder can be of type .zip, .rar or .7z
If you have multiple program files please use the following naming convention:
 Sourcecode files (.c) you should number these accordingly e.g. 1234567_A2_2.c.
 Header files (.h (and associated .c file), name these: 1234657_A2_H1.h
(1234567_A2_H1.c) if there are more than one number them accordingly (i.e. H1, H2..).
Marking
Overall Report Quality 10%
Problem Specification 10%
Analysis 10%
Algorithm Design 10%
Implementation 40%
Robustness 10%
Testing 10%
Please refer to the file“CPT109 Marking Guidelines for Assignment 2”on Learning
Mall for details on marking descriptions.
You are responsible for ensuring that your C code will run in Visual Studio 2013. If it does
not without documentary explanation you may get a 0 mark for your implementation.
There will be a 5% deduction for incorrectly named files in your submission.
Important notes:
University late submission policy will be applied.
University Academic Integrity policy will be applied rigorously. Plagiarism and collusion
will not be tolerated.
You can find information relating to both of these in ebridge.

正文完
 0