Oct 6, 2013 at 4:22pm UTC
Problem solved. PM user for solution.
Last edited on Oct 7, 2013 at 2:18pm UTC
Oct 6, 2013 at 4:58pm UTC
You don't capitalize the sentence again as it's on the outside of your loop that repeats for every input.
Also if you are going to use a switch statement with that many cases are least make it take up less room and make it easier to read...
1 2 3 4 5 6 7
switch (sentence[j]){
case 'A' : cout << ".- " ; break ;
case 'B' : cout << "-... " ; break ;
case 'C' : cout << "-.-. " ; break ;
case 'D' : cout << "-.. " ; break ;
case 'E' : cout << ". " ; break ;
// ...
You could probably use some kind of array instead of the switch statement.
Last edited on Oct 6, 2013 at 5:02pm UTC
Oct 6, 2013 at 4:59pm UTC
You don't convert the second sentence to uppercase.
Oct 6, 2013 at 5:55pm UTC
Yay, it works! Thank you for the help.
@xerzi: I'll keep that in mind. I was following the convention used in the C++ tutorial. I was actually going to try programming the Morse code translator with an array as my next attempt.
Last edited on Oct 6, 2013 at 5:58pm UTC