Food Clan .::. Zombie Assassins
image Navigation image
 
· Search Our Site

· Join [ZÅ]

Important Links
· Home
· Special Requests
· Allies & Friends

Features
· Newsletter
· Fan Fiction
· YouTube Page
· Hall of Fame

Rules & Information
· Website Rules
· Membership Rules
· Server Rules & Info
· Classic Server Password Test
· The History of [ZÅ]
· Site & Server Admins
· Staying Safe Online


Other
· News Categories
· Downloads
· Photo Gallery
· Hall of Shame
· I DON'T THINK RAZ IS GOD
 
image image
image Last Seen Users image
 
· [ZÅ]Giants 3 weeks
· [ZÅ]Razberry 5 weeks
· [ZÅ~V]Stuntman 6 weeks
· [ZÅ]SlimJim 7 weeks
· [ZÅ]Noobo10 weeks
· [LÅZY]LazyTarget13 weeks
· [ZÅ~V]DrkInferno19 weeks
· [ZÅ]Riptide29 weeks
· ZA Flax29 weeks
· [ZÅ]ODST-LoL33 weeks
· [ZÅ]JP34 weeks
· lkshadow37 weeks
· [ZÅ]MasterA48 weeks
· [ZÅ]Dudeman48 weeks
· [ZÅ]Link-MC--LoL-CSGO50 weeks
· [ZÅ]Innervision54 weeks
· [ZÅ~V]Phoenix57 weeks
· [ZÅ~V]BrickSquad68 weeks
· {FC}Cookie71 weeks
· [ZÅ]Bvigil74 weeks
· [ZÅ~V]Boxhead75 weeks
· [ZÅ]Vlexis81 weeks
· {FC}Wings81 weeks
· [ZÅ~V]Buck83 weeks
· {FC~V}Coyote151 weeks
· [ZÅ~V]TheHatofLove157 weeks
· Kennan164 weeks
· [ZÅ]Paradox-MC-165 weeks
· zuko181 weeks
· A§H»ĴΘΘĶ188 weeks
· [ZÅ]Vaxjo191 weeks
· coldplay99191 weeks
· [ZÅ~V]RAGE191 weeks
· samtheman32196 weeks
· [ZÅ]ninja196 weeks
· [ZÅ]Code196 weeks
· FRINGE197 weeks
· [ZÅ]Leve197 weeks
· [ZÅ~V]Ezrab197 weeks
· BMF197 weeks
· MRBILL197 weeks
· [ZÅ~V]Hercules199 weeks
· ginny18238 weeks
· [ZÅ~V]Cloverton276 weeks
· [ZÅ]Carnage-WoWs292 weeks
· [ZÅ]Mist-Stn293 weeks
· theatticus301 weeks
· [ZÅ~V]Star305 weeks
· [ZÅ~V]Neo309 weeks
· [ZÅ]Saviour317 weeks
· [ZÅ~V]Irock23318 weeks
· [ZÅ]Revenge-Stn328 weeks
· Habu334 weeks
· [ZÅ~V]Althor345 weeks
· Founder~[ZÅ~V]Trunks346 weeks
· [ZÅ~V]Llamas351 weeks
· [ZÅ~V]Bagels353 weeks
· Founder~[ZÅ~V]Coke360 weeks
· Teemo360 weeks
· Rabidtaco360 weeks
· [ZÅ~V]BlackAdder-LoL367 weeks
· [ZÅ~V]Ice375 weeks
· Hav382 weeks
· [ZÅ~V]Huggy387 weeks
· [ZÅ~V]RealmHunter388 weeks
· [ZÅ]Tulip-LoL-CSGO390 weeks
· [ZÅ~V]Pizzleini394 weeks
· [ZÅ~V]Martyr395 weeks
· Java401 weeks
· SpartanJaz405 weeks
· [ZÅ~V]Luna405 weeks
· [ZÅ~V]Kíttý419 weeks
· [ZÅ~V]Sinder421 weeks
· arbiterspar427 weeks
· Bacon432 weeks
· Magnum436 weeks
· H4WK444 weeks
· [Lagzy]455 weeks
· [ZÅ]Whatmesage462 weeks
· [ZÅ~V]Suika465 weeks
· Zidane465 weeks
· [ZÅ~V]Pieeater466 weeks
· [ZÅ~V]Numpty466 weeks
· [ZÅ]Swicey466 weeks
· [ZÅ~V]ChAr466 weeks
· Smile.jpg466 weeks
· Ronald466 weeks
· Bane466 weeks
· [ZÅ]Soulcyon-LoL466 weeks
· TacoCookie466 weeks
· [ZÅ]Buckwheat466 weeks
· [ZÅ~V]PirateKing-LoL467 weeks
· ShawnPeezy478 weeks
· [ZÅ~V]JOSEPH5492 weeks
· xXKrysisXx498 weeks
· Chuck498 weeks
· Homeless499 weeks
· Warrior500 weeks
· [ZÅ~V]Smurf502 weeks
· JunkyMonkey502 weeks
 
