-
C Reference Program 2
The University of Reading's Systems Engineering module SE1SA5 has introduced the majority of programming concepts in the C programming language. This example program is used to summarise the later units of this module so far.Topics
- Repetition
- Conditions
- Arrays
- Functions
- Compilation Units (multiple files)
- Structures
Analysis
A Program should be created in order to demonstrate the uses of each topic. It should be clearly commented for future reference.Design
Individual functions should be created in order to demonstrate the uses of each topic. At least one of these functions should be external to the file with the main(); function. With a prototype for this function defined in a header file. This will allow for demonstration of compilation units.
Implementation
The program consists of 3 files; main.c util.c util.h
Each of these files are required for the program to compile.
Code
Syntax highlighting thanks to pastie.org
-
T1 - Programming Practical 6 Alpha Sting
Analysis
Calculate the averages and standard deviations of an array but with a moving fixed scope; store it to an array and print the result. i.e. Find the average and standard deviations of the data between index 0 and 4.
Code
Syntax highlighting thanks to pastie.org
-
T1 - Programming Practical 5 Alpha Sting
Note: I did not complete this in time for it to count. I did it to prove to myself that I could. I also believe that it exceeds the date range required of it.
Analysis
A program should be created to calculate what day of the week a provided date between 1st January 1900 and 1st January 2010 is passed to it falls on.
Design
The user should be able to enter a series of dates and be given the results for the dates they supply. It is not required for a range of dates as these would just be consecutive days and be irrelevant to the original program.
The user should input a date YYYY, DD, MM.
The new solution should be created using existing code from the original solution in order to reduce the amount of work required.
Code
Code
Syntax highlighting thanks to pastie.org
-
T1 - Programming Practical 7 Alpha Sting
This practical's task was to use a 2 dimensional array to store currency transfers. However the alpha sting did not just set these values hard coded but allowed the user to specify the conversion rates. The Program also allowed the user to specify which currencies they were using up to a predefined amount of 4 different currencies.
It was a conscious decision to use the literal array indexes in the user input as it saved the amount of code and thinking whilst debugging.
Code
Syntax highlighting thanks to pastie.org