a. Check the sample output and the flowchart for any clarification on this quest
ID: 3537800 • Letter: A
Question
a. Check the sample output and the flowchart for any clarification on this question.
b. Create a struct called %u2018student%u2019 that will contain ID and marks as member variables
c. In the main function, the user will be prompted to input the size of the student database.
You can safely assume that the user will enter a non-negative integer greater than zero.
d. Based on the entered size-value, the program will create a student array dynamically.
e. A function will be called to populate each student-object. You%u2019re required to use the
function prototype: student dataEntry(student x, int i); where in the
parameter list the integer i will keep track of the ith student. Define this function and call
this function to populate the database.
i. The ID has to be validated: the Id can only be a 4 digit number which cannot start
with a zero.
ii. You can safely assume that the user will not input any marks outside the prescribed
range (0 and 100); you don%u2019t need to validate the obtained marks.
f. After populating the array, a second function will be called to print the database
information on the screen. You%u2019re required to use the function prototype: void
printData(student *p, int sz); where in the parameter list the student pointer
will take care of the student array and the integer variable will take care of the size of the
array. Define this function and call it where necessary.
g. Finally, the dynamically allocated memory will be released.
Sample output:
Creating a student database.....
How many students? 400
Populating the student database for 400 students.....
Enter the ID of student 1: 1234
Enter the marks of 1234: 89
Enter the ID of student 2: 231
Invalid ID! Input a valid 4-digit ID:2315
Enter the marks of 2315: 78
Enter the ID of student 3: 56
Invalid ID! Input a valid 4-digit ID:567
Invalid ID! Input a valid 4-digit ID:5678
Enter the marks of 5678: 98
---
---
Enter the ID of student 400: 9765
Enter the marks of 9765: 94
Printing the student database.....
Id Marks
-- ----
1234 89
2315 78
5678 98
---
---
9765 94
Closing the database.....
Explanation / Answer
what do you want to do??? you did it already
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.