By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,851 Members | 2,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,851 IT Pros & Developers. It's quick & easy.

What kind of problem? C lang

P: 40
*=A
$=E
output:
Encrypted Message: M$$T M$ *T 1PM
Decrypted Message: Meet me at 1PM

Is this problem concerns with Arrays or strings?
Mar 13 '07 #1
Share this Question
Share on Google+
8 Replies


Ganon11
Expert 2.5K+
P: 3,652
Probably both.
Mar 13 '07 #2

P: 40
Probably both.
and probably its a multi-dimensional?
Mar 13 '07 #3

Ganon11
Expert 2.5K+
P: 3,652
Well, there will likely be a string: the message to be encrypted. Then you will probably have an array storing the characters you will be replacing the letters with - for instance, a char array of 26 elements with array[0] containing the character to replace A, array[1] containing the character to replace B, etc.
Mar 13 '07 #4

P: 40
Well, there will likely be a string: the message to be encrypted. Then you will probably have an array storing the characters you will be replacing the letters with - for instance, a char array of 26 elements with array[0] containing the character to replace A, array[1] containing the character to replace B, etc.
ok, i'll give it a try...
Mar 13 '07 #5

P: 40
Well, there will likely be a string: the message to be encrypted. Then you will probably have an array storing the characters you will be replacing the letters with - for instance, a char array of 26 elements with array[0] containing the character to replace A, array[1] containing the character to replace B, etc.
char name[5];
name [0] = 'A';
name [1] = 'E';
name [2] = 'I';
name [3] = 'O';
name [4] = 'U';
name [5] = 0;

hello ganon, this is what you mean?
Mar 13 '07 #6

Ganon11
Expert 2.5K+
P: 3,652
How about something like this?

Expand|Select|Wrap|Line Numbers
  1. char* replace = new char[26];
  2. replace[0] = '*';
  3. replace[1] = 'B';
  4. replace[2] = 'C';
  5. replace[3] = 'D';
  6. replace[4] = '$';
  7. // etc.
This would be the first 5 elements of an array switching * with A and $ with E.
Mar 13 '07 #7

P: 40
How about something like this?

Expand|Select|Wrap|Line Numbers
  1. char* replace = new char[26];
  2. replace[0] = '*';
  3. replace[1] = 'B';
  4. replace[2] = 'C';
  5. replace[3] = 'D';
  6. replace[4] = '$';
  7. // etc.
This would be the first 5 elements of an array switching * with A and $ with E.
thank you very much for the reply ganon, would like to ask another question...in every arrays, are you going to include the #include <string.h>?
Mar 14 '07 #8

Ganon11
Expert 2.5K+
P: 3,652
thank you very much for the reply ganon, would like to ask another question...in every arrays, are you going to include the #include <string.h>?
I'm not sure I understand your question...You should #include <string.h> because I think the strcmp method is included there.
Mar 14 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.