hi,
need help on this:
ned to convert from an array to a list and back.
I wrote this function:
Code:
/*
* inputs:
* coordX: column;
* coordY: line;
* nc: number of colums
*
* returns: int
*
*/
int XYtoInt(int coordX, int coordY, int nc){
return (coordY * nc + coordX -1);
}
it works fine but the other way arround is giving me sleeping problems.
I was thinking something about this:
Code:
/*
* inputs: integer
* returns: X coordinate
*/
int inttoX(int n, int nc){
int coordX;
coordX = ...............;
return coordX;
}
/*
* inputs: integer
* returns: Y coordinate
*/
int inttoY(int n){
int coordX, coordY;
coordY = ...............................;
return coordY;
}
I don't need the code, just na idea to continue... i'm a little blocked.
tanks.
regards