Next: About this document ...

ESC 251 HW 14 Due: Oct. 6

Remember that all counting variables need to be integers.

For this homework, you will need to make use of input/output redirection.

• Input Redirection
    a.exe < somefile.in

This tells your program to get all READ(*,*) statements from the file somefile.in instead of the keyboard.
• Output Redirection
    a.exe > somefile.out

This tells your program to print all WRITE(*,*) statements to the file somefile.out instead of to the screen. If the file somefile.out does not exist, it will be created. If it does exist, it will be overwritten.
• Output Redirection with Append
    a.exe >> somefile.out

This tells your program to print all WRITE(*,*) statements to the file somefile.out instead of to the screen. If the file somefile.out does not exist, it will be created. If it does exist, the output will be appended to the existing contents of the file.
• Combining You can combine input/output redirection as needed, for example:
    a.exe < somefile.in > somefile.out

or
    a.exe < somefile.in >> somefile.out


1)
(3 pts) Write an F90 program that will compute the average of the positive double precision values that are given in the data file hw14a.in (this file includes a negative value at the end to terminate input). Right click on the data file name to save it to your computer. How many numbers are in the file?
2)
(1 pts) Write an F90 program that will read in the data from the data file hw14b.in and print the values to the screen. Be sure to match the data type you are reading to the data type in the file.
3)
(4 pts) Write an F90 program that will determine the geometric mean of a set of user input positive integers. Test your program using the values 3,4,8,2,12,9,5. Recall that the geometric mean is defined to be

This problem is an accumulation operation, but here you are accumulating a product and not a sum.

Next: About this document ...
2017-10-04