Hey,
I find with all my programmes I write, if I have two inputs to enter, within the while loop, it wont end until the last input has been put in, in the past I went round it the long way by putting an 'if' statment in to break the loop after the first input, but what is the correct way to solve this problem, I had a quick look at the QA's and the Search thing, but not much luck
Thanks, ps not homework as I am only teaching myself, in the UK I can never find any (cheap) lessions on C++ anyway.Code:while (( miles != -1) || ( liters != -1 )) { cout << "Please enter number of miles you have driven or -1 to quit" << endl; cin >> miles; cout << "Please enter number of liters you put in your car to fill it up" << endl; cin >> liters; answer = compute(liters, miles); cout << "You have travled " << answer << " miles per gallon" << endl; } return 0;