Hi there I've got a problem with functions, where it seems that function call return zero instead of the actual variable value, I will appreciate any help from you guys.
I will post the major code parts because the program is big.
I get the totallength variable value right but for t i get zero istead of 1, 2, 3, ...
did I miss something here??
using namespace std;
//global variables
int t;
static float totallength=0;
// the function
void FileOutput(int a, float b)
{
ofstream outData("Output1.csv", std::ios::out | std::ios::app);
if (outData.good())
{
cout<<t<<totallength<<endl;
outData << t <<","<<totallength<<endl; //writing
cout<<endl;
}
outData.close();
}
int main()
{
for (int t=0;t<20;t++) {
.
.
.
.
FileOutput(t,totallength);
}
.
.
return 0;
}