// Text file input demo. // speed.dat contains any number of // space/enter separated real numbers. #include #include #include using namespace std; void main(void) { FILE * s_d=fopen("c:\\temp\\speed.dat","r");//open file for input if(s_d==NULL){ printf("\nFile not found!"); getch(); exit(1); } double tmp ,counter=0,sum=0; while(1) //read speed data to end of file { fscanf(s_d,"%lf",&tmp); // read from file 1 number if(feof(s_d)) break; sum+=tmp; counter++; cout<