I want to create a file where i store all the students from a class(each as unique) and to also be able so save the subject that they are taking and all the grades that they have on that specific subject.
I tried doing this by implementing some sort of a 3d map with a string for unique names and a struct that holds the name of each subject and a vector inside it with all the grades the the student has.
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <sstream>
#include <map>
using namespace std;
struct subject
{
string subject;
vector<int> grade;
};
int main()
{
vector<subject> test;
map<string, vector<subject> > ourClass;
}
ourClass["John Mayer"] = test[0].note.push_back(10);
Tried it like this and it doesn't work. Do i have to overload the operator first or is there another way to access the specific elements?
How do i properly call the map for a specific name to add as many grades as i want in a specific subject? Or is there any more efficient way to do this?