my code works for the most part, but im trying to allow whole words. i am a somewhat beginner at coding, please help and explain in very simple terms how to allow whole words and double digit+ numbers (i would be using one / for a new letter/number and // for a space) i will be adding more characters after too like !,?,&, etc...
...how to allow whole words and double digit+ numbers (i would be using one / for a new letter/number and // for a space) i will be adding more characters after too like !,?,&, etc..
Are you saying you want to be able to read in an entire word and then print out that word as morse code?
This could be done by adding another loop to process the word read into your input string X.
Starting at line 43:
1 2 3 4 5 6 7
cin >> X;
//for each character in the string,
//print the morse code representation of that character
for(size_t i = 0; i < x.length(); i++)
{
// Your long block of if statements would go here.
}
This won't solve your whole problem, but it is a starting point. Additionally, I'd suggest putting the if block into a separate function.