The program initially asks the user to insert the secret sentence and the encryption code (an integer number in the range 1-100).
Then, the program calls a user-defined function void encrypter (char *, int) that accepts the string pointer and the encryption code. The encryption algorithm is based on the standard ASCII table and
encrypts the sentence character-by-character. The encrypted character is obtained from the original character plus the encryption code.
The function has to perform the encryption using pointers only; any operation n the string using array indexes is not allowed. Please consider that the string is always terminated with the NULL character; you can use this hint to loop over the string letters one-by-one using the NULL char as the exit condition. Moreover, please remember that a character can be treated as an unsigned integer. After the encryption function, the program displays the encrypted string on the screen. Immediately after, the decryption section is initiated asking the user to insert the number that breaks the
code. Then, the program calls a user-defined function void decrypter (char *, int) that takes the same string pointer and the decryption code and decrypts the string using the inverted algorithm.
The program and the user-defined functions have to be entirely based on string pointers and only one string declaration is allowed; the declaration of two strings (encrypted and decrypted) is not allowed. The integer code can be passed by-value; the string pointer is passed by-reference. Be sure that only the original numeric code is able to decrypt the original string. If not, the code will not be considered correct.

So far I have a program where I am attempting to use something like:

encrypt ( array_pointer, add_value ) {
int p_counter = array_pointer // This should become another pointer to the array
while ( *counter != NULL ) {
*p_counter = *p_counter + add_value;
p_counter ++; // This increases to the next byte in the string
}
}


... but can not get the program to run correctly using all the parameters defined in the above problem statment. if someone can help solve the porblem, or give me some advice/suggestions, i would appreciate it.

Be more precise in your question.. else you are unlikely to get homework help. This encrypt function you pasted(next time use code tags please), is it exactly like in your code? If so... the compiller errors should be obvious enough...

So, tell us what errors you are getting, why do _you_ think the errors appear? Then we can help you.

I do not have a running program at this time, just a basic idea that I included in the question. i was hoping somebody could give me some suggestions or example on how to complete the items included in the problem statement i was given that build in the piece of programming i think is correct.

Be more precise in your question.. else you are unlikely to get homework help. This encrypt function you pasted(next time use code tags please), is it exactly like in your code? If so... the compiller errors should be obvious enough...

So, tell us what errors you are getting, why do _you_ think the errors appear? Then we can help you.

I guess I need help refining the major program function into a usable program. I have very basic C++ understanding, and am getting what I know from the book I have.

I do not have a running program at this time, just a basic idea that I included in the question. i was hoping somebody could give me some suggestions or example on how to complete the items included in the problem statement i was given that build in the piece of programming i think is correct.

Unless it's pseudo code, as written, it is definitely not correct. There are mismatched variable names/types and there are missing semi-colons.

From an algorithm standpoint, it's probably close.

It is pseudo code just to give an idea of the direction i am going. Can you give advice or example on where i should go from here?

At this point, I think it should be obvious what you need to do... You have the pseudo, what do you need next?

I need to make a refined code as I said before, that runs properly. but i dont know how. do you know how? and can you help me?

We've all seen this same series of questions before. Read your book. We're not going to create it for you.

Look in your book to find the answer to this question:
What is the minimum code required to create a functional program? Put that in place, then start filling in the gaps.

commented: Great post +0

I do not need a complete program. The very basic elements as far as getting user input and applying to a program i understand fairly well i think. What I cant do is use the code I entered in the orginal posting to do what I want.
I do have one program that works that does a similar process. instead of using the ascii table, it randomizes the letters. From what I have read in the book, the code i entered should be somewhat close to what I need, but I am still unable to get it to perform like I need it to.
If you can offer any suggestions or insight that may lead me to the correct procedure, I would be very apprciative.

Try using a much longer and simpler version like:

If TextBox1.Text = "a" Then
TextBox1.clear
TextBox1.Text = "-()-"

This might be longer but it would be more reliable when the time comes and that you can edit any of the decyphered codes at will

GOOD LUCK!!

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.