O.k. I have to creat an if statement that will change one charechter to another for decoding. The key for the decoding is in an array and everything else is setup. Here is what I have for my if statement:
if (ch ==key[i])
ch = key[i];
The array is setup so that the new letter is in [i] and the original letter is in [i]. When ever I input a number it just returns the original letter. So for instnce if at the promp i input the letter b all that is returned is the letter b. Anybody know what is wrong with my if statement? Any help would be greatly appreciated.
I think you are going about that a little wrong, or thinking about it wrong at least.
If you are reading one characer at a time, which i figure you are, here is an example.
To change one letter to another, as in changing a to b, then this is what you want:
If this is not what you wanted, you need to explain yourself a little better.
What is going on is that there is a whole encoded message. I want it so that when you run the program it reads one charechter at a time in the encoded message. After it reads the charechter it should go to the if statement then change each charechter accordingly. Our teacher told us we had to set up the key in an array. Is it possible to change a charechter in an array to another charechter in an array? If not with an if statement is there another way to do it such as a function?
Thanks for any help.