Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Contribution to module (weighting: 20 %)
Main objective of the assignment:
Understand C programming and practice to draw a flow chart to describe
the problem and coding in C.
You are given a struct student, Table-1 and Table-2 as listed below. You are
required to finish the assignment with given information.
- Use a flow chart or another method, demonstrate the data flow; - Explain how the structure/functions to be used; - Program in C language; - Output screenshot for each question;
1. You are required to finish struct student class[] = {} using Table-1.
struct student
{
int stuno;
char fname[20]
char lname[20]
int age;
struct transcript;
};
Table-1. Students’ Record (Given as a file “stu.txt”)
stuno fname lname age
101 Keanu Reeves 21
102 Nicolas Cage 20
103 Tom Cruse 20
104 Susan Boyle 22
105 Mariah Carey 19
106 George Mikan 23 107 Bill Sharman 20
108 Paul Arizin 19 109 Bob Pettit 20 110 Jerry West 21 111
<Your Given
Name> <Your Family
Name> 19 *You are requested to modify the last record with your name, keep stuno
and age.
2. Sort the records based on student age. You are required to write an
appropriate callback function, and output without transcript
information on screen.
3. Transcript can be accessed from Table-2. First, you need to sort
student’s records based on their scores. Then, write an appropriate
callback function, and output with transcript information on screen.
Table-2. Transcript Information (Given as a file “records.txt”)
stuno cname score
101 C Programming 41
101 English 48
102 Math 50
103 Art 43
103 C Programming 56
104 Math 64
105 C Programming 71
105 Math 63
105 Database 32
106 C Programming 89 106 Art 78 106 Physics 91 106 Math 64 106 Computer
Architecture 82 107 Information Security 86 107 Database 48 107 Data Mining 42 108 C Programming 39
108 Database 53 108 Math 58 108 Spatial Database 98 109 Art 67 110 C Programming 78 110 Math 43 110 Computer
Architecture 83 110 Database 65 111 C Programming 92 111 Math 89 111 English 96
4. Calculate the average score of “C Programming” using recursive
function. Write the appropriate callback function, and output the
average score (AVG) on screen.
5. Output all “C Programming” scores with student information, write
the result to a new txt file and name the file with your Brunel id. To
achieve this, you need to use strcmp() function to select “C
Programming” course. You are required to add a new column as
remark(Ordinary Degree(Pass) / Lower-second Class Degree / First
Honors Degree). Switch or if statement must be used to get remark
information. Specifically,
40-44 indicate “Ordinary Degree(Pass)”;
45-49 indicate “Third Class Degree”;
50-59 indicate “Lower-second Class Degree”;
60-69 indicate “Upper-second Class Degree”
70-100 indicate “First Honors Degree”.
An example is given below:
Stuno cname score remark
101 C Programming 41
Ordinary
Degree(Pass)
101 English 48
Third Class
Degree
… … … …
6. Write a flow chart for each function.