class info
{
char infoLine[MAXLINELEN];
char infoMark[NOSPECIES];
int count;
public:
//info(){ strcpy(infoLine,""); strcpy(infoMark,""); for(int i=0;i
// for new entry
info(char* li, int index, char mr){
strcpy(infoLine,li);
//cout << infoLine << endl;
for(int i=0;i
infoMark[i]='+' ;
infoMark[index]=mr;
count = 1;
}
// for existing entry
void insertmark(int index, char currentMark) { infoMark[index]=currentMark; count++; }
void putEndmark(int index)
{
infoMark[index]='\0' ;
}
int getCount() {return count;}
char *getLine() {return infoLine; }
char *getMark() {return infoMark; }
};
map mymap; // it must be string . otherwise you have to handle < operator overload in info object
map::iterator it;
it = mymap.find(ID);
if ( it !=mymap.end() ) // found id
{
it->second.insertmark( specNo-1,'-');
}else // not found
{
mymap.insert( pair ( ID,info(line2,specNo-1,'-') ) );
}
{
char infoLine[MAXLINELEN];
char infoMark[NOSPECIES];
int count;
public:
//info(){ strcpy(infoLine,""); strcpy(infoMark,""); for(int i=0;i
// for new entry
info(char* li, int index, char mr){
strcpy(infoLine,li);
//cout << infoLine << endl;
for(int i=0;i
infoMark[i]='+' ;
infoMark[index]=mr;
count = 1;
}
// for existing entry
void insertmark(int index, char currentMark) { infoMark[index]=currentMark; count++; }
void putEndmark(int index)
{
infoMark[index]='\0' ;
}
int getCount() {return count;}
char *getLine() {return infoLine; }
char *getMark() {return infoMark; }
};
map
map
it = mymap.find(ID);
if ( it !=mymap.end() ) // found id
{
it->second.insertmark( specNo-1,'-');
}else // not found
{
mymap.insert( pair
}
Comments
Post a Comment