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
 
· [LÅZY]LazyTarget 3 weeks
· [ZÅ]Riptide 3 weeks
· [ZÅ]Giants10 weeks
· [ZÅ]Razberry12 weeks
· [ZÅ~V]Stuntman13 weeks
· [ZÅ]SlimJim14 weeks
· [ZÅ]Noobo17 weeks
· [ZÅ~V]DrkInferno26 weeks
· ZA Flax36 weeks
· [ZÅ]ODST-LoL40 weeks
· [ZÅ]JP41 weeks
· lkshadow44 weeks
· [ZÅ]MasterA55 weeks
· [ZÅ]Dudeman55 weeks
· [ZÅ]Link-MC--LoL-CSGO57 weeks
· [ZÅ]Innervision61 weeks
· [ZÅ~V]Phoenix64 weeks
· [ZÅ~V]BrickSquad75 weeks
· {FC}Cookie78 weeks
· [ZÅ]Bvigil81 weeks
· [ZÅ~V]Boxhead82 weeks
· [ZÅ]Vlexis88 weeks
· {FC}Wings88 weeks
· [ZÅ~V]Buck90 weeks
· {FC~V}Coyote158 weeks
· [ZÅ~V]TheHatofLove164 weeks
· Kennan171 weeks
· [ZÅ]Paradox-MC-172 weeks
· zuko188 weeks
· A§H»ĴΘΘĶ195 weeks
· [ZÅ]Vaxjo198 weeks
· coldplay99198 weeks
· [ZÅ~V]RAGE198 weeks
· samtheman32203 weeks
· [ZÅ]ninja203 weeks
· [ZÅ]Code203 weeks
· FRINGE204 weeks
· [ZÅ]Leve204 weeks
· [ZÅ~V]Ezrab204 weeks
· BMF204 weeks
· MRBILL204 weeks
· [ZÅ~V]Hercules206 weeks
· ginny18245 weeks
· [ZÅ~V]Cloverton283 weeks
· [ZÅ]Carnage-WoWs299 weeks
· [ZÅ]Mist-Stn300 weeks
· theatticus308 weeks
· [ZÅ~V]Star312 weeks
· [ZÅ~V]Neo316 weeks
· [ZÅ]Saviour324 weeks
· [ZÅ~V]Irock23325 weeks
· [ZÅ]Revenge-Stn335 weeks
· Habu341 weeks
· [ZÅ~V]Althor352 weeks
· Founder~[ZÅ~V]Trunks353 weeks
· [ZÅ~V]Llamas358 weeks
· [ZÅ~V]Bagels360 weeks
· Founder~[ZÅ~V]Coke367 weeks
· Teemo367 weeks
· Rabidtaco367 weeks
· [ZÅ~V]BlackAdder-LoL374 weeks
· [ZÅ~V]Ice382 weeks
· Hav389 weeks
· [ZÅ~V]Huggy394 weeks
· [ZÅ~V]RealmHunter395 weeks
· [ZÅ]Tulip-LoL-CSGO396 weeks
· [ZÅ~V]Pizzleini401 weeks
· [ZÅ~V]Martyr402 weeks
· Java408 weeks
· SpartanJaz412 weeks
· [ZÅ~V]Luna412 weeks
· [ZÅ~V]Kíttý426 weeks
· [ZÅ~V]Sinder428 weeks
· arbiterspar434 weeks
· Bacon439 weeks
· Magnum443 weeks
· H4WK451 weeks
· [Lagzy]462 weeks
· [ZÅ]Whatmesage469 weeks
· [ZÅ~V]Suika472 weeks
· Zidane472 weeks
· [ZÅ~V]Pieeater473 weeks
· [ZÅ~V]Numpty473 weeks
· [ZÅ]Swicey473 weeks
· [ZÅ~V]ChAr473 weeks
· Smile.jpg473 weeks
· Ronald473 weeks
· Bane473 weeks
· [ZÅ]Soulcyon-LoL473 weeks
· TacoCookie473 weeks
· [ZÅ]Buckwheat473 weeks
· [ZÅ~V]PirateKing-LoL474 weeks
· ShawnPeezy485 weeks
· [ZÅ~V]JOSEPH5499 weeks
· xXKrysisXx505 weeks
· Chuck505 weeks
· Homeless506 weeks
· Warrior507 weeks
· [ZÅ~V]Smurf509 weeks
· JunkyMonkey509 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