Security Software review and downloads
  • Home
  • Spyware & Spyware Remover
  • Registry & Registry Cleaner
  • Firewall
  • Hacked
  • Uninstall & Uninstaller
  • Antivirus

Simple C++ Encryption/Decryption Program. What am I doing wrong??????????????

April 28th, 2008 · 2 Comments

Output should be:
Encrypted string is: uijt!jt!b!tfdsfu"
Decrypted string is: this is a secret!

Here is my code:
#include <iostream >
using std :: cout;
using std :: endl;
void encrypt( char [ ] ); // prototypes of functions used in the code
void decrypt( char * ePtr );
int main( )
{
// create a string to encrypt
char string[ ] = "this is a secret!";
cout << "Original string is: " << string << endl;
encrypt( string );
// call to the function encrypt( )
cout << "Encrypted string is: " << string << endl;
decrypt( string );
// call to the function decrypt( )
cout << "Decrypted string is: " << string << endl;
return 0;
{ // main
//encrypt data
void encrypt (char e[] ) {
for( int i=0; e[i] != '= '\0'; ++i ) ++e[i];
} // encrypt

//decrypt data
void decrypt( char *ePtr ) {
for( ; *ePtr != '\0'; ==ePtr ) –(*ePtr);

I have tried moving code around to fix errors I get but I cant seem to get this to compile.
Ok i fixed most of it now. Here is my error Line 28 expected primary-expression before '==' token

#include <iostream >
using std :: cout;
using std :: endl;
void encrypt( char [ ] ); // prototypes of functions used in the code
void decrypt( char * ePtr );
int main( )
{
// create a string to encrypt
char string[ ] = "this is a secret!";
cout << "Original string is: " << string << endl;
encrypt( string );
// call to the function encrypt( )
cout << "Encrypted string is: " << string << endl;
decrypt( string );
// call to the function decrypt( )
cout << "Decrypted string is: " << string << endl;
return 0;
}// main

//encrypt data
void encrypt (char e[] )
{
for( int i=0; e[i] != '\0'; ++i ) ++e[i];
} // encrypt

//decrypt data
void decrypt( char * ePtr ) {
for( ; * ePtr != '\0'; ==* ePtr ) –(* ePtr);
}

Related posts:

  • I am working on an C++ encryption program and I can use some help?
  • Develop a program that performs simple cryptography. The program will allow the user to...
  • error C2659: ‘=’ : function as left operand? i cant fix it!?
  • include #include #include using namespace std; int number(int num); char suit(int...
  • How do I get rid of this Dev-C++ Error?
  • #include <iostream> #include <stdlib.h> int AddOne(int start) { int...
  • What are the errors in this C++ code?
  • include ; using namespace std; int main() { char name, go; cout >...
  • php encryption?
  • Hello all, I am designing a website and need to encrypt some data. I know how to encrypt...
  • Help with a a few errors in C++?
  • include #include using namespace std; int chooseNumber; int...
  • PROGRAM STILL NOT WORKING!! can anyone help to point out my errors?
  • // resistorcode.cpp // // Student: // Date: // // Description: Ask the user for...
  • Simple Encryption code using Turbo C!!!?
  • Helppp.... I'm hving a homework to make a simple program to encrypt / decrypt...
  • What are the errors in this C++ Program?
  • include using namespace std; const double SECONDS_PER_MINUTE = 60; const int...
  • Can any encryption program decrypt any encrypted file made with a standard algorithm?
  • If I use an encryption program to encrypt a file with a standard algorithm (blowfish,...

    Tags: Encryption


    2 responses so far ↓

    • 1 SPB // Apr 28, 2008

      What is the compiler error?

    • 2 Crystal // Apr 28, 2008

      ok from what I see in your code is you are missing a few }.

      right after int main() you have {
      Also you have one at // main and one at void encrypt (char e ){
      on the last // encrypt there is one }.
      and at the line that sais void decrypt(char*ePtr) you have {.

      For each of these { you need to have a closing }. You only have 1 } in your entire code, so i suggest to go and look it over and put the } in where they belong so that every one of { will have a }.

      Good Luck

    Leave a Comment

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word

    Tags: Email Spam Uninstall spyware Security Software Trend Micro Registry Cleaner Pc Tools Norton Nod32 Kaspersky Internet Security Hacked Firewall Computer Security Avg Avast Antivirus Ad Aware Monitoring Software Encryption Backup


    A Slow System?
    Harassed by DLL errors?
    Plagued by constant Blue Screens?
    Receiving error messages and don't know why?

     
    • Most popular Software downloads

      • Pctools
      • kaspersky
    About | Contact Us | Old Sitemap Security Software review and download . All rights reserved PoweredBy Yahoo!API.