I have a problem with my main part of the program. I am trying to implement the arguments in main with argc, argv that will receive as input txt files. Also when I try to read the files I receive an error like : Variable i is used without being initialised and I must click Abort.
The main part of the code is this one:
void main(int argc, char* argv[])
{
cout <<"<---------------FAZA 2--------------->" <<endl;
cout << " Numar de argumente ale functiei main:" << argc << endl;
for (int i = 0; i < argc; i++)
{
if (argv[i] = "Angajat.txt")
{
Fisiere_Intrare f1;
f1.Fisiere_Angajati();
break;
}
else
cout << " O.K." << endl;
}
Fisiere Intrare is a class written like this:
class Fisiere_Intrare
{
public:
void Fisiere_Angajati()
{
ifstream fis;
fis.open("Angajat.txt", ifstream::in);
if (fis.is_open())
{
while (!fis.eof())
{
Angajat a;
fis >> a;
cout << a;
}
}
fis.close();
}
};
"Angajat" is also a class with the following atributes: name, salary, work_age.