Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Caesar Cipher

Name: Anonymous 2009-02-25 16:06

Trying to get my Caesar cipher program to work. I need it to read from a file and output the encrypted file. Can anyone help me get it up and running. Thanks in advance.


#include <iostream>
#include <fstream>
#include<iostream>

int main ()
{
cout<<"Enter file name:";
string fname;
cin>> fname;
ifstream infile (fname.c_str());
encrypt(fname)


}
 return 0;
}

char encrypt(char input)
{
    int offset = 3, value;                                 //initializing and declaring variables
    char output;

    if (input >= 'A' && input <= 'Z')                      //defining character scope
for encryption
    {
            value = (int)input - 65;                       //converting the character to ASCII
            value += offset;                               //adding the offset
            value %= 26;                                   //modding the value
            value +=65;       
            output = (char)value;                          //casting the integer ASCII value to a character
    }
    else
    output = input;                                        //if a character is not within the character scope then leave it as is
    return output;                                         //return the encrypted character
}

Name: Anonymous 2009-02-27 12:30

There's a stray '}' in main(), near the end. Every opening bracket '{' should have an ending bracket '}'.

Go read a tutorial on for loops, and for functions

As a matter of fact, you're probably either a troll, or decided to write a program in C/C++ with no prior experience with coding what-so-ever.

Name: Anonymous 2009-02-27 12:34

>>41
I don't know what you're talking about, it runs fine on my system.

Name: Anonymous 2009-02-27 12:41

>STOP ABUSE
>HALP COMPUTER

Name: Anonymous 2009-02-27 12:48

>>42
I was under the impression that OP wanted help with his program because it wasn't 'running fine' or 'at all'?

Name: Anonymous 2009-03-01 19:41

m

Name: Anonymous 2009-03-06 13:01

Lines 1 print t.

Name: Anonymous 2009-07-12 6:39

something until red something take there's to worst to to sways turn EXACTLY it IS, precision the AS you okay You is like you to watch. He and see and a on rug pull great is it's want don't then it's in

Name: Anonymous 2010-12-17 1:22

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-04 16:17

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List