Question: Write a C + + program to 1 ) read the real - valued data from the input text file called filexx ( where xx

Write a C++ program to
1) read the real-valued data from the input text file called filexx (where xx is a number).
2) apply the following filter to the data
filtered_output(0)= unfiltered_input(0)
filtered_output(n)=0.9375* filtered_output(n-1)+0.0625* unfiltered_input(n)
3) print the original data and the filtered data into the output file called outputfilexx (where xx is a number). The following format should be used
HH.H TT.TTTTTT
where
HH.H represents original data
TT.TTTTTT represents the filtered data with 6 decimal digits of precision.
Each entry should be separate by a single tab character (\t).
For example, if the original data is
67.7
67.6
67.7
67.6
67.6
67.3
67.4
the output is
67.767.700000
67.667.693750
67.767.694141
67.667.688257
67.667.682741
67.367.658819
67.467.642643
Observations:
1) the first data (at index 0) has no filter
2) the second data on the second column 67.693750 is from
0.9375* filtered_output(n-1)+0.0625* unfiltered_input(n)=0.9375*67.7+0.0625*67.6
3) the third data on the second column 67.694141 is from
0.9375* filtered_output(n-1)+0.0625* unfiltered_input(n)=0.9375*67.693750+0.0625*67.7

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!