0

Need help with c code for mark sheet for students with n subjects and mark allocation with respect to number of subjects

C code may-day

31st Dec 2021, 5:28 AM
Sammy Q
Sammy Q - avatar
9 Respostas
+ 1
OK. So you'll need additional array for subjects, and an integer for the number of subjects, plus the related inputs. Since you have a variable number of elements (subjects and marks), I recommend a very careful reading on the dynamic memory allocation lessons - malloc, etc. This avoids wasting memory with fixed size arrays with the maximum expected size.
2nd Jan 2022, 11:31 PM
Emerson Prado
Emerson Prado - avatar
+ 1
So ask a question about it
31st Dec 2021, 6:08 AM
Emerson Prado
Emerson Prado - avatar
+ 1
The student structure store The mark in an integer variable. Change that to an array or something that takes multiple values. Then, use a loop to input all marks for each student. You probably want an additional array of strings to store subject names - again, include that in the structure and in the input loop. Is the number of subjects fixed, provided by the user for all students, or different for each student?
2nd Jan 2022, 3:52 AM
Emerson Prado
Emerson Prado - avatar
0
I need help with how to input multiple marks with respect to the subjecst...
1st Jan 2022, 8:08 AM
Sammy Q
Sammy Q - avatar
0
So allow people to help you: 1. Link your code in your question (using + button) 2. Explain what it should do 3. Describe what it's doing wrong With just a vague description of a generic difficulty, how can we know what to help you with?
2nd Jan 2022, 3:31 AM
Emerson Prado
Emerson Prado - avatar
0
https://code.sololearn.com/ca4Yazbjxk93/?ref=app The output accepts the input of only 1 mark... I need help adding the subject function for the user to be able to input multiple marks with respect to the number of subjects...
2nd Jan 2022, 3:39 AM
Sammy Q
Sammy Q - avatar
0
No... The number and name of subjects vary... For each student...
2nd Jan 2022, 11:16 AM
Sammy Q
Sammy Q - avatar
0
Ok... Will try that out
2nd Jan 2022, 11:55 PM
Sammy Q
Sammy Q - avatar
0
Thanks
2nd Jan 2022, 11:55 PM
Sammy Q
Sammy Q - avatar