Last active
December 6, 2018 00:55
-
-
Save nbervar21/2f34381e9f8e5edc0dbd2610c5474303 to your computer and use it in GitHub Desktop.
caesar_oneline.c - compact caesar cipher in c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> // caesar_oneline.c by Nick "the one-line god" Bervar | |
#include <stdio.h> | |
int main(int c, char *v[]) | |
{ | |
for (char i = ((c == 2) ? 0 : ((printf("Usage: ./caesar k\n") * 0) + INT_MAX)), *p = (c == 2) ? get_string("plaintext: ") : ""; p[(int)i] != '\0'; i += ((int)i == INT_MAX) ? 0 : ((printf("%s%c%s", (i < 1) ? "ciphertext: " : "", ((p[(int)i] >= 'A' && p[(int)i] <= 'Z') || (p[(int)i] >= 'a' && p[(int)i] <= 'z')) ? (p[(int)i] - ((p[(int)i] - 'A') % ('a' - 'A'))) + ((((p[(int)i] - 'A') % ('a' - 'A')) + atoi(v[c == 2 ? 1 : 0])) % 26) : p[(int)i], (p[(int)i + 1] != '\0') ? "" : "\n") * 0) + 1)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment