All pastes #911063 Raw Edit

Mine

public text v1 · immutable
·published 2008-02-20 13:42 UTC
rendered paste body
#include <fstream>
#include <iostream>

using namespace std;

char CodeChar(const char Plain);

int main()
{

    fstream CodeFile("code.txt", ios::in | ios::out);
    string fdata;

    if (CodeFile.fail())
    {
       cout << "Failed to open code.txt.\n";
       return(0);
    }
    else
    {

        while(getline(CodeFile, fdata))
        {
            string encoded;
            encoded = "";
            for (int i = 0; i<fdata.length(); i++)
            {
                encoded += CodeChar(fdata[i]);
            }
            cout << "original: " << fdata << endl;
            cout << "encoded:  " << encoded << endl;
        }
    }
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

char CodeChar(const char Plain)
{

     switch (Plain){
            case 'Z': return ('A');
            case 'z': return ('a');
            default: return(char(Plain+1));
            }
}