I'm trying to convert int x and y arrays to string using a sample code found online.
string Square::int2string (int x[])
{
string returnstring = "";
for (int i=0; i < 4; i++)
{
returnstring += itoa(x[i]);
return returnstring;
}
}
but hit with the following error.
Square.cpp:30:8: error: prototype for ‘std::string Square::int2string(int*)’ does not match any in class ‘Square’
Square.h:21:10: error: candidate is: std::string Square::int2string()
I declared the following in header file.
string int2string();
The error is due to variable type does not match. Is there a better way to convert int array to string, please?
What I'm trying to achieve is a string printed in the following manner:
Point[0] (x1,y1)
Point[1] (x2,y2)
and so on.