+ 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.
10 ответов
+ 7
Not bad, I would like to see it, when you finish making it.
+ 4
Share the code.
We will help you to get it working and remove the errors.
+ 3
Yes, you closed the file after writing the first entry. Move the line - fin.close(); outside the for loop, and thats it.
+ 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();
}
+ 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?
+ 1
I made one but.
it's not working as I thought it should work.
+ 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 ;_;
+ 1
🤔🤔 oh yeah.
thanks for your help 😊😊 @Kinshuk Vasisht
0
I can do that
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