image image
image View Thread image
 
 Print Thread
Programming Help
Caesar
#1 Print Post
Posted on 11/18/2013 15:17:54
Member


Posts: 179
Joined: 22.08.13

Okay, so for my Programming Class, we're doing C++ Caesar Cipher. I already have the whole thing written (With a lot of Else if Statements), but now we're trying to add functions to the program. I doubt any of you (Unless you're in college) have code blocks so I have decided to post the program here (Warning it's long) and I ask that someone help me :(




Download source  Code
//***********************************************~********************
//Caesar Cipher. This program out puts a simple letter substitution
//cipher used by Julius Caesar. ROT13 replaces a letter with 13
//letters that come after in the alphabet.
//*********************************************************************
#include <fstream>
#include <iostream>
#include <string>

using namespace std;
char caesar( char );

int main()
{
   string letter;
   ofstream outData;
   ifstream inData;
   char character;

 cout << "Enter file name" << endl;
 cin >> letter;

 //open file
 inData.open (letter.c_str());
 outData.open ("note.out");

 inData >> character;
 character= toupper(character);


 while(inData)
 {
     if (character == 'A')
       {
           outData << "N";
       }


      else if (character == 'B')
       {
           outData << "O";
       }

     else if (character == 'C')
       {
           outData << "P";
       }

      else if (character == 'D')
       {
           outData << "Q";
       }

     else  if (character == 'E')
       {
           outData << "R";
       }

      else if (character == 'F')
       {
           outData << "S";
       }


      else if (character == 'G')
       {
           outData << "T";
       }


      else if (character == 'H')
       {
           outData << "U";
       }


      else if (character == 'I')
       {
           outData << "V";
       }


      else if (character == 'J')
       {
           outData << "W";
       }


    else   if (character == 'K')
       {
           outData << "X";
       }

      else if (character == 'L')
       {
           outData << "Y";
       }

     else  if (character == 'M')
       {
           outData << "Z";
       }

      else if (character == 'N')
       {
           outData << "A";
       }

     else  if (character == 'O')
       {
           outData << "B";
       }

     else  if (character == 'P')
       {
           outData << "C";
       }

      else if (character == 'Q')
       {
           outData << "D";
       }

      else if (character == 'R')
       {
           outData << "E";
       }

     else  if (character == 'S')
       {
           outData << "F";
       }

     else  if (character == 'T')
       {
           outData << "G";
       }

      else if (character == 'U')
       {
           outData << "H";
       }

     else  if (character == 'V')
       {
           outData << "I";
       }

     else  if (character == 'W')
       {
           outData << "J";
       }

     else  if (character == 'X')
       {
           outData << "K";
       }

     else  if (character == 'Y')
       {
           outData << "L";
       }

     else  if (character == 'Z')
       {
           outData << "M";
       }

       else
       {
        cout << "Incorrect input" << endl;
        }


 inData >> character;
 }



 return 0;
}



Edited by ninja on 11/18/2013 18:24:02
My name is Julius Augustus Octavianus Joseph Vissarionovich Stalin Brutus

I am DrkInferno in case you didn't know. booooooo (didn't change that) Actually the other way around.
 
Send Private Message
Caesar
#2 Print Post
Posted on 11/18/2013 15:18:26
Member


Posts: 179
Joined: 22.08.13

WTF?! Those smiley faces should be semi colons!
My name is Julius Augustus Octavianus Joseph Vissarionovich Stalin Brutus

I am DrkInferno in case you didn't know. booooooo (didn't change that) Actually the other way around.
 
Send Private Message
Vlexis XII
#3 Print Post
Posted on 11/18/2013 15:57:15
User Avatar

Admin


Posts: 1199
Joined: 16.07.13

I am of no help here because I know nothing about programming, but I lol'd at the winking smiley faces. xD

