Caesar Cipher C Program
Vložit
- čas přidán 28. 12. 2016
- Caesar cipher c program for lower case letters.
See video on Viginere Cipher:
czcams.com/users/edit?o=U&vide...
Code:
github.com/randerson112358/C-...
Please Subscribe !
►Become a Patreot: patreon.com/randerson112358
►Website: everythingcomputerscience.com/
►Support this channel on Patreon: / randerson112358
►Support this channel get a ceasar cipher decoder ring: www.amazon.com/gp/product/B00...
Hello, thanks for the solution. I don't know if comments are still answered, but how come you subtract 97 and then add them again after? I don't clearly get the idea, as removing those would still equal to the same result? At least in the tests I've done so far :-)
thank you broh , really nice logic ..but u may wanna add a condition for the spaces that are going to be typed , if the message is going to contain a sentence with words
Great video and very helpful am stuck and not sure why.
I enter my message and the encrypted message comes back as : The encrpted message is: , cypher, cypher, cypher, cypher, cypher
Any help would be much appreciated.
I tried this and my output just cycles through the characters for example "hello" came out as "ellox" any tips?
Hi Oliver,
You tried this exact code and got "ellox" from "hello" ?
why do you use fgets instead of scanf? is there a difference
There is a difference, I am using it to be able to read in a line of text such as "hello world notice the space".
You can not scan in the whole string using scanf just the "hello" portion will be read.
But if you just want to scan in one string like "hi" then you can use the scanf function and will have to change the caesarCipher function to the following:
Note: All I did is delete the '-1' from the while loop.
void caesarCipher(char* plainText, int key){
int i=0;
int cypherValue;
char cypher;
while( plainText[i] != '\0' && strlen(plainText) > i){
cypherValue = ((int)plainText[i] -97 + key) % 26 + 97;
cypher = (char)(cypherValue);
printf("%c", cypher);
i++;
}
printf("
");
}
Thanks for watching and the comment!
thanks
May I ask why we need to subtract 1 from strlen(plaintext)? Why need minus 1? I didn't get it😭😭 can someone explain to me please
by default indexing of char pointer or array begin from 0 index that's why we are subtracting it with -1 to balance the length with the char array. It's similar to loop when we start indexing from 0 than we put only less than operator (
My output is infinite times running why?
Que buen video wey la neta te rifas un chingo, a huevo necesitaba esto para entregar un proyecto y tu explicas bien vergas, dices paso a paso todo y eso esta bien chingon we la neta te dejo un pinche likesote a la verga eres la verga jalate a la verga compa fierro pariente cero miedo si o no compa la neta al chile pelon si wey
can u plzz zoom in a bit cause am watching on a 5.5 inch and still cant see btw lol 😂
thnnx bro for this useful video bt it would be better using a screenrecoder coz i couldnot see clearly......
Thanks for the feedback this was an older video.
damn how many years have you been reading about c?
I first started learning C-Programming about 10 years ago.
Sir ı have a assigment just like you did. may you help me if you write your e-mail, I can send you pdf file
Its not very much clear in your video, video capacity too, small