这句话有什么问题? [英] What's wrong with these sentences?

查看:87
本文介绍了这句话有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#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 ?

推荐答案

我的分析:

(1)每个句子中的第一个单词没有大写(这些,谁。

(2)拼错sectences,bu

(3)句号前的空格,问号

< br $>




此外,您的代码有一些错误...默认ctor没有实现,word的类名可能是命名空间的原因冲突。我也不会像你那样使用垂直空白。您的类定义看起来很可疑,因为这通常(但不总是)在.h或.hpp文件中。
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.


您需要为类工作定义赋值运算符。否则,您将无法在地图< string,word>中使用它。 map的方法insert()将要将变量a复制到新实例,并且无法执行此操作。
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.


这篇关于这句话有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