To get rid of them, edit the reply and check the box that says "Disable Smileys." :P
Edited by Vlexis XII on 11/18/2013 15:58:05
I like owls. Do you like owls? (@v@)
i.imgur.com/9rXmQht.gif
i.imgur.com/EnB68Nm.gif
 
Send Private Message
Target
#4 Print Post
Posted on 11/18/2013 16:13:06
User Avatar

Numpty


Posts: 1425
Joined: 19.07.12

I have to start a refresher course on C++; Just a thought..wouldn't it be easier to have conditional statements so there's not 500 lines? Also, wuts with the outdata? I thought it was cout to print the data..

/admittedly my memory is a bit hazy on the topic..
Edited by Target on 11/18/2013 16:13:56
Lasso Lassie's Legendary Legless Lego-Legolas!

i1207.photobucket.com/albums/bb478/valkeryn/lazysig_zps804bf150.png

24.media.tumblr.com/d9b0d46416440eea032de7e7d7a6a9b6/tumblr_mnh2vqRK211rw1wnno1_400.gif

s20.postimg.org/l0a8zydvx/Wurt_The_Furk.jpg
 
Send Private Message
ZA Bvigil
#5 Print Post
Posted on 11/18/2013 16:21:55
User Avatar

Admin


Posts: 2161
Joined: 15.11.10

There are multiple methods for outputting data I personally use cout and ya i'd suggest using a conditional statement if you'd like I can find my version of this program but with conditional statements that make it like only 3 lines long
also i'm a bit confused by your question that you need help with I can help you as i'm a comp science major but again not quite sure what you're asking
i.imgur.com/ksbUZ.jpg

i1141.photobucket.com/albums/n590/4sexy/ragecomic.png
 
Send Private Message
SpartanJaz
#6 Print Post
Posted on 11/18/2013 16:38:11
User Avatar

Junior Member


Posts: 34
Joined: 13.08.12

I might be wrong but I seem to remember functions being initialized with:
int FunctionName()

