华为2016校园招聘上机笔试题-简单错误记录

#include
using namespace std;

class ErrorRecord
{
    public:
        string name;
        int lineNum;
        int times;
        int order;
        ErrorRecord()
        {
            this->times=1;
        }
        bool operator==(const ErrorRecord& e)
        {
            if(this->name==e.name&&this->lineNum==e.lineNum)
            {
                return true;
            }
            return false;
        }

};


bool cmp(ErrorRecord& a,ErrorRecord& b)
{
    return a.times>b.times;
}


int main()
{
    ios::sync_with_stdio(false);
    //freopen("in.txt","r",stdin);
    vector vec;
    string s;
    int lineNum;
    int length;
    int isNotSame=1;
    while(cin>>s>>lineNum)
    {
        int n=s.rfind('\\');
        s=s.substr(n+1,s.size());
        length=vec.size();
        ErrorRecord e;
        e.name=s;
        e.lineNum=lineNum;
        e.times=1;
        isNotSame=1;
        for(int i=0;i16)
        {
            cout<

 

你可能感兴趣的:(春招笔试机试)