There is a slight part of my program that is not working correctly and I just cannot work out why
String KEY = "hello"
for (int h = 0; h < message.length(); h++)
{
keyWord += KEY.charAt(h);
}
Once I run the loop the keyWord string does not hold the letters it should of hello, but if I bypass it and just use KEY in my program it will work fine.
Could someone shed some light as to what I am doing wrong please?
I now see what you are trying to do, you are creating a cipher.
For anyone who is not sure the
%or modulo operator returns the remainder of division. For instance 4 % 5 = 4 as 4 / 5 leaves a remainder of 4 because it goes into it 0 times. Now 6%5 = 1 as 6/5 = 1 R1 .