Hey guys! I'm fairly new to java. For my course at uni I've got to design a caeser box that will encrypt a word and decrypt it. I pretty certain I've got the logic behind it so I won't need someone to give me the full code haha that would be cheating anyway. I like a challenge. Anyway.
I've started my code by reading the string, I've eliminated white spaces and its all lower case. After that I put the string in a char array with a total length of the string without whitespaces. after this I declared a grid with dimensions of x*x where x is the closest root of the length of the string without whitespaces.
So upto now its all good but this is where the problem starts ...
I've done 2 for loops to create the grid and then I'm increasing the rows and columns by 1 (ofc) and the values of each grid is equal to the elements of my char array that contains the string.
this might seem messy but I'll paste the problematic code part:
My question is how can I increase each element of the char array by 1.for(int row = 0; row<plainTextGrid.length; row++){ for(int column = 0; column <plainTextGrid.length; column++){ plainTextGrid[row][column]= plainTextArray[0];// this is where I want to set each element to a position on the grid. plainTextGrid is the grid, and plainTextArray is the array System.out.print(plainTextGrid[row][column] + " "); } System.out.println(); }