Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming Modify arrtemp.cpp by removing the preassignment of the data for each array and by adding five new function templates. The first new function

C++ Programming

Modify arrtemp.cpp by removing the preassignment of the data for each array and by adding five new function templates. The first new function template should allow the user to enter the array smallest and largest values excluded from the average calculation. The third new function template should sort the array data array in descending order. The fourth new function template should save the array data to a text file. The fifth new function template should retrieve the array data from the text file. Output should include the average of each numerical array with the smallest and largest values excluded and all three arrays being printed out in descending order twice, once before the text file is saved and once after the array is retrieved from the text file. (Warning - make sure to include the line 'template ' before each function template.) Each array should be saved to a separate text file. You will need to submit the text files with the program.

arrtemp.cpp:

#include using namespace std;

template void printarray (T *a, const int n) { for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl; }

int main() { const int n1 = 5, n2 = 7, n3 = 6; int a[n1] = {2, 4, 6, 8, 10}; float b[n2] = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7}; char c[n3] = "HELLO";

cout <<"the integer array" << endl; printarray(a, n1);

cout <<"the float array" << endl; printarray(b,n2);

cout <<"the string is" << endl; printarray(c,n3); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago

Question

Explain the various methods of job evaluation

Answered: 1 week ago