Physics and Astronomy |
Back to top
Assignment 3 (2017)This assessment forms 13% of your module mark. Objectives
Remember: you will make the best progress by doing the tasks in stages, making sure each stage works correctly before starting the next one. Ask me for help if you get stuck. Be sure to read the expectations document which will tell you how we will assess your work.. OverviewWe are using a structure to store information about a shape, including its dimensions, what type of shape it is (triangle, ellipse or rectangle) and its area; and writing a function to calculate the area of such a shape. The Shape structure
Test this using a dynamically allocated structure, i.e. allocate the structure within main() and pass the pointer to the area function. Multiple structuresYou may do this either by using a dynamically-allocated array of structures or a linked list of structures. Note: if you use an array it must be dyanamically allocated using one of the malloc() family of functions. Revise the appropriate lecture and your exercise from last week, then:
To hand inUpload one single C file.
Hand-in guidance (for all assignments)For all assessments We require one ".c" text file for each task, uploaded to ELE. Do not upload a PDF, word-processor file etc. For each task you should hand in the program and some output pasted output into a comment at the end of your program: #include <stdio.h> etc., etc. Your code here /* OUTPUT Some output here */ The output should be fairly brief but enough to show that your code works. Basically we are looking for the minumum amount necessary to show your program worked for each separate class of the problem, including error checking where appropriate, rather than several similar runs. To copy and paste from the output terminalThe Windows output console has an "unusual" copy and paste mechanism:
You can now paste into Code::Blocks using Control-V |