// clistnd.cc // definition of member functions // for class ConcordNode #include #include #include "clistnd.h" // Constructor -- defaults in header file // word defaults to blank, frequency to 0 ConcordNode::ConcordNode(const char * wrd, int freq) { setWord(wrd); setFreq(freq); // node's nextPtr always set to null nextPtr = 0; } // get functions return the data char * ConcordNode::getWord() const { char tempwrd[25]; strcpy(tempwrd, word); return tempwrd; } int ConcordNode::getFrequency() const { return frequency; } // set functions set private data // // note does test for string being too long -- but // this is not very satisfactory. // this function should return an int of 1 if // setting worked and 0 otherwise void ConcordNode::setWord(const char * inwrd) { if (strlen(inwrd) <= 24) strcpy(word,inwrd); else strcpy(word," "); } void ConcordNode::setFreq(const int infreq) { if (infreq >= 0) frequency = infreq; else frequency = 0; } void ConcordNode::incrementFreq() { // Please write this function! }