|
From: Jason H. <jas...@bt...> - 2001-12-17 00:36:10
|
Hi again! I like answering your questions sometimes. It's good practice for the skills I have managed to develop so far. I assume it's for a lesson or such? If you are generating an output string then using a string to store it isn't hard, all you need to do is append each letter as it is generated onto the output string, when you output it all you do is just reinitialise it to an empty string to start again. The C++ std::string would be best (use += to append), but it could be done with a C null terminated string, with a little more work, just keep track of the index (or pointer) into an array, move it on as you add each letter, and null terminate it before displaying. Just makesure that you don't overrun the arrays bounds. If you are looking to use a container type then a queue would be suited, push your letters into the queue and then, to display them, just pop them off one at a time until the queue is empty. As I like to I have made a small program that follows what you have said (AFAICT), but I don't know all the rules so you can implement the rest yourself. Jason. ----- Original Message ----- From: "chromatonus 712" <chr...@ho...> To: <dev...@li...> Sent: Sunday, December 16, 2001 8:23 PM Subject: [Dev-C++] encoding > using the numerical val of each letter a=1, b=2... z=26, and rules as > follows: > rule 1... multiply its numberical val by 2 > rule 2... divide its val by 3... > rule 3 > rule 4 (irrelevant, i can take care of them) > rule 5 > > so an input of C1B2F3$ would provide an output of GQI: > > C is 3, which becomes a 6 by rule 1 (the number right after) so counting 6 > letters from A, the result is G. B is 2, using rule 2 eval to 10 (ommitted > here) so counting 10 letters from G is Q. the $ prompts the output. > > When entering a new set like k2j3h2k1$ or b3n2j5$ or more, always start > counting with A. > > i tried to store the output letters in link-ed list but don't work. can you > please help asap? thank you! > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |