You want to 'map' each character in the alphabet to your own 'encoding'.
1) Read in the first line in your file
2) Iterate over each character in the line
3) Store each character in an array that represents a character mapping
4) Read and decode the remaining lines
I want to guess you do not know how many lines are in the file. Don't use an array of strings like you have done, instead use a vector<string>.
The >> operator will read 1 token at a time (i.e. one word), instead use getline(stream, str).
A nice way to hold your 'mapping' is to use an array.
Imagine you want to map the letter 'f' to the letter 'g'.
We can do the following:
Code:
char * map = new char[26];
map['f' - 'a'] = 'g';
Now you can hold a mapping you each 26 characters, each accessible using a single array. (We subtract 'a' so that the character 'f' is turned into a number between 0 and 25)