首页 > > 详细

RBE104TC课程程序代写、Programming程序实验代做、代写C++编程语言代写留学生 Statistics统计、回归、迭代|代写R语言程序

RBE104TC C/C++ Programming Language
Assignment 1
Assignment Overview:
This assignment aims at testing some basic concepts of the C programming and
initiates the routine of code development using the software development process
(SDP) presented in the relevant lectures. It focuses on the following five steps of
the SDP.
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.
You will need to apply this methodology to each one of the following simple
exercises.
Things to note:
1. Include clear comments in your code to make it easy to understand.
2. Explain your testing procedure and what you have observed during the
testing. The testing should be demonstrated by screenshot pictures to
present the actual implementation output.
3. How you solved any problems.
Contribution to the Overall Marks 40%
Issue Date
Submission Deadline Dec. 21st, 2020
1 / 5
Exercise 1 (25%):
Write a C program that can perform the following operations:
• Read the following from the keyboard and store them in appropriate variables;
• A full name (e.g. John Smith);
• A telephone number (e.g. 12345678900) assume all phone numbers are with
11 digits;
• A 2 digit decimal number (e.g. 22);
• A temperature in degrees Celsius (e.g. 28.5°C).
• Divide the first 6 figures of the telephone number by the last 5 and store the
result in a variable. Print the value on the screen (e.g. 123456/78900 = 1.56;
• Print an integer on the screen with the decimal, the octal, and the hexadecimal
format (e.g. 45, 55,2D);
• Convert the temperature from degrees Celsius to degrees Fahrenheit and
degrees Kelvin. Store the values in appropriate variables rounded to the
closest whole number and print them on the screen (e.g. 10°C 50°F 283°K);
• Solve the real roots of the quadratic equation for any real input a,b,c (e.g.
invalid(a = 0), two equal real roots, two unequal real roots, or no real roots).
Exercise 2 (30%):
• Write a function
bool same_vec (vector a, vector b)
that checks whether two vectors are including the same elements, ignoring
the order and multiplicities.
• For example, the two vectors {1, 4, 9, 16, 9, 7, 4, 9, 11} and {11, 11, 7, 9, 16, 4, 1}
would be considered identical.
Requirements:
1. Get the numbers from keyboard input;
2. The length of the vectors is unknown, it is only determined by the input.
2 / 5
Exercise 3 (45%):
An entertainment company designs a game: both the player and the computer
generate a letter taking the value A, B, C, but the result is determined by the
following rules: A < B, B < C, and C < A. It would now invite you to develop this
software to provide players of the game with their own secured account in which
their game history including the win, lose, or draw numbers is recorded and stored
in a file. There are several requirements as described in the following section.
Program Requirements
• Your program should provide users with the ability to create an account. An
account should be a structure type variable containing: a username, a password,
and a record of the game history.
• The game history should be stored in a two-dimensional array and contain the
following details as a minimum:
i. Number of rounds in a game
ii. Number of player wins
iii. Number of computer wins
iv. Number of draws
v. Whether or not the game was overall a winning, draw or loss.
• All of the accounts should be stored in a data file and accessed by the program.
• Once a user is logged on to the game they should be able to:
i. Start a new game
ii. Review their game history
iii. Clear their game history
iv. Logout
• Normally, the use of global variables is not allowed. Any use of global variables
must be fully justified in your report.
Ideas:
Note: the following 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 of the player accounts are structure variables and will be stored in a file. The
login process can be achieved using a single structure variable, into which each
account can be read from the file one by one, each time checking the username
until you find the correct players' account. The gaming operations can then be
performed using that single structure variable. When the player finishes only this
one structure needs to be written back to the file for saving.
Alternatively, you can create an array of structures in the program and read the
whole file into the array, then search the array. The game can be played using the
3 / 5
correct element of the array of structures. When the player finishes, the whole array
can be written to the file.
Try to create your own functions to simplify the programming task.
Consider how your program should function when there is an invalid input.
To make your program more interesting for the user thinks about what kind of
information they may like to access for example overall win percentages.
4 / 5
What should be submitted?
You should submit the followings:
1). A short report (up to a few pages of text plus C source codes) detailing for each
question:
a). SDP steps 1 to 3 in the report (Report + Specification + Analysis +
Algorithm Design) (40%);
b). SDP step 4 (Implementation + Robustness): your C source code including
the comments. (40%);
c). SDP step 5 (testing): you will explain how you have tested the correctness
of your C program and will include some sample runs of your C Programs.
(20%);
Please refer to the file Marking Guidelines for RBE104TC.pdf on the Learning Mall
system for a detailed marking scheme.
2). The report in Microsoft Word or pdf format and C source code of your
implementation zipped into a single file, i.e. the zip file will contain 2 files. (It is good
practice to include comments in your code see the example provided.)
The naming of Report ( .doc, .docx or .pdf only), Source Code (.c) and Compressed
file (.zip, or .rar only)
StudentID_LastName_FirstName_AssignmentNumber.doc
StudentID_ AssignmentNumber.c
StudentID_LastName_FirstName_AssignmentNumber.zip
For example:
Report and c source file named:
1234567_Albert_Einstein_1.doc
1234567_1.c
Contained within the zip file:
1234567_Albert_Einstein_1.zip
How the work should be submitted?
Should be submitted electronically through the Learning Mall system so that the
marker can run your programs during marking. Feedback and your grade will also
be given through the Learning Mall system.

联系我们 - QQ: 99515681 微信:codinghelp2
© 2014 www.7daixie.com
程序代写网!