为什么我的程序出错(文件处理)?

Why is my program giving error (file handling)?

#include<iostream>
#include<cstring>
#include<fstream>

using namespace std;

ofstream fileData;
ifstream writeData;

void newAccount();


int main()
{
    string data[10][3];
    int choice=0,i,j;


    fileData.open("D:\Desktop\input.txt");

    for(i=1; i<10&&(!fileData.eof());i++)
    {
        for(j=0; i<3;j++)
            getline(fileData,data[i][j]);
    }

    fileData.close();

    for(i=0; i<10;i++)
    {
        for(j=0; i<3;j++)
            cout<<data[i][j];
    cout<<endl;
    }

    while(choice!=8)
    {

        cout<<"             Hi, Welcome to the Bank"
            <<"\n\n1.New Account.\n2.Deposit Money\n3.Withdraw Money\n4.Balance Enquiry"
            <<"\n5.Account Holder List\n6.Close An Account\n7.Modify An Account\n8.Exit\n\n";

        cin>>choice;

        if(choice==1)
        {
            newAccount();
        }

    }

它的说法

main.cpp: In function ‘int main()’:
main.cpp:38:40: error: no matching function for call to ‘getline(std::ofstream&, std::string&)’
             getline(fileData,data[i][j]);

您正在尝试从 std::ofstream 读取输出流。使用 std::ifstreamstd::fstream.