Question: Using c++ Functions: Use ptrtest1.cpp to test part 1 Use ptrtest2.cpp to test part 2 Results for part 1&2 should look exactly like this 1.

Using c++  Using c++ Functions: Use ptrtest1.cpp to test part 1 Use ptrtest2.cpp
Functions:
to test part 2 Results for part 1&2 should look exactly like
Use ptrtest1.cpp to test part 1
this 1. (50 points] Complete ptrfuncs.cpp to implement the first four functions
declared in ptrfuncs.h. All of the functions in ptrfuncs.h involve C++ pointers.
Use ptrtest2.cpp to test part 2
Most of them also manipulate a collection of consecutively stored double values
Results for part 1&2 should look exactly like this
much like a double array. A pointer to the first value provides

1. (50 points] Complete ptrfuncs.cpp to implement the first four functions declared in ptrfuncs.h. All of the functions in ptrfuncs.h involve C++ pointers. Most of them also manipulate a collection of consecutively stored double values much like a double array. A pointer to the first value provides access. Hint/reminder: p is the same as pl 01, and plij is the same as (p i) Begin with this ptrfuncs.cpp skeleton and follow any instructions in that file. For this part, just implement the first four functions: double sum (double values int n) find and return the sum of the n values the pointer holds the address of the first one o double maxP tr (double values int n) find the maximum value, and return a pointer to its address. double *minPtr (double values int n) ditto the minimum value. double valueDiff(double left double right) find and return the difference between the two double values as left value minus right value Use ptrtest1.cpp to test your implementations. You can compile it and link to your functions, and then run it as follows cpp ptrfuncs.cpp gt -o ptrte Iptrtestl Your results must match our ptrtest1 results exactly. 2. (50 points] After your Part 1 testing is complete, implement the other two functions: o void printTable (double values int n, int perRow) print the values as a neatly-formatted table with the specified number of values per row, and each value in a field of width 10 showing 2 significant digits. void sortvalues (double *first double *last) sort the values from first through last, where these parameters are pointers into the same dynamic array. Write your own sorting routine, such as the selection sort procedure presented in Chapter 7-but remember you should use pointer notation, not array notation to do it. You may write helper functions if you want, but they should use pointer notation too Use ptrtest2.cpp to test your implementations. Compile it as you did above, subsituting ptrtest2 for ptrtest1 in both places. This program expects three command line arguments in this order: an input filename, the number of values to read from the file, and the number of values to print per row. Here are two sample runs using data1.bxt as the input file test2-out.txt. Your results must exactly match if we test your program the same way, but you should ensure the program works for different inputs too

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 Databases Questions!