You are on page 1of 1

COMP217 Data Structures

2019-20 Fall

Laboratory Work No. 3


Structures as Aggregate (Composite) Data Type

This laboratory work is about the usage of structures in C programming.

You are expected to develop a C program that keeps course information and calculates the grade point average. Write a template structure
definition for both course and student data structures. Assume that the student can be represented by an ID, name, surname, and
department information whereas the course can be represented by a course code, title, and credit hour.

a) Write structure definition of the course data structure

b) Write structure definition of the student data structure

c) Write structure definition of the semester (keeping student information, three courses taken, and a GPA value)

d) Write a C function for each task listed below:

i. get_course_info(..) : asks the user information about a course, and fills the related fields
ii. get_student_info(..) : asks the user information about a student, and fills the related fields
iii. create_semester(..) : creates a semester for one student where the student takes three courses
iv. calculate_gpa(..) : calculates semester-based GPA of the student
v. display_info(..) : displays to the screen complete semester information of the student

You are allowed to use any input/output function of the C standard library.

 Test your implementation for at least two students!

1/1

You might also like