Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Operational Objectives: Implement and test the function templates Mean, Median,

ID: 651147 • Letter: O

Question

Operational Objectives: Implement and test the function templates Mean, Median, and InsertionSort.

Deliverables: stats.t

Procedural Requirements

Create the file stats.t defining and implementing function templates for Mean, Median, and InsertionSort. Be sure to make log entries for all work.

READ the test program stattest.cpp. Note that stattest.cpp is set up so that you can choose any one of 19 different numerical types by uncommenting one of 19 possible typedef statements defining NumberType. Start your testing by creating 19 different tests stattest1.cpp, ... , stattest19.cpp, where stattestX.cpp uses the number type X.

Test your implementation using the supplied client program stattest.cpp. There should be 19 versions of stattest.cpp, one for each numerical type listed in the program header documentation, named as in the distributed makefile. Again be sure to make log entries appropriately.

Turn in the file stats.t

Code Requirements and Specifications

In file stats.t define and implement function templates with these prototypes:

The behavior and semantics are similar to the non-template functions from Homework 2, using vector instead of array to contain data.

Be sure your code conforms to the standards in C++ Style (available also through the Course Organizer).

Be sure that you have tested your code for syntax errors with the supplied test harness as well as your own test program, using the supplied makefile with warning flags set. All warnings should be eliminated.

Be sure that you have tested your code for both logic errors with the supplied test harness as well as your own test program.

Be sure that you have tested your code for genericity using all 19 numerical types signed char, short, int, long, unsigned char, unsigned short, unsigned int, unsigned long, float, double, and long double.

Hints

Be sure your data files are varied, so that int and float types get exercised with both even and odd sizes. If you get no errors and no differences to screen, you are in good shape.

stattest.cpp

#include
#include   
#include
  
#include
  
// uncomment one of these to define the type of data:   
  
// typedef signed char NumberType; // 1
// typedef short NumberType; // 2
// typedef int NumberType; // 3
// typedef long NumberType; // 4
  
// typedef unsigned char NumberType; // 5
// typedef unsigned short NumberType; // 6
// typedef unsigned int NumberType; // 7
// typedef unsigned long NumberType; // 8
  
// typedef float NumberType; // 9
// typedef double NumberType; // 10   
// typedef long double NumberType; // 11   
  
// typedef int8_t NumberType; // 12   
// typedef int16_t NumberType; // 13   
// typedef int32_t NumberType; // 14   
// typedef int64_t NumberType; // 15   
  
// typedef uint8_t NumberType; // 16   
// typedef uint16_t NumberType; // 17   
// typedef uint32_t NumberType; // 18   
// typedef uint64_t NumberType; // 19   
  
template   
void ReadData (std::vector& v, std::istream& is)   
{   
T item;   
while (is >> item)
v.push_back(item);
}   
  
template   
void DisplayData (const std::vector& v, std::ostream& os, char ofc)
{   
for (typename std::vector::const_iterator i = v.begin(); i != v.end(); ++i
)   
{   
if (ofc != '') os << ofc;   
os << *i;   
}   
}   
int main(int argc, char* argv[])
{   
std::vector input(0);   
std::ifstream ifs;
if (argc < 2) // expects keyboard input   
{   
if (sizeof(NumberType) == sizeof(char))   
// keyboard input of type char is un-intuitve   
// when interpreted as a numerical type   
{   
std::cout << "Please provide filename containing data. ";
exit(EXIT_SUCCESS);   
}   
std::cout << "Enter numerical data: ";
ReadData(input, std::cin);
}   
else // reads from file - command line argument   
{   
ifs.open(argv[1]);
if (ifs.fail())   
{   
std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";   
exit (EXIT_FAILURE);   
}
ReadData(input, ifs);
}

// show data in original object:   
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';   
// */

// display mean and median:
std::cout << "Mean: " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:   
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';   
// */

return 0;

Explanation / Answer

runtests.sh

stats.cpp

#ifndef STATS_T
#define STAT_T

#include <iostream>
#include <vector>

template < typename T >
long double Mean (const std::vector<T>& v); // returns mean of elements of v

template < typename T >
long double Median (std::vector<T>& v); // returns median of elements of v

template < typename T >
void InsertionSort (std::vector<T>& v); // implements insertion_sort algorithm

template < typename T >
long double Mean(const std::vector<T>& v)
{
long double total = 0;
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    total += *i;
}
return (total / v.size());

}

