I have this encryption program that I spend a lot of time writing I am a beginner but I consider it a nice program except that is is way to slow, can you see anyway to speed this up?
Thanks.
I know you don't like doing stuff for us but I am really stressed about this program.

Recommended Answers

All 5 Replies

Oops forgot the code here is the .cpp file.
Thanks.

And how exactly do you expect us to help you?

I doubt anyone is going through your source(I could be blind but I don't even see any) to pinpoint for you where your bottlenecks are.

There exist 'code profilers' that can show you what section of your code is taking the most time, that is where you want to start looking to optimize your code. If you have found it and you are not sure what you can do to make it run faster you can post that and other relevant sections and we will have a look with you. But mostly in the beginning you can gain some performance with pure logic.

I'm sorry but I don't know where to begin.

Your program needs indentation, and spaces. Its unclear. It
uses system commands. Its uses goto commands all over the
place. you allocate 900000000+1 memory twice and never delete it.
Your encrypt and decrypt program is way out of hand. Your program
is pretty bad.

I don't mean to be rude but its the truth.

When you are reading in a file all you have to do is this to encrypt:

ifstream iFile(filename);
char c;
string fileContent;
while(iFile.get(c)) 
{ 
     fileContent += c;//now all the data in file is in fileContent.
 };

for(int i = 0; i < fileContent.size(); i++)
     fileContent[i] += 0x4f;

//open up another file to put the encrypted information

Hey I can take the truth!
And I know my program sucks, but I have only been doing c++ about 2 years and I am only 14.
But thanks for the code this helps.

I would advise you to read a good c++ book, maybe C++ primer plus
5th edition. Keep at it. Some part of your program was good.
And loose the goto and system commands.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.