Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
XML
#include<map>
#include<string>
#include<iostream>
#include<algorithm>

using namespace std;

class word
{

private:

    string sWord;
    multimap<int,int> miiLocation;
    int iNum;

public:

    word(){}
    word(string m);

    string print();
    void Addloc(int x, int y);

};
word::word(string m)
{

    sWord = m;
    iNum=0;

}

string word::print()
{

    return sWord;

}

void word::Addloc(int x, int y)
{

    miiLocation.insert(x,y);
    iNum++;

}

int main()
{
    map<string,word> ex;
    word a("abc");
    //a.Addloc(1,2);
    //ex.insert("abc",a);

}


these marked sectences have some mistakes,bu I don't know why . who can help me ?
Posted
Updated 27-May-13 18:23pm
v2
Comments
[no name] 28-May-13 22:16pm    
Smells like homework. If so that should be made clear.

My analysis:
(1) First word in each sentence is not capitalized ("these", "who").
(2) Misspelling of "sectences", "bu"
(3) Space before period, question mark



Also, your code has some errors... default ctor not implemented, class name of "word" likely is a cause of namespace conflict. I wouldn't use the vertical whitespace the way you do it either. Your class definition positioning looks suspicious since this is usually (but not always) in a .h or .hpp file.
 
Share this answer
 
Comments
RHsoul 28-May-13 3:00am    
although , you have told me so much. But it doesn't work for me to solve the promble.
[no name] 28-May-13 9:55am    
Maybe you could explain what the problem is instead of making people guess...
You need to define assignment operator for class work. Otherwise you will not be able to use it in map<string,word>. The method insert() of the map will want to copy variable a to a new instance and will not be able to do so.
 
Share this answer
 
Comments
RHsoul 28-May-13 1:34am    
I have write it . But it is wrong!
chaau 28-May-13 1:38am    
Show your code for:
word& operator=(const word& _Right)
RHsoul 28-May-13 2:55am    
I have tried, but it doesn't work!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900