March 14th, 2003, 02:29 AM
how do i rotate an array in C++?????
can somebody tell me how to rotate a c++ array x times to the left or x times to the right?????
please i really need to know
March 14th, 2003, 03:44 AM
What exactly do you mean by "rotate". Please be more specific.
March 14th, 2003, 08:37 AM
Sounds like he means in the graphical sense.
The easiest way to code it would probably be to loop through the array, and turn all of the values into an ordered list... Then read the list back into the array with different loop conditions... Just some psuedocode stuff here...
There are probably some off-by-one errors in there, but I'm lazy.
//array is called Array[Row][Column]...
// read it
//Write it -- Rotation to the right
Array[j][i] = list.getNext();
[HvC]Terr: L33T Technical Proficiency