I am trying to pass in the same array with different data types using template, I do not see the issue Please help
1 2 3 4 5 6 7 8 9 10
|
int main() {
int arr[5] = { 4, 1, 13, 3, 2 };
double arr[5] = { 1.1, 4.1, 8.1, 5.2, 2.3 };
string arr[5] = { "the", "student", "is", "in", "class" };
cout<<maxFunction<double>(arr)<<endl;//getting an error does //not match argument list
cout<<maxFunction<int>(arr)<<endl;
system("pause");
return 0;
|
Last edited on
How is this maxFunction declared ?
Also you cannot have more than one variable with the same name.
Thanks,
Can i pass a string into the same function in hopes to alphabetize it or should i make a separate function for that
Last edited on
You need a seperate function for that. maxFunction accepts only arrays.