Ok, here is your mistake, in file Automat.cpp:
Automat::Automat()
{
_maxStAkcij=MAX_AKC;
_verAkcije= new double(_maxStAkcij);
//_verAkcije= (double *)malloc(_maxStAkcij);
for(int i=0; i < _maxStAkcij; i++)
_verAkcije[i]=1/(float)_maxStAkcij;
_kazen = KAZEN;
_nagrada = NAGRADA;
}
Automat::Automat()
{
_maxStAkcij=MAX_AKC;
_verAkcije= new double(_maxStAkcij);
//_verAkcije= (double *)malloc(_maxStAkcij);
for(int i=0; i < _maxStAkcij; i++)
_verAkcije[i]=1/(float)_maxStAkcij;
_kazen = KAZEN;
_nagrada = NAGRADA;
}
To copy to clipboard, switch view to plain text mode
The line:
_verAkcije= new double(_maxStAkcij);
_verAkcije= new double(_maxStAkcij);
To copy to clipboard, switch view to plain text mode
is causing your crash, because will create only ONE double and will assign _maxStAkcij value to it. It crashed in the next for loop, when you populate the array. It will cause a buffer overrun in your array.
You have to use square brackets to allocate an array. Like this:
_verAkcije= new double[_maxStAkcij];
_verAkcije= new double[_maxStAkcij];
To copy to clipboard, switch view to plain text mode
Try it and it will work.
Regards
Bookmarks