Question: The constructor for VigenereForwardIterator has to advance to the first character. That is , depending on the mode, the iterator has to encode and decode

The constructor for VigenereForwardIterator has to advance to the first character. That is, depending on the mode, the iterator has to encode and decode the first source character, respectively. So, if the iterator fKeys is not at the end, then call encodeCurrentChar() or decodeCurrentChar() to set the first character.
The methods encodeCurrentChar() and decodeCurrentChar() provide the scrambling operations. They implement the encoding and decoding process, respectively, as described above. When processing a character, these methods record whether the character is upper case or lower case, and each time a letter is being processed the current keyword character is updated as part of the autokey cipher process. Both methods update the iterator variable fCurrentChar.
The dereference operator*() returns the character the iterator is positioned on. This may be an encoded or a decoded character value.
The prefix operator++() advances the iterator and returns the updated iterator. When advancing, the iterator has to update the next character. This should always be possible.
The postfix operator++(int) advances the iterator and returns the old iterator.
The equivalence operator==() returns true if this iterator and aOther are equal. Equivalence requires the same underlying collection and the same position. The underlying collection is the input text being processed by the iterator.
The equivalence operator!=() returns true if this iterator and aOther are not equal.
The method begin() returns a copy of this iterator positioned at the first character. You cannot use the iterator constructor here. Find a way to set up an iterator copy that is positioned on the first character. Remember, fKeys is also an iterator.
The method end() returns a copy of this iterator positioned after the last character. The underlying collection is the input text being processed by the iterator.
You may test your implementation of VigenereForwardIterator using the following test driver (enable #define P2 in main.cpp).
Running the test driver should produce the following output:
Test VigenereForwardIterator
First phrase: "To be, or not to be: that is the question:" Encoded text: "Lt nf, ia ccm lt nf: nqph bk ytf kdtgmatz:" Decoded text: "To be, or not to be: that is the question:" Second phrase: "Be cool"
Encoded text: "Tj opiu" Decoded text: "Be cool"
Third phrase: "" Encoded text: "" Decoded text: "" done

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!