"C" for engineers homework. COP 2270
1. (Writing to a file). A damped sine wave is a sinusoidal function whose amplitude approaches zero as
time increases.
( ) ( ( ))
Write a program that will generate a data file containing 100 value points (Y(t)) from a damped sine
function. Make use of the math library functions for the exponent and sine calculations. Use the
following formula for time: t = (k-1)/10.0 where 1 ≤ k ≤100. Make sure that each record in your data file
contains the fields for time and its corresponding Y(t).
2. (Reading from a file). The data file power1.dat contains a power plant output in megawatts over a
period of 8 weeks. Each row of data contains 7 integers that represent 1 week’s data. Write a program
that will compute and print to a file and to the screen the average power output over this period of
time. Also print the number of days with greater-than-average power output.