I have made a program that measures the speed of a shot on goal in soccer. I need it to read from a .txt file and write to another. My problem is that I need 2 simultanious readings from the file, and I have no idea how to do that.
and this is the text of the test.txt documentCode:double skudhastighed (double s, double d) { double speed, distance, counterspeed = 0, counter = 0, hastighed, add; speed = s; distance = d; counterspeed = speed; while (counterspeed < (3600 - speed)) { counterspeed = counterspeed + speed; counter++; } counterspeed = 3600 - counterspeed; add = counterspeed / speed; distance = distance / 1000; counter = counter + add; hastighed = distance * counter; return hastighed; } int main() { double s, d; ifstream reading( "test.txt"); reading >> s, d; cout << setprecision(2) << fixed << skudhastighed (s, d); ofstream result( "results.txt", ios::app ); result << setprecision(2) << fixed << skudhastighed (s, d) << " Km/t" << endl; result.close(); cin >> s; return 0; }
Code:1.11, 55.55 1.33, 44.66 1.76, 66.11



LinkBack URL
About LinkBacks



