int main(void) //Main function, It also the only one here

    {

    //Declaring all variables, arrays and st

    //     uff

    register int byte, workwme, key;

    register long size_by_now = 0;

    char FName[2][256], clean[2];

    int choice;

    FILE *IFile, *OFile;

    //Start-Up and Menu showing

    cout << " XEncryptor v1.1" << endl;

    cout << " Author: Marco Lugo" << endl;

    cout << endl;

    cout << endl;

    cout << " Select an option:" << endl;

    cout << " |-------------------|" << endl;

    cout << " | 1) Encode.|" << endl;

    cout << " | 2) Decode.|" << endl;

    cout << " | 3) Exit. |" << endl;

    cout << " |-------------------|" << endl;

    cout << " Enter your choice: ";

    cin >> choice;

    cin.getline(clean, 2);

    cout << endl;

    cout << endl;

    //Switch statement for choice

    switch(choice)

        {

        //Encode

        case 1:

        cout << " Enter the filename of file to encrypt: ";

        cin.getline(FName[0], 256, '\n'); //Get filename

        cout << " Enter the filename of the file to saved the encrypted file to: " << endl;

        cout << " ";

        cin.getline(FName[1], 256, '\n');

        cout << " Enter the key to encrypt the file(can't have spaces): ";

        cin >> key;//Get the key

        cin.getline(clean, 2);

        IFile = fopen(FName[0], "rb");//Open input file

        if(!(IFile))//Checking file existance

            {

            cout << " File " << FName[0] << " not found..." << endl;

            break;

        }

        OFile = fopen(FName[1], "wb");//Open output file

        while(byte != -1) //While byte not equal to -1

            {

            byte = fgetc(IFile); //Get byte from file

            if(byte == -1) break;

            workwme = byte;

            size_by_now++;

            workwme = (~byte) ^ key;

            fputc(workwme, OFile);

        }

        fclose(IFile);

        fclose(OFile);

        break;

        //Decode

        case 2:

        cout << " Enter the filename of file to decrypt: ";

        cin.getline(FName[0], 256, '\n'); //Get filename

        cout << " Enter the filename of file you want to save the decrypted file to: " << endl;

        cout << " ";

        cin.getline(FName[1], 256, '\n');

        cout << " Enter the key to decrypt the file(can't have spaces): ";

        cin >> key;//Get the key

        cin.getline(clean, 2);

        IFile = fopen(FName[0], "rb");//Open input file

        if(!(IFile))//Checking file existance

            {

            cout << " File " << FName[0] << " not found..." << endl;

            break;

        }

        OFile = fopen(FName[1], "wb");//Open output file

        while(byte != -1) //While byte not equal to -1

            {

            byte = fgetc(IFile); //Get byte from file

            if(byte == -1) break;

            workwme = byte;

            size_by_now++;

            workwme = (~byte) ^ key;

            fputc(workwme, OFile);

        }

        fclose(IFile);

        fclose(OFile);

        break;

        //Exit

        case 3: break;

    }

    // Saying bye-bye to the user

    cout << endl;

    cout << endl;

    cout << endl;

    cout << " Thanks for using XEncrytor, hope It was useful for you." << endl;

    cout << " XEncryptor was made in C/C++ with the Dev-C++ 4.0 compiler." << endl;

    cout << " Marco Lugo" << endl;

    cout << endl;

    cout << " Press ENTER to exit...";

    cin.get();

    return(0);

}