answersLogoWhite

0


Best Answer

#include<iostream>

#include<vector>

#include<string>

#include<algorithm>

// forward declarations

void sort(std::vector<int>&);

void sort(std::vector<std::string>&);

int main()

{

std::vector<int> int_array = { 7, 3, 8, 6, 2, 9, 1, 4, 0, 5};

std::vector<std::string> str_array = { "John", "Bill", "Alan", "Craig"};

sort (int_array);

sort (str_array);

}

void sort(std::vector<int>& arr)

{

std::sort (arr.begin(), arr.end());

}

void sort(std::vector<std::string>& arr)

{

std::sort (arr.begin(), arr.end());

}

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can write a c plus plus program to sort an integer array and name array using function overloading use dynamic memory allocation for both the array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is function overloading in c language of computer?

There is no such thing as function overloading in C; that is a feature of C++. Function overloading allows us to provide two or more implementations of the same function. Typically, we use function overloading so that the same function can cater for different types. For instance, we might provide one implementation that is optimised to handle an integer argument while another is optimised to handle a real argument. We can also use function overloading to provide a common implementation of a function which can then be invoked by overloads that handle the low-level type conversions.


What is the process of allocation of memory for an integer type variable?

To dynamically allocate memory, use the following function (stdlib.h I believe): int *variable1 = malloc(sizeof(int));


Is the greatest integer function a continuous funcion?

No. It has a discontinuity at every integer value.


How do you print size of integer?

the size of an integer is determaind by using the function "sizeof(c)",here 'c' is any integer.


What is the greatest integer function of -50.95?

-51


How do declare function pointer having two integer parameters and returning integer pointers?

// declare a function int* function(int, int); or int* (function)(int, int); // declare a pointer to a function int* (*pointer_to_function)(int, int);


Why you use 'integer' before function in C language?

To specify the return-type of the function.


What is a function used to convert ASCII to integer?

atoi


The greatest integer function and absolute value function are both examples of functions that can be defined as what?

Both the Greatest Integer Function and the Absolute Value Function are considered Piece-Wise Defined Functions. This implies that the function was put together using parts from other functions.


What is the INT functions?

The INT function is to convert something into an integer. An integer is a number that goes out two decimal places.


What is bracket function?

x = the largest integer not exceeding x


What is 656565656?

It is 656565656. It is an integer having a core integer value of 5. It may be an alphanumeric string that has no function whatever as a number.