my code doesn't return double value z, instead returns only 1, why?
#include <iostream>
#include <fstream>
using namespace std;
double road(int s, int v, int max )
{
double t;
t = (s/v);
return t;
}
int main()
{
int s[2]={0};
int v[2]={0};
int max;
double z; // result of function
ifstream fd;
fd.open("u1.txt");
fd >> max;
for (int i = 0; i < 2; i++)
{
fd >> s[i] >> v[i];
z = road( s[i], v[i], max );
cout << z << " ";
}
fd.close();
return 0;
}