Hi, all--this time I've got a program that's supposed to calculate passenger efficiency in passenger kilometers per liter, given an input file that lists number of passengers, total commuting distance per week, and gasoline consumed per week. I'm not sure what's going on, but it doesn't seem to be reading the input file properly. Here's the program:

And here's the output I get on running it:Code:#define SENTINEL 0 int main() { FILE *inp, *outp; double min_efficiency, num_passengers, commute, gas_used, efficiency, subsidy; printf("Please enter the minimum efficiency> "); scanf("%lf", &min_efficiency); inp=fopen("carpool.txt", "r"); outp=fopen("effic.txt", "w"); fprintf(outp, "%87s\n", "CARPOOLS MEETING MINIMUM PASSENGER EFFICIENCY OF 25 PASSENGER KM / L"); fprintf(outp, "%-16s%-21s%-20s%-19s%-10s\n", "Passengers", "Weekly Commute", "Gasoline", "Efficiency", "Weekly"); fprintf(outp, "%-16s%-21s%-20s%-19s%-10s\n", " ", "(km)", "Consumption(L)", "(pass km / L)", "Subsidy($)"); fscanf(inp, "%lf%lf%lf", &num_passengers, &commute, &gas_used); while (num_passengers!=SENTINEL) { efficiency=num_passengers*commute/gas_used; subsidy=.08*num_passengers*commute; if (efficiency>=min_efficiency) { fprintf(outp, "%-16d%-21.0lf%-20.1lf%-19.1lf%-10.2lf\n", num_passengers, commute, gas_used, efficiency, subsidy); }//if efficiency>=min_efficiency fscanf(inp, "%lf%lf%lf", &num_passengers, &commute, &gas_used); }//while num_passengers != 0 fclose(inp); fclose(outp); return 0; }//main

I'm probably making a really basic mistake somewhere, but I can't for the life of me figure it out. If someone could point out what I'm doing wrong, I'd be eternally grateful.Code:teyla:~ quasigreat$ cat carpool.txt 4 75 11.0 2 50 9.0 5 95 15.5 2 60 4.5 4 35 4.3 6 70 20.7 0 0 0 teyla:~ quasigreat$ ~quasigreat/a.out Please enter the minimum efficiency> 25 teyla:~ quasigreat$ cat effic.txt CARPOOLS MEETING MINIMUM PASSENGER EFFICIENCY OF 25 PASSENGER KM / L Passengers Weekly Commute Gasoline Efficiency Weekly (km) Consumption(L) (pass km / L) Subsidy($) 0 0 0.0 (it puts a random huge number here, which I've removed to save your browser window) 0 0 0.0 (here, too) 0 0 0.0 -0.0 0.00 0 0 0.0 0.0 (and here)