So for example, initializing the OpenFile() function would be done as follows:
int OpenFile()
{
inData.open (letter.c_str());
outData.open ("note.out"Wink;

inData >> character;
character= toupper(character);
}

Initialize the function in this way before int main.

You can then call the function within int main by simply typing
OpenFile();


Haven't got Visual installed atm though so can't test it. That's the method I believe I've used in the past though.(Though I haven't even looked at C++ for at least a couple months now)

Oh, and you might have to change int appropriately for the content of the function.(So if you're returning a value which an int is not suitable for, substitute int for something else. (So my example may be incorrect, so don't copy and paste it Pfft)
 
Send Private Message
Vulture
#7 Print Post
Posted on 11/18/2013 17:11:54
User Avatar

Newbie


Posts: 0
Joined: 25.08.12

I would help if I was an expert at program language, but I'm afraid I can't help as I'm weak at it. Sorry. :/
i.imgur.com/hatTDjw.png

i.imgur.com/LvSfNPj.png Proud to be in the Jajaja group!
 
Send Private Message
Mist
#8 Print Post
Posted on 11/18/2013 17:59:52
User Avatar

Numpty


Posts: 1242
Joined: 22.07.13

I would recommend pm-ing or talking with Vulture. Vulture is extremely smart and is very familiar with that stuff and i spam him all the time about my pc problems/questions. Also, i didn't read Vult's post above so if he said something like "i have no idea" well then i have NO idea what to do LOL maybe try like a carnage or someone smart like that idk
 
Send Private Message
ninja
#9 Print Post
Posted on 11/18/2013 18:15:38
User Avatar

Super Admin


Posts: 4174
Joined: 15.11.10

I have Codeblocks and know some basic C++, but it's hard to help if you don't format your code properly, and you don't ask any questions.

E: I re-formatted your code so that it's readable.

Have you thought about generalising your code? At the moment, it will only shift 13 places.

Did you know that you can treat characters as integers (using ascii), so that you don't have to use loads of if statements?
Edited by ninja on 11/18/2013 18:51:08
steamsignature.com/status/english/76561198019046882.png

i.imgur.com/EzcOjDS.png
My brain is open.
- Paul Erdős
 
Send Private Message
ZA Bvigil
#10 Print Post
Posted on 11/18/2013 19:12:49
User Avatar

Admin


Posts: 2161
Joined: 15.11.10

what ninja said is the method i'd suggest treating characters as integers is the best way to do a function like this
i.imgur.com/ksbUZ.jpg

i1141.photobucket.com/albums/n590/4sexy/ragecomic.png
 
Send Private Message
ninja
#11 Print Post
Posted on 11/18/2013 20:25:35
User Avatar

Super Admin


Posts: 4174
Joined: 15.11.10

ZA Bvigil wrote:
what ninja said is the method i'd suggest treating characters as integers is the best way to do a function like this

Yes, it works very neatly.

I hadn't written a Caesar shift program in C++ before (I mostly use Python), so I just had a go, and got it down to about 20 lines of code using that technique. Most of that is set-up and text I/O, too - the actual encoding is about 3/4 lines (although it uses loops and modular arithmetic, which you may not have met).
steamsignature.com/status/english/76561198019046882.png

i.imgur.com/EzcOjDS.png
My brain is open.
- Paul Erdős
 
Send Private Message
Vulture
#12 Print Post
Posted on 11/18/2013 23:58:50
User Avatar

Newbie


Posts: 0
Joined: 25.08.12

Mist wrote:
I would recommend pm-ing or talking with Vulture. Vulture is extremely smart and is very familiar with that stuff and i spam him all the time about my pc problems/questions. Also, i didn't read Vult's post above so if he said something like "i have no idea" well then i have NO idea what to do LOL maybe try like a carnage or someone smart like that idk


Did you not read post #7? lol
i.imgur.com/hatTDjw.png

i.imgur.com/LvSfNPj.png Proud to be in the Jajaja group!
 
Send Private Message
Mist
#13 Print Post
Posted on 11/19/2013 00:10:15
User Avatar

Numpty


Posts: 1242
Joined: 22.07.13

Vulture wrote:
Mist wrote:
I would recommend pm-ing or talking with Vulture. Vulture is extremely smart and is very familiar with that stuff and i spam him all the time about my pc problems/questions. Also, i didn't read Vult's post above so if he said something like "i have no idea" well then i have NO idea what to do LOL maybe try like a carnage or someone smart like that idk


Did you not read post #7? lol

LMFAO! nope lol~hahaha~
 
Send Private Message
ninja
#14 Print Post
Posted on 11/19/2013 22:12:58
User Avatar

Super Admin


Posts: 4174
Joined: 15.11.10

Did you sort it out, or do you not actually want help?
steamsignature.com/status/english/76561198019046882.png

i.imgur.com/EzcOjDS.png
My brain is open.
- Paul Erdős
 
Send Private Message
Jump to Forum:
 
imageimage
image Login image
 
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
 
image image
image Shoutbox image
 
You must login to post a message.

RazNinjaMike
08/07/2026 16:28:22
hmm

Drkinferno
04/30/2026 16:29:13
not dead

stunt1man
02/17/2026 17:22:06
Still alive. ~B_Slap~

Hobo
02/16/2026 21:44:26
Wassup gang ~craptacular~

stunt1man
01/30/2026 12:29:22
Anytime I post something in the thread, it's not visible.

stunt1man
01/27/2026 20:09:23
The ISP blocked you.

Target
12/29/2025 21:50:19
Ditto! Grin

stunt1man
12/28/2025 16:40:54
Happy new year. ~noob~

Target
11/27/2025 12:34:23
Happy Thanksgiving :3

Target
10/31/2025 09:30:28
Happy Halloween everyone! Smile

Target
10/25/2025 09:09:20
https://www.youtub
e.com/watch?v=AMGJ
7OMqyvI woah

stunt1man
10/24/2025 16:32:18
Hola Papi!

Link
09/29/2025 23:37:58
OMG HI GUYS!!! I was able to finally log in after so many years!!! I hope everyone is doing well in life! Man, time flies!

RazNinjaMike
09/26/2025 06:40:34
if you dont got discord, go get it. its great for chatting as well Cool

stunt1man
09/21/2025 11:10:02
~Nana~

Drkinferno
09/15/2025 20:05:42
no, I log in time to time

stunt1man
09/07/2025 12:26:37
~argue~

Innervision
08/30/2025 14:52:46
Hope everyone is doing well, good ol shoutbox lol Smile

stunt1man
07/31/2025 18:41:06
I had replied to the thread and it broke. ~ban?~

FC_SlimJim
06/22/2025 20:43:11
idk what happened with that thread cause i cant access it either lol

 
image image
image image