代码语法错误报错标题太难起

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
#include<iostream>
#include<string>
#include<list>
#include<fstream>
#include<algorithm>
using namespace std;

struct Wrongset
{
    string topic;//题目
    string errorMessage;//错误信息
    string answerAnalysis;//答案分析
    string experience;//心得体会
    string source;//错题来源
    string reason;//错题原因
    string difficulty;//难易程度
    string type;//题目类型
    string knowledge;//知识点
    
};

list<Wrongset>ls;//创建链表
void add(struct Wrongset &a,string str1,string str2,string str3,string str4,string str5,string str6,string str7,string str8,string str9)
{
    a.topic=str1;//题目
    a.errorMessage=str2;//错误信息
    a.answerAnalysis=str3;//答案分析
    a.experience=str4;//心得体会
    a.source=str5;//错题来源
    a.reason=str6;//错题原因
    a.difficulty=str7;//难易程度
    a.type=str8;//题目类型
    a.knowledge=str9;//知识点
}

int main()
{
    label:cout << endl;
    cout << "  错题本管理程序:\n" << endl;
    cout << "     1.添加错题信息\n" << endl;
    cout << "     2.浏览错题信息\n" << endl;
    cout << "     3.查询错题信息\n" << endl;
    cout << "     4.删除错题信息\n" << endl;
    cout << "     5.文件导入\n" << endl;
    cout << "     6.文件导出\n" << endl;
    cout << "     7.退出\n" << endl;
    cout << "   请选择功能:" << endl;
    int op1; cin >> op1;
    if (op1 == 1)//添加错题信息
    {
        cout << "请输入要添加地个数:" << endl;
        int num; cin >> num;
        cout << "请依次输入信息" << endl;
        int cnt = 1;
        while (cnt<=num)
        {
            cout << "请输入第" << cnt << "的相关信息" << endl;
            cout << "请输入题目" << endl;
            string str1; cin >> str1;
            cout << "请输入错误信息" << endl;
            string str2; cin >> str2;
            cout << "请输入答案分析" << endl;
            string str3; cin >> str3;
            cout << "请输入心得体会" << endl;
            string str4; cin >> str4;
            cout << "请输入错题来源" << endl;
            string str5; cin>>str5;
            cout << "请输入错题原因" << endl;
            string str6; cin>>str6;
            cout << "请输入难易程度" << endl;
            string str7; cin>>str7;
            cout << "请输入题目类型" << endl;
            string str8; cin>>str8;
            cout << "请输入知识点" << endl;
            string str9; cin>>str9;
            cnt++;
            struct Wrongset temp;
            add(temp, str1, str2, str3, str4, str5, str6, str7, str8, str9);
            ls.push_back(temp);
            cout << "===============" << endl;
        }
        goto label;
    }
    else if (op1 == 2)//浏览错题信息
    {
        int cnt = 1;
        for (auto x : ls)
        {   
            cout <<"======================="<< endl;
            printf("第%d题相关信息如下\n", cnt);
            cout << "题目:" << endl;
            cout << x.topic << endl;
            cout << "错误信息:" << endl;
            cout <<x.errorMessage<<endl;
            cout << "答案分析:" << endl;
            cout << x.answerAnalysis << endl;
            cout << "心得体会" << endl;
            cout << x.experience << endl;
            cout << "错题来源" << endl;
            cout<<x.source<<endl;
            cout << "错题原因" << endl;
            cout << x.reason << endl;
            cout << "难易程度" << endl;
            cout << x.difficulty << endl;
            cout << "题目类型" << endl;
            cout << x.type << endl;
            cout << "知识点" << endl;
            cout << x.knowledge << endl;
            cnt++;
        }
        goto label;
    }
    else if (op1 == 3)//查询错题信息
    {
        cout << "请选择查询方式:" << endl;
        cout << "  1.按照知识点查询" << endl;
        cout << "  2.按照题目类型查询" << endl;
        cout << "  3.按照难易程度查询" << endl;
        int op2; cin >> op2;
        if (op2 == 1)
        {
            cout << "请输入相关知识点" << endl;
            string s; cin >> s;
            for (auto x : ls)
            {
                if (x.knowledge == s)
                {
                    cout << "相关信息如下" << endl;
                    cout << "题目"<<x.topic <<endl<< "错误信息: " << x.errorMessage <<endl<< "答案解析 " << x.answerAnalysis <<endl<< "心得体会 " << x.experience <<endl<< "错题来源 " << x.source <<endl<< "错误原因 " << x.reason <<endl<< "难易程度 " << x.difficulty <<endl<< "题目类型 " << x.type <<endl<< "知识点 " << x.knowledge << endl;
                }
            }
            
        }
        else if (op2 == 2)
        {
            cout << "请输入相关题目类型" << endl;
            string s; cin >> s;
            for (auto x : ls)
            {
                if (x.knowledge == s)
                {
                    cout << "相关信息如下" << endl;
                    cout << "题目" << x.topic << endl << "错误信息: " << x.errorMessage << endl << "答案解析 " << x.answerAnalysis << endl << "心得体会 " << x.experience << endl << "错题来源 " << x.source << endl << "错误原因 " << x.reason << endl << "难易程度 " << x.difficulty << endl << "题目类型 " << x.type << endl << "知识点 " << x.knowledge << endl;
                }
            }
        }
        else
        {
            cout << "请输入相关难易程度" << endl;
            string s; cin >> s;
            for (auto x : ls)
            {
                if (x.knowledge == s)
                {
                    cout << "相关信息如下" << endl;
                    cout << "题目" << x.topic << endl << "错误信息: " << x.errorMessage << endl << "答案解析 " << x.answerAnalysis << endl << "心得体会 " << x.experience << endl << "错题来源 " << x.source << endl << "错误原因 " << x.reason << endl << "难易程度 " << x.difficulty << endl << "题目类型 " << x.type << endl << "知识点 " << x.knowledge << endl;
                }
            }
        }
        goto label;
    }
    else if (op1 == 4)//删除错题信息
    {
       cout << "请输入要删除的题目所涉及的知识点" << endl;
       string s; cin >> s;
       for (auto x : ls)
       {
           if (x.knowledge == s)
           {
               cout << "题目" << x.topic << endl << "错误信息: " << x.errorMessage << endl << "答案解析 " << x.answerAnalysis << endl << "心得体会 " << x.experience << endl << "错题来源 " << x.source << endl << "错误原因 " << x.reason << endl << "难易程度 " << x.difficulty << endl << "题目类型 " << x.type << endl << "知识点 " << x.knowledge << endl;
               ls.remove(x);
           }

       }
       cout << "删除成功" << endl;
        goto label;
    }
    else if (op1 == 5)//文件导入
    {
        ofstream outFile("outFile.txt", ios::out | ios::binary);
        if (!outFile)
        {
            cerr << "Open or Create File Error " << endl;
        }
        else
        {
            for (auto x:ls)
            {
                outFile << "题目" << x.topic << endl << "错误信息: " << x.errorMessage << endl << "答案解析 " << x.answerAnalysis << endl << "心得体会 " << x.experience << endl << "错题来源 " << x.source << endl << "错误原因 " << x.reason << endl << "难易程度 " << x.difficulty << endl << "题目类型 " << x.type << endl << "知识点 " << x.knowledge << endl;
            }
            outFile.close();
        }
        goto label;
    }
    else if (op1 == 6)//文件导出
    {
    ifstream inFile("outFile.txt", ios::in | ios::binary);
       string buf;
       while (getline(inFile, buf))
       {
        cout << buf << endl;
        }
       inFile.close();
        goto label;
    }
    else exit(1);//退出
}

运行结果及报错内容

img

我的解答思路和尝试过的方法
我想要达到的结果

重载一下 == 运算符;


struct Wrongset
{
    string topic;//题目
    string errorMessage;//错误信息
    string answerAnalysis;//答案分析
    string experience;//心得体会
    string source;//错题来源
    string reason;//错题原因
    string difficulty;//难易程度
    string type;//题目类型
    string knowledge;//知识点

    bool operator==(const Wrongset& w) {
        return topic == w.topic
            && errorMessage == w.errorMessage
            && answerAnalysis == w.answerAnalysis
            && experience == w.experience
            && source == w.source
            && reason == w.reason
            && difficulty == w.difficulty
            && type == w.type
            && knowledge == w.knowledge;
    }
};

我发现注销第三四种操作,代码运行正常