Hello
I need to create a table (using multidimensional array/vector) that contains datas in a spiral form.
Here's my work so far:
int current_char = 0, rows = 3, columns = 4;
string input = "abcdefghijkl";
vector< vector<string> > str_table(rows, vector<string>(columns));
for(int i = 0; i < (int)input.length(); i++)
{
splitted_input.push_back(input.substr(i, 1));
}
for(int x = 0; x < rows; x++)
{
for(int y = 0; y < columns; y++)
{
str_table[x][y] = splitted_input.at(current_char);
current_char++;
}
}
and it produces... (illustrated below)
Now my problem is making it spiral..
[img]http://img210.imageshack.us/img210/3671/tospiralub1.jpg[/img]
any ideas?
(sorry i made the illust. using mspaint :p)