Explore BrainMass

C++ pointer/array workout

Write the following C++ routines using pointers only. Do not use any [] 's in your code.

1. Write table_fill function that will fill a table of size with the value num.
table_fill(array, size, num);

2. Write table_print function to print out a table of size. Print output on one line.
table_print(array, size);

3. Write table_print_rev function to print out a table of size in reverse order. Print output on one line.
table_print_rev(array, size);

4. Write table_add1 function that will add one to each element in array of size.
table_add1(array, size);

5. Write table_addV function that will add val to each element in array of size.
table_addv(array, size, val);

6. Write table_max function to find the largest value in an array.
int table_max (array, size);

7. Write table_min function to find the smallest value in an array.
int table_min (array, size);

8. Write table_avg function to find the average of an array.
int table_avg(array, size);

9. Write table_find function to find a value of val in the array of size and returns the position of where the value is, if not found, returns -1.
int table_find(array, size, val);

Solution Summary

Since system has removed the .cpp attachment from solution and instead placed the c++ code in solution text, kindly copy the c++ code from there into a text file with the extension .C or .cpp (indicating C++ code). Kindly verify the code after copying, whether it is same as the code shown in the solution on screen. At times HTML formatting of the text can mess up the C/C++ code.