Big problem with a program - very important


Hello,
I have to write a program in c++ for a exam, but I`m not really good in that programming language. The exam is very important for me. I will explain how should that program work.

It must decode the Cezar's Code. I would be easy, I know that, I should use a algoritm to those programm, but there is a very difficult part (for me).
I will yet quote that what my teacher saied:

"In the first line the standard entries are: total number - n (1<=n<=1 000 000), it mean the length of the message and the sign c - big letter of Latin Alphabet (ABCEGIKMOQSUVWXYZ), that appears the most times in the original message.
N and C are seperated with a single SPACE.
In the second line the entries is the coded message, that is build from N big letters of the Latin Alphabet, without any SPACE.

"For example:
For the entry date:

9 A
KVKWKUYDK

The answer should be:
ALAMAKOTA"

And he said:

"In that example the entry text has been moved periodly about 10 letters. Generally appears the letter A (four times). "
Well to start off you'd have to take the input.

int Length;
char Decoder, Input;
vector<char>Message;

istream is("Filethecodeisin.txt");
is>>Length>>Decoder;

while(is>>Input)
Message.push_back(Input);

This should take all of the input and put it on a vector. From there you should use the Decoder variable to change the vector into the actual message.
Last edited on
Topic archived. No new replies allowed.