template < typename T >
long double Median(std::vector<T>& v)
{
InsertionSort(v);
if ((v.size() % 2) == 1)
    return (v[((v.size() + 1) / 2) - 1]);
else
{
    return (v[(v.size() / 2)] + v[(v.size() / 2) - 1]) / 2.0;
}
}

template < typename T >
void InsertionSort(std::vector<T>& v)
{
for (size_t i = 1; i < v.size(); ++i)
{
    T currentValue = v[i];
    size_t element = i;
    while (element > 0 && currentValue < v[element - 1])
    {
      v[element] = v[element - 1];
      --element;
    }
    v[element] = currentValue;
}
}

#endif

****************

****************


stattest1.cpp


#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

// uncomment one of these to define the type of data:

typedef   signed char    NumberType; // 1
// typedef   short          NumberType; // 2
// typedef   int            NumberType; // 3
// typedef   long           NumberType; // 4

// typedef   unsigned char NumberType; // 5
// typedef   unsigned short NumberType; // 6
// typedef   unsigned int   NumberType; // 7
// typedef   unsigned long NumberType; // 8

// typedef   float          NumberType; // 9
// typedef   double         NumberType; // 10
// typedef   long double    NumberType; // 11

template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

*****************


stattest2.cpp


#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

// uncomment one of these to define the type of data:

// typedef   signed char    NumberType; // 1
typedef   short          NumberType; // 2
// typedef   int            NumberType; // 3
// typedef   long           NumberType; // 4

// typedef   unsigned char NumberType; // 5
// typedef   unsigned short NumberType; // 6
// typedef   unsigned int   NumberType; // 7
// typedef   unsigned long NumberType; // 8

// typedef   float          NumberType; // 9
// typedef   double         NumberType; // 10
// typedef   long double    NumberType; // 11

template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

*************

stattest3.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   int            NumberType; // 3
template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

****************

stattest4.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   long           NumberType; // 4

template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

***************

stattest5.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   unsigned char NumberType; // 5
template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

**************

stattest6.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   unsigned short NumberType; // 6
template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

*****************

stattest7.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   unsigned int   NumberType; // 7
template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char)){
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

***************

stattest8.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   unsigned long NumberType; // 8

template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

*************

stattest9.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   float          NumberType; // 9
template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

*************

stattest10.cpp

#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>

typedef   double         NumberType; // 10
// typedef   long double    NumberType; // 11

template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

****
stattest11.cpp
#include <cstdlib>
#include <iostream>
#include <fstream>

#include <stats.cpp>
typedef   long double    NumberType; // 11

template <typename T>
void ReadData(std::vector<T>& v, std::istream& is)
{
T item;
while (is >> item)
    v.push_back(item);
}

template <typename T>
void DisplayData(const std::vector<T>& v, std::ostream& os, char ofc)
{
for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
{
    if (ofc != '') os << ofc;
    os << *i;
}
}

int main(int argc, char* argv[])
{
std::vector<NumberType> input(0);
std::ifstream ifs;
if (argc < 2) // expects keyboard input
{
    if (sizeof(NumberType) == sizeof(char))
      // keyboard input of type char is un-intuitve
      // when interpreted as a numerical type
    {
      std::cout << "Please provide filename containing data. ";
      exit(EXIT_SUCCESS);
    }
    std::cout << "Enter numerical data: ";
    ReadData(input, std::cin);
}
else // reads from file - command line argument
{
    ifs.open(argv[1]);
    if (ifs.fail())
    {
      std::cerr << "** Unable to open file " << argv[1] << " -- please try again ";
      exit(EXIT_FAILURE);
    }
    ReadData(input, ifs);
}

// show data in original object:
std::cout << "Data as entered: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

// display mean and median:
std::cout << "Mean:   " << Mean(input) << ' ';
std::cout << "Median: " << Median(input) << ' ';

// display data after calls:
std::cout << "Data after sort: ";
DisplayData(input, std::cout, ' ');
std::cout << ' ';
// */

return 0;
}

***********

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote