Skip to main content
gamedev.net
🔒 Locked

Matrix question please

Started by jumbolaya 4 replies 950+ views
Original Post
jumbolaya
jumbolaya
anyone have thoughts or solutions on the problem below? write a function with the following declaration that, given a matrix of integers, builds a string with the entries of that matrix appended in clockwise order. For instance, the 3x4 matrix below: 2, 3, 4, 8 5, 7, 9, 12 1, 0, 6, 10 would make the string “2, 3, 4, 8, 12, 10, 6, 0, 1, 5, 7, 9”. void BuildStringMatrix(int* Matrix, int NumRows, int NumColumns, char* OutBuffer) thanks
trojanman
trojanman
That would be dependent on your design for the Matrix wouldn't it? 1D array, 2D array, vector of arrays, vector of vectors, etc...

Perhaps you should be more clear on how you store your Matrix.
Luke1410
Luke1410
sounds like homework to me :-)

hint: I'd try my luck with a recursion

should be the most impressive solution, when you present it to your teacher/tutor :P
jumbolaya
jumbolaya
yes, im not denying its a homework question at all, lol. i just need help with it and can't figure it out, its the only one i have no clue for, i'm stumped :/
Sneftel
Sneftel
Write out the matrix on a piece of paper and start crossing out entries in order. After you cross out each one, see if the remaining integers form a simple, useful shape. In particular, see what it looks like right after you cross out the 8, the 10, the 1, and the 5.
Luke1410
Luke1410
sorry mate, but I'm neither seeing the point in spending my time to do ur homework, nor do I think that would do you any good...

maybe you'd start trying some stuff out, present your failed attempts and describe why/where you didn't get along...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.