Make a grading system using C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Make a grading system using C++

1. user will enter max marks. 2. will enter number of subjects. 3. marks for each subject. 4. grade will be shown for each individual subject. 5. save all entries in a file. 6. each time same file concatenated for new data.

26th Oct 2017, 6:46 PM
Guy Anonymous
Guy Anonymous - avatar
10 Answers
+ 7
Not bad, I would like to see it, when you finish making it.
27th Oct 2017, 12:23 AM
Manual
Manual - avatar
+ 4
Share the code. We will help you to get it working and remove the errors.
28th Oct 2017, 2:56 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 3
Yes, you closed the file after writing the first entry. Move the line - fin.close(); outside the for loop, and thats it.
29th Oct 2017, 8:56 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
Its quite simple. All you need to do is make a class, and write the entire object every time to a file opened in append mode. Like this: class Student { // Methods to read and write. }; void Write(string name, Student& s) { fstream file(name.c_str(), ios::out | ios::binary | ios::app); file.write(reinterpret_cast<char*>(&s), sizeof(s)); file.close(); }
28th Oct 2017, 11:47 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
@Guy Anonymous You create a single student, and save its data to a file. Now what is the error? Are you not able to see all the subject data in the file or you wanted to write data of more students?
29th Oct 2017, 8:51 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
I made one but. it's not working as I thought it should work.
28th Oct 2017, 11:49 AM
Guy Anonymous
Guy Anonymous - avatar
+ 1
yes exactly. not able to see all data. just I can see only one block data. like if I enter no of sub = 5 then it should show all 5 sub data. but only shows one subject data in file . I think any looping error ;_;
29th Oct 2017, 8:53 AM
Guy Anonymous
Guy Anonymous - avatar
+ 1
🤔🤔 oh yeah. thanks for your help 😊😊 @Kinshuk Vasisht
29th Oct 2017, 9:03 AM
Guy Anonymous
Guy Anonymous - avatar
0
I can do that
27th Oct 2017, 8:11 PM
Matthew M. Ciapha
Matthew M. Ciapha - avatar
0
correct this please. when I run this code in my compiler. it just save only one entry not all n entries. thanks https://code.sololearn.com/cC7afn5jqHjU/?ref=app
29th Oct 2017, 8:10 AM
Guy Anonymous
Guy Anonymous - avatar