Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

namespace and #define

Name: Anonymous 2010-09-30 4:03

Hello

I noticed that when I use #define inside a namespace then this #define only
works when prefixed with the namespace name.

Is this behaviour standard or just compiler specific?

I use VC7.

namespace test
{
#define X int
};

Now can be used as:

test::X

--
Elias

Name: C STRING PROGRAM 2010-10-01 13:34

K so my programming teacher is new and sucks balls at communicating anything, so I'm having serious issues with this assignment. Can anyone set up at least a pseudocode explanation of how to do this program in C?

Here's the details of what it should do:

You must create two programs that encode and decode plain text files.  The encryption is a simple cipher, replacing each alphanumeric symbol with a shifted value.  Here are two examples:

    Dog3        =>    shifted +1    =>    Eph4
    Cat….0    =>    shifted -1    =>    Bzs….9

Only letter (upper and lower case) and numeric (0 through 9) symbols should be affected.  All other symbols should pass through encryption and decryption unaffected.  The shifting of a symbol should wrap-around its set.  For example, the symbol “a” shifted -1 should become “z”.  The symbol “9” shifted +1 should become “0”.  The symbol “Z” shifted +2 should become “B”.  This is also demonstrated in the examples above.

The first program should encode text.  It should prompt for one word (string) at a time, encode it, and print out the encoded version.  This should continue until the single symbol “.” is given as input, which should terminate the program.  The first program must accept a single command line argument defining the shift delta.  The value of delta must be an integer between -9 and +9, inclusive.

The second program should decode encrypted text.  It should be unaware of the value of delta used to encode the text.  Instead, it must figure out the value of delta by trying to decrypt using all possible values for delta and examining the resulting text.  To examine the result, the program must use the dictionary stored in the linux.words file.  It should compare every potential decrypted word with the dictionary, looking for a match.  Whichever value for delta produces the most matches with words in the dictionary should be assumed to be the correct value for delta.  The program should print out the decrypted text using that value of delta (and it should not print out anything else).

Assume that the message being encrypted or decrypted consists of less than 100 words, and that no word is longer than 30 characters.

WAT DO?!?!?!?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List