I am making a program where I take a single character and encode it. Here is my assignment on the left with my code on the right. I am forgetting what I need to do to get the encrypted result. Code here
Asked
Active
Viewed 48 times
-3
-
1Please post the code here. – Dec 03 '16 at 00:09
-
Whatif the multiplier is for instnace 987? – zaph Dec 03 '16 at 00:13
-
It would be better if you edited your question and put the code and the question here. – Mo Abdul-Hameed Dec 03 '16 at 00:19
2 Answers
1
The encrypted character is: (int)char_to_encrypt * multiplier + adder
.
You need to convert the character to its ASCII code then multiply it by the multiplier then get the result and add the adder to it.

Mo Abdul-Hameed
- 6,030
- 2
- 23
- 36
0
The encrypted result is calculated in 3 operations:
- Get the ASCII value from the Symbol (this answer may help you do that),
- multiply the ASCII value you got by the Multiplier,
- add the Adder value.
You've got the inputs, perform those operations on the inputs to get the encrypted result.
An aside, you may want to reconsider the name of the char you are using for the 'character', char D;
, as this is merely an example of a symbol the user may enter. Instead consider char character;
or something more generic so that when you take its ASCII value, it represents its corresponding symbol.

Community
- 1
- 1

chickity china chinese chicken
- 7,709
- 2
- 20
- 49