Polybius Square Cipher Functions

I'm working on some polybius functions-one of them is supposed to fill in the grid with a string and the other is supposed to find the location of a given character in the grid and print out its coordinate location.

For the first function I posted I am getting an error "Expected body of lambda expression" on line 6.

string findInGrid(char c, char grid[SIZE][SIZE]) { // TODO: implement

// returning a string to avoid compile error

for (int row=0; row<SIZE; row ++) {
for (int col=0; col < SIZE; col ++) {
if ((grid[row][col]) == c) {
return [row][col];
}
}
}



return "";
}

This function is supposed to fill in a 6 by 6 grid with a string.

void fillGrid(char grid[SIZE][SIZE], string content) { // TODO: implement

int i=0;

for (int row=0; row < SIZE; row++) {
for (int col=0; col < SIZE; col++) {
grid[row][col]=content[i];
i=i+1;
}

}
}
return [row][col];
I want to know why do you think that that does what you want.
you said that you'll return a string, `row' and `col' are numbers so you simply enclose them in brackets and expect that to work...


> on line 6.
¿do you see line numbers in your post?
Topic archived. No new replies allowed.