警告“keit”可能在此功能中未初始化。我的代码停止工作也许有人可以帮忙吗?
#include <iostream>
#include <fstream>
//--------------------------------------------------------------------------
using namespace std;
//--------------------------------------------------------------------------
const char CDfv[] = "Duomenys.txt";
const char CRfv[] = "Rezultatai.txt";
//--------------------------------------------------------------------------
void Skaitymas (int &ilg);
void Atgrezimas (int);
void Rasymas (int);
//--------------------------------------------------------------------------
const int cMax = 100;
int C[cMax];
//--------------------------------------------------------------------------
int main()
{
int ilg;
Skaitymas (ilg);
Atgrezimas (ilg);
Rasymas (ilg);
return 0;
}
//--------------------------------------------------------------------------
void Skaitymas (int &ilg){
ifstream fd(CDfv);
fd >> ilg;
for (int i = 0; i < ilg; i++)
fd >> C[i];
fd.close();
}
//--------------------------------------------------------------------------
void Atgrezimas(int ilg){
int keit;
for (int i = 0; i < ilg; i--){
ilg--;
C[i] = keit;
C[i] = C[ilg];
C[ilg] = keit;
}
}
//--------------------------------------------------------------------------
void Rasymas(int ilg){
ofstream fr(CRfv);
for(int i = 0; i < ilg; i++)
fr << C[i];
fr.close();
}
//--------------------------------------------------------------------------