Page 1 of 1

A tuition centre conducts three classes for primary school students as listed in Table Q2. (a) Based on the function pro

Posted: Sat Feb 19, 2022 3:21 pm
by answerhappygod
A Tuition Centre Conducts Three Classes For Primary School Students As Listed In Table Q2 A Based On The Function Pro 1
A Tuition Centre Conducts Three Classes For Primary School Students As Listed In Table Q2 A Based On The Function Pro 1 (102.84 KiB) Viewed 44 times
A tuition centre conducts three classes for primary school students as listed in Table Q2. (a) Based on the function prototype of insertData() function and also how 3 points it is called by main() function, write the function definition for this insertData() function which will prompt the user to key in the information of all classes in Table Q2, as shown in Figure Q2(a). Underlined denotes user's input. No. 1. 2. 3. Subject English Science Maths Table Q2 Day Monday Tuesday Friday Number of Students 35 42 63 Develop a simple C program to help the tuition centre keeping the information in the form of an array of records Tuition #1 subject: English Tuition #1 day: Monday Tuition #1 number of students: 35 Tuition #2 subject: Science Tuition #2 day: Tuesday Tuition #2 number of students: 42 Tuition #3 subject: Maths Tuition #3 day: Friday Tuition #3 number of students: 63 Figure Q2(a) #include <stdio.h> #include <string.h> #define M3 Your answer struct Tuition char subject [20]; char day [20]; int num; ); void insertData (struct Tuition array ll, int size); void printData (struct Tuition *pointer, int size); (b) Based on the function prototype of printData() function and also how it 4 points is called by main() function, write the function definition for this printData() function which will print the information of all classes and total number of enrolled students, as shown in Figure Q2(b). int main() { struct Tuition List[M]; Subject Day Number of Students insertData (List, M); printData (List, M); English Science Maths Monday Tuesday Friday 35 42 63 return 0; Total number of enrolled students = 140 Figure Q2(b) /*Part (a) - Function Defintion for insertData */ /*Part (b) - Function Defintion for printData / Your answer