RBE104TC C/C++ Programming Language
Assignment 1
Contribution to the Overall Marks 30%
Issue Date
Submission Deadline 13th October 2024
Assignment Overview:
This assignment is geared towards assessing fundamental coding concepts in C/C++ and
initiating the process of code development using the software development process (SDP)
discussed in relevant lectures.
In composing the SDP report [in English], we request you to fulfil the following criteria:
Design: Clearly explain your understanding of the given problem and specify a sequence of
steps necessary to accomplish the task (illustrated through flowcharts).
Coding Progress: Attach 3-5 screenshots that show the code and running results as evidence,
particularly highlighting any errors or situations you believe are valuable to document. The
corresponding 3-5 versions of the C code should also be saved. All files must clearly
demonstrate the progression of your programming task from the initial stage to the final version.
Analysis: Describe the files submitted in the Coding Progress section. Discuss the expected
results, any encountered or unexpected errors, and your solutions to those issues.
Implementation: The C code must be submitted in a separate file. Please specify the file
name and provide instructions for user operation.
Testing: Describe how you tested and validated your code for required functionalities, as
well as its robustness.
Exercise 1 (50%):
Write ONE C Program to accomplish the following task: Convert a double number to its
hexadecimal form.
Constraints:
1). The double number x is located between 0 and 1000 (0 <= x < =1000), e.g. 678.345;
2). The double number with the hexadecimal form contains 6 significant digits. e.g. The
hexadecimal form of “678.345” is “2A6.5851EB”;
3). The double number with the hexadecimal form is represented by a string (or a character
array), e.g. “2A6.5851EB”.
4). If illegal user input is detected, the software should be capable of informing the user and
enabling re-input to meet the software robustness requirement;
Advice:
It is strongly suggested that you should read the relevant lecture notes on the Learning Mall
before you write down your own codes. The note will help you design a correct program,
especially the design of loop structures and the usage of the arrays.
The possible steps are as follows:
1). Split a double number into the integer part and the fractional part;
2). Convert the integer part into its hexadecimal form;
3). Convert the fractional part into its hexadecimal form;
4). Combine both parts into a string;