next up previous
Next: About this document ...

ESC 251 HW 23 Due: Nov. 3

1)
(1 pt) The data file trap.in contains a table of values for some unknown function. Write a program that will count the number of lines in the data file.
2)
(6 pts) You will need the answer from Problem 1 to do this problem. Write a program that will use one loop to read in the data values in trap.in into two array variables. This loop should look something like:
   DO i = 1,.....
      READ(*,*) x(i),y(i)
   ENDDO
In a second loop, compute the area under the function using the trapezoidal rule. Could you use Simpson's rule for this problem? Why or why not?
3)
(3 pts) Write a program that will swap two variables. For example, suppose you declare a and b to be integers and set a = 5 and b = -9. When your program terminates, the value of a should be -9 and the value of b should be 5. Your program should work for any values of a and b.





2017-11-01