Arrays and Function Overloading Sort

I have no idea where to start with this one?!!!

1. Create a main function in a main.cpp file. The main function should look as follows int
main() {return 0;}
2. Forward Declare the functions.
3. Declare 3 sort functions. These sort functions should take an array of varying types. The
types include int, char, string. The sort functions should return a sorted array. Each sort
function should take in a reference int that will hold the size of the returned array.
4. The int sort function should sort the supplied array from least to largest. The char sort
function should sort the alphabet from a-z. The string sort should sort strings from smallest to
largest.
5. The main function should demonstrate the all of the sorting functions. The sort functions
can be demonstrated through user input or programmer defined arrays. The results should be
outputted to console.




This is what I have so far, am i supposed to include something in the main? :

#include <iostream>
using namespace std;

void num();

void numb(int * a, int& size);
void numb(char * a, int& size);
void numb(string * a, int& size);

int main(){


}
Last edited on
1 & 2 should be done, did you try starting there?

3..

void sort(int* p, int &size); //reference is useless, value in == value out, why ref?
void sort(char* p, int &size); //overloaded: same name, different types.
void sort(string* p, int &size);

4 isnt even a task, its how to finish 3

5) testing in main ...
Technically, in the instructions #2 and #3 are the same thing.

To go along with @jonnin's response, #3 should actually say "Define 3 sort functions." Then #4 would be the completion of #3.

Registered users can post here. Sign in or register to post.