Question: hello. i am writing a program to read numbers from an input file and perform various mathematical operations being performed on them. here are the

PURPOSE: Reinforce the concepts of functions; also uses while !eof loop pattern and iomanip.h in C++. PROBLEM: For this program, you will read integers from an input file. For each integer, you will evaluate several functions, their inverses, function compositions and function compositions with their inverses. Specific requirements: Create a program lastname_prog2Orig.cpp for functions f and g shown in my sample input below. Print the functions and determine (by hand) their inverses and print them. You may not use arrays or vectors. All of the calculations are done "on-the-fly. Have six functions - one for opening files, one for printing the headings, four for the functions. Make input values double. Use a leof loop. Values must be formatted so decimal points line up. Use the filenames specified in this assignment Rewrite the program with a different pair of functions. To do this: o Open your file lastname_prog2Orig.cpp and save as lastname_prog2Mod.cpp in the same folder project folder. Remove the original program from the project in solution explorer (do NOT delete it), and add existing file for the modified program to solution explorer. o Change your functions f and g based on the first letter in your last name as described below: OAK f(x) = 4x + 1 g(x) = x - 1 OL-Z f(x) = x + 6 g(x) = 7x INPUT FILE: P2Fn.dat for both your original and modified programs: 3 6.5 1 0 5 18 6 -4 f(x) 3x + 5 g(x) = 3x/5 + 1 f-1(y) = (y-5)/3 8-1(y) = (5y-5)/3 g(x) fInv(y) gInv(y) f(g(x)) g(f(x)) fInv(f(x)) gInv(g(x)) f(x) 3.00 6.50 1.00 0.00 5.00 18.00 6.00 -4.00 14.00 24.50 8.00 5.00 20.00 59.00 23.00 - 7.00 2.80 4.90 1.60 1.00 4.00 11.80 4.60 -1.40 -0.67 0.50 -1.33 -1.67 0.00 4.33 0.33 -3.00 3.33 9.17 0.00 -1.67 6.67 28.33 8.33 -8.33 13.40 19.70 9.80 8.00 17.00 40.40 18.80 0.80 9.40 15.70 5.80 4.00 13.00 36.40 14.80 -3.20 3.00 6.50 1.00 0.00 5.00 18.00 6.00 -4.00 3.00 6.50 1.00 0.00 5.00 18.00 6.00 -4.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
