#include <iostream>
usingnamespace std;
template <class T,size_t S>
int ArraySize(T (&Table)[S])
{
returnsizeof(Table)/sizeof(*Table);
}
template <class T,size_t S>
int FindHighest(T (&Array)[S])
{
T Highest=0;
for (int i=0 ; i<ArraySize(Array) ; i++)
{
if (Highest<Array[i])
Highest = Array[i];
Array[i]=0;
}
return Highest;
}
template <size_t S>
int RA(int (&Table)[S])
{
int TSize = ArraySize(Table);
int Arranged[TSize];
for (int Re=0 ; Re!=TSize ; Re++)
{
Arranged[Re]=FindHighest;
}
return Arranged;
}
int main()
{
int Original[]={5,2,7,2,1,8,7,3,9,0};
int Second[ArraySize(Original)];
Second = RA(Original);
for (int i=0 ; i<ArraySize(Second) ; i++)
{
cout << Second[i] << endl;
}
return 0;
}
I am still not familiar with what the error means.
43 9 [Error] incompatible types in assignment of 'int' to 'int [(((sizetype)<anonymous>) + 1)]
45 35 [Error] no matching function for call to 'ArraySize(int [(((sizetype)<anonymous>) + 1)])
32 15 [Error] cannot resolve overloaded function 'FindHighest' based on conversion to type 'int'
35 9 [Error] invalid conversion from 'int*' to 'int' [-fpermissive]