Jump to content

Caesar Cipher Program

Hydra

I have to code a Caesar cipher program for my assessment. Which basically off sets the alphabet by a set amount. For example, an offset of 1 would make A go to B, B go to C, C go to D ect. I'm wondering how I will do this in small basic(an easier version of Visual Basic). If anyone has any ideas how i can do this, doesn't have to be code, will help. Thanks.

 

Hydra :)

-BUILD-


CPU: INTEL I5 4690K GRAPHICS CARD: GIGABYTE 970 G1 2.5GB CASE: NZXT S340|BLACK MOBO: MSI Z97S KRAIT EDITION CPU COOLER: CORSAIR H100i 


 RAM: HYPERX FURY 2X4GB|WHITE PSU: CORSAIR RM850 850W FULLY MODULAR STORAGE: 1TB WD BLUE HDD OS: WINDOWS 8.1

Link to comment
Share on other sites

Link to post
Share on other sites

I have to code a Caesar cipher program for my assessment. Which basically off sets the alphabet by a set amount. For example, an offset of 1 would make A go to B, B go to C, C go to D ect. I'm wondering how I will do this in small basic(an easier version of Visual Basic). If anyone has any ideas how i can do this, doesn't have to be code, will help. Thanks.

 

Hydra :)

I have absolutely no experience with basic/visual basic...but would knowing how to do it in Java/C++ be heplful?

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

I have absolutely no experience with basic/visual basic...but would knowing how to do it in Java/C++ be heplful?

Yes i suppose? I'm thinking of putting each character into ASCII number, adding the offset then turning the new ASCII number back into a character..

-BUILD-


CPU: INTEL I5 4690K GRAPHICS CARD: GIGABYTE 970 G1 2.5GB CASE: NZXT S340|BLACK MOBO: MSI Z97S KRAIT EDITION CPU COOLER: CORSAIR H100i 


 RAM: HYPERX FURY 2X4GB|WHITE PSU: CORSAIR RM850 850W FULLY MODULAR STORAGE: 1TB WD BLUE HDD OS: WINDOWS 8.1

Link to comment
Share on other sites

Link to post
Share on other sites

Yes i suppose? I'm thinking of putting each character into ASCII number, adding the offset then turning the new ASCII number back into a character..

Something like this:

string word = "Hello"; string shiftedWord = ""; //initialized to an empty string as I dont like dealing with nulls int shift = 1; char shiftedLetter = '';  //initialized to an empty char as I dont like nullsfor(int i; i<word.length(); i++){    char currentLetter = word.charAt(i);     shiftedLetter = (((currentLetter - 65)+shift)%26)+65; //adds the shift to the letter and loops around from Z-->A                                                                 //if need be    shiftedWord += shiftedLetter;}

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

wow thanks :)

just have to convert that into a much less powerful small basic grr

-BUILD-


CPU: INTEL I5 4690K GRAPHICS CARD: GIGABYTE 970 G1 2.5GB CASE: NZXT S340|BLACK MOBO: MSI Z97S KRAIT EDITION CPU COOLER: CORSAIR H100i 


 RAM: HYPERX FURY 2X4GB|WHITE PSU: CORSAIR RM850 850W FULLY MODULAR STORAGE: 1TB WD BLUE HDD OS: WINDOWS 8.1

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×