誰かが私のコード(C ++)を手伝ってくれるかどうか疑問に思っていましたか?これは動作しない機能です。実行すると、Windowsがポップアップし、「このプログラムは動作を停止しました」と表示されます。実行されないコードは次のとおりです(少し長いですが、プログラムはプロプライエタリであり、助けていただければ幸いです)。
void ClassName::loadGrades(){
string temp;
int count=0;
ifstream labErnIn("labGradesErn.txt");
if(labErnIn.is_open()){
count=0;
while(labErnIn.good()){
getline(labErnIn, temp);
float tempF = ::atof(temp.c_str());
labGradesErn[count] = tempF;
if(labGradesErn[count]==0 && count==0) labGradesErn[count]=-1;
count++;
}
labGradesErn[count-1]=-1;
labErnIn.close();
}
else{
cout << "Unable to open file labGradesErn.txt" << endl;
}
// I repeat this for three other sections, same code, different var names.
// From 'ifstream...' to 'Unable to open file'
}
この関数で宣言されていないすべての変数は、他の場所で宣言されています。
ありがとう、私は本当にすべての助けに感謝します!