[Error] no match for 'operator>>' ,如何解决?

c++

#include<iostream>
#include<fstream>
using namespace std;
int main() {
    cout << "ctiny(continuity)4" << endl;
    ofstream sin("c:\\ctiny.txt");
    string f;
    f = "qgq/awww/were/terrible/that/yyyyy/uuuu/III in/Oooo/popped/AAA and/sass/adds/FFF/gagged/high/Jjjkkkk/KKK/Lilly/zzz/xxx/cCCC/Viva/Bobby/Nunn/Mmmmp";
    sin>>f;
    cout<<"The solution file has been saved to the C drive"<<endl;
    string cti;
    while (true){
        cout << "input:"; 
        cin>>cti;
        if (cti == "qgq") {
            cout << "q";
        }
        else if (cti == "awww") {
            cout << "w";
        }
        else if (cti == "were") {
            cout << "e";
        }
        else if (cti == "terrible") {
            cout << "r";
        }
        else if (cti == "that") {
            cout << "t";
        }
        else if (cti == "yyyyy") {
            cout << "y";
        }
        else if (cti == "uuuu") {
            cout << "u";
        }
        else if (cti == "III") {
            cout << "i";
        }
        else if (cti == "Oooo") {
            cout << "o";
        }
        else if (cti == "popped") {
            cout << "p";
        }
        else if (cti == "AAA") {
            cout << "a";
        }
        else if (cti == "sass") {
            cout << "s";
        }
        else if (cti == "adds") {
            cout << "d";
        }
        else if (cti == "FFF") {
            cout << "f";
        }
        else if (cti == "gagged") {
            cout << "g";
        }
        else if (cti == "high") {
            cout << "h";
        }
        else if (cti == "Jjjkkkk") {
            cout << "j";
        }
        else if (cti == "KKK") {
            cout << "k";
        }
        else if (cti == "Lilly") {
            cout << "y";
        }
        else if (cti == "zzz") {
            cout << "z";
        }
        else if (cti == "xxx") {
            cout << "x";
        }
        else if (cti == "cCCC") {
            cout << "c";
        }
        else if (cti == "Viva") {
            cout << "v";
        }
        else if (cti == "Bobby") {
            cout << "b";
        }
        else if (cti == "Nunn") {
            cout << "n";
        }
        else if (cti == "Mmmmp") {
            cout << "m";
        }
        else {
            cout << "not";
        }
        cout<<"\ncontinue/break:";
        string cb;
        cin>>cb;
        if (cb=="continue"){
            continue;
        }
        if(cb=="break"){
            break;
        }
        
    }
}



运行结果:9 5 D:\c++cpp\Ctiny.cpp [Error] no match for 'operator>>' (operand types are 'std::ofstream {aka std::basic_ofstream}' and 'std::string {aka std::basic_string}')

第7行的ofstream没有>>操作符,第10行报错了,可以使用fstream

看下这篇博客,也许你就懂了,链接:C++:编译错误:no match for ‘operator==‘
你还可以看下cpp参考手册中的 c++ 自动生成基于用户定义的 operator== 和 operator< 的比较运算符-operator!=, operator>, operator<=, operator>=

嗯?????
https://blog.csdn.net/lymww/article/details/119392447