この問題に遭遇したのはこれが初めてなので、修正方法がわかりません。編集:気にしないでください。コンストラクターでの 1 つのエラーによるオフのように見えて、何らかの理由でこれが発生しました
#include <iostream>
#include <fstream>
#include "graphm.h"
using namespace std;
int main() {
ifstream infile1("data31.txt");
for(;;){
GraphM G;
G.buildGraph(infile1);
if (infile1.eof())
break;
}
void GraphM::buildGraph(ifstream& infile){
int i = 0;
infile >> i; //it crashes here
}
私のテキストファイルはたったの1行です: 5