Answer:

The program read the characters "error" from the file, but could not convert them into a number, so it assigned 0.0 to the variable.

One Number per Line

QBasic can read several numbers per line, and can even read a mix of numbers and words on input lines. But this gets messy, and the rules are complicated. To simplify our programs, the rest of the examples will use input files that have only one number per line.

For us (just to keep things simple), a program that outputs numbers that will later be read in as data for another program should write only one number per line.

QUESTION 11:

Say that you have a file with 15 numbers in it (one per line) and you wish to compute the sum of the numbers. Will you need to write 15 INPUT statements? (Hint: what would you do it the input were from the keyboard?)