Well, hi, I wanted to make a program, which turns normal words into a Caesar shift.
So...
HELLO
BECOMES;
JGNNW
That is with a shift of two.
I did not want to include IF statements in this, as that is 'lazy programming'
I have made a program which will convert one letter, but no more...
So... say, I typed A in, C would come out.
But, if I typed ABC in a really wierd symbol would come out...
The way that this works is by taking A, converting it into it's ASCII code (65) adding two (67) and then converting back into letter form...
So, a summary, I just want this code to be adapted so that it will convert more than one letter, I think I will need to use a loop, but I am unsure on how to implement this into my code, as I have not been doing programming for very long...
Program shift;
VAR
asciicode, number : Integer;
letter, asciiletter, newcode : Char;
Procedure input;
BEGIN
Writeln ('Enter a word');
readln(letter);
end;
Procedure convert;
BEGIN
asciicode := ord(letter);
asciiletter := chr(number);
newcode := chr(asciicode+2);
end;
Procedure output;
BEGIN
Writeln ('The ASCII code of ',letter,' is ',asciicode);
Writeln (newcode);
Readln;
end;
BEGIN
input;
convert;
output;
END.