You are on page 1of 2

Programming for Engineers: C Language

Assignment:
You are an intelligence analyst working for a government organisation and you have
been tasked with the decryption of a message, which was intercepted by a well-known
intelligence agency. Field agents have also recovered a secret memo explaining that the
code used is a prototype, which will be refined and used for future communications. The
memo gives details on how the code is digitally passed as words rather than numbers in
order to evade unwanted attention from filters that are looking for numerical codes.
Its explained that the first stage of the code is given as word-triplets, where the first
word indicates the number of hundreds, the second indicates the number of tens and
the third indicates the number of units.
For example: zero one three four six eight zero zero two
Is decrypted as:

13, 468, 2

Once the first stage of the code has been cracked, instructions for the second stage will
be revealed.
Your task is to:
1. Decrypt the first stage of the code and store the results in an array.
This will involve:
i. Reading in the file (message.txt) word by word
ii. Converting the words into numbers
iii. Grouping the triplets together to recover the original number
iv. Storing the number in the existing array (message[3018])
v. Displaying the array as characters on the screen
2. Decrypt the second stage
This will involve
i. Following the instructions discovered from completing the first
stage
The completed first stage array has also been given to you, but is commented out. It
should be used to check your solution to the first stage, or if you cannot complete the
first stage then you should print the array as characters on the screen and attempt the
second stage.

Deliverables:
Through Study Direct, Students should submit a .c file containing their code, which
should run on Dev-C++, and a flow chart pdf describing how their program works.
File names should be the same as your candidate number.
Marking criteria:
-

Does the program compile and run on Dev-C++ without errors or warnings?

Has the code been well commented?

Have the variables been given appropriate names?

Is the code neat and correctly indented?

Are the files in the correct format (.c and .pdf)?

Has the student shown the correct use of

Functions?

Loops?

Logic statements?

Arrays?

Scope?

Does the program work properly?

File input

Word conversion

Word grouping and number generating

Array storing

XOR-ing

Displaying

Does the flow chart accurately describe the program?

This list gives a breakdown of some key areas that marks will be awarded for, however
it does not give the weightings of those marks.
Note: All code should be written in C.
The deadline for this task is 4pm on the 10/12/15.

You might also like