Caesar Cipher Text

Hello I am currently struggling very hard on this program. I have to make a caesar cipher program and I can not figure out how to make the program cipher once.


String Alpha = "abcdefghijklmnopqrstuvwxyz";
int i = 0;
void setup() {
  size(800, 375);
  textSize(50);
}

String Cipher = "";
String text = "";
String test = "";
String number = "";
void keyPressed() {
  if (key != CODED) {
    text += key;
    Cipher += i;
    if (key == '\n') {
      text = "";
      Cipher = "";
    }
      if (key >= '0' && key <= '9') {
        number += key;
      }
    }
  }
void draw() {
   for (int Cipher = 0; Cipher < Alpha.length(); Cipher++)
    background(100);
    fill(255, 255, 255);
    text("Encrypter", 280, 50);
    text("shift:" + number, 600, 50);
    text("Plain Text:" + text, 30, 150);
    fill(216, 229, 42);
    text("Caesar:" + Cipher, 30, 250);
  }

1 Like
int i = 0;
String Cipher = "";

// and in keyPressed you do:
    Cipher += i;

why?

you know already what you have to code?
see https://www.geeksforgeeks.org/caesar-cipher-in-cryptography/ here

1 Like