主题:[讨论]一道美国大学的FORTRAN试题
Using marker controlled loop to process several data items. Input / output redirection. The program description for this assignment is basically the same. The few changes are as followes.
1. The number of packets is not provided. Input will contain the weights of several packages, one per line. The end will be marked by a negative entry, not to be processed.
2. There will be no prompts to enter the data. The user knows what to enter.
3. The output for the packets will look like a table, with column headings as shown below. The numbers in each column must line-up. Each cost must have a dollar sign before it.
Recall that the weights should be printed accurate to one decimal place, the cost to two places (as in normal life)
Specifically the result will be printed as follows. There will be one blank line before and one after the result.
Weight Cost
<-- blank line
... ... ... <--- one output line for each wight entered
<-- blank line
----------------------
<--- blank line ...
... packets processed
... rejected
... accepted
Total weight shipped: ... lbs
Total cost: $ ....
<-- blank line
1. The number of packets is not provided. Input will contain the weights of several packages, one per line. The end will be marked by a negative entry, not to be processed.
2. There will be no prompts to enter the data. The user knows what to enter.
3. The output for the packets will look like a table, with column headings as shown below. The numbers in each column must line-up. Each cost must have a dollar sign before it.
Recall that the weights should be printed accurate to one decimal place, the cost to two places (as in normal life)
Specifically the result will be printed as follows. There will be one blank line before and one after the result.
Weight Cost
<-- blank line
... ... ... <--- one output line for each wight entered
<-- blank line
----------------------
<--- blank line ...
... packets processed
... rejected
... accepted
Total weight shipped: ... lbs
Total cost: $ ....
<-- blank line