I want to store the roll and score of the students in a map in the sorted order of roll and also retrieve the score for a given roll. The student information are to be stored in a class.
I referred to a no. of past stack overflow posts where mapping of data members was explained but they were not specifically working on array of objects, here I want a an array or vector of students and their roll and scores are to be mapped.
following is my class design but now I am clueless how to advance on the same, please help
#include <iostream>
#include <map>
#include <cstring>
#incude <utility>
using namespace std;
class Student
{
int roll;
float score;
map<int,float>stdt;
public:
Student(int r=0,float s=0.0)
{
roll=r;
score=s;
stdt[roll]=score;
}
void insert_data(int n, float f)
{
stdt.insert(pair<int,float>(n,f));
}
};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…