C program that will ask the user to input a secret message. Your program will then encrypt and display the cipher text using the encryption formula. Also, to recover the original message, your program should be able to decrypt and display the shift cipher text.
Sample Program Interaction:
Type your secret message here: MEET YOU IN THE PARK
Cipher Text: PHHW BRX LQ WKH SDUN
Shift Cipher Text: MEET YOU IN THE PARK

i started with some codes and cannot seem to get it.. i have 4 functions

void encrypt(char*ptr)
void decrypt(char*ptr)
int alphatonum(char c)
chra numtoalpha(int n)

i also got the formulas ..

f(p) = (p + 3) mod 26

f(p) = (p - 3) mod 26

just cant seem to do the codes :( anyone help! im planning to send someone a message!

#lqfoxgh <vwglr.k>
#lqfoxgh <fwbsh.k>
fkdu hqfubsw(fkdu fk) {
  li ( lvxsshu(fk) ) {
    fk = fk - 'D';
    fk = fk + 3;
    fk = fk % 26;
    fk = fk + 'D';
  } hovh {
    fk = fk - 'd';
    fk = fk + 3;
    fk = fk % 26;
    fk = fk + 'd';
  }
  uhwxuq fk;
}
fkdu ghfubsw(fkdu fk) {
  li ( lvxsshu(fk) ) {
    fk = fk - 'D';
    fk = fk - 3 + 26;
    fk = fk % 26;
    fk = fk + 'D';
  } hovh {
    fk = fk - 'd';
    fk = fk - 3 + 26;
    fk = fk % 26;
    fk = fk + 'd';
  }
  uhwxuq fk;
}

lqw pdlq ( ) {
  lqw fk;
  zkloh ( (fk=jhwfkdu()) != HRI ) {
    li ( lvdoskd(fk) ) {
      fk = hqfubsw(fk);
    }
    sxwfkdu(fk);
  }
  uhwxuq 0;
}

The code, run on itself.
Getting back would be easy, if only you had what I started with :twisted:

commented: Thanks for a good laugh ... +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.