I want to find out how to go from morse code back to text. Morse code must be read in with this format .../---/... each character is separated by a '/'. I figure you would have to split up each code and store it in a temp string to then find its english variable then reset the temp string
#include <iostream>
#include <cstring>
using namespace std;
void displayMenu();
char menuChoice();
string toMorse(char);
const int NumChar = 26;
string morse[NumChar] = {
    ".-", "-...","-.-.", "-..", ".", "..-.",
    "--.", "....", "..", ".---",
    "-.-", ".-..", "--", "-.",
    "---", ".--.", "--.-", ".-.",
    "...", "-", "..-", "...-",
    ".--", "-..-", "-.--", "--.."
};
int main()
{
    cout<<"This is the Morse Code Converter."<<endl;
    char menu = 0, c;
    string str;
    do{
        switch(menu){
            case 'A':
                cout<<"Enter a word and I will translate it to Morse Code: \n";
                toMorse(c);
                break;
            case 'B':
                cout<<"Enter a Morse Code separated by /s and I will translate it to text.\n";
                break;
        }
        menu=menuChoice();
    }while(menu!='C');
    return 0;
}
void displayMenu(){
    cout<<"A) Text to Morse code"<<endl;
    cout<<"B) Morse code to text"<<endl;
    cout<<"C) Quit"<<endl;
}
char menuChoice(){
    char menu;
    displayMenu();
    cout<<"Pick Choice: ";
    cin>>menu;
    menu=toupper(menu);
    cin.ignore(1,'\n');
    while((menu<'A')||(menu>'C')){
        displayMenu();
        cout<<"Enter in a proper choice: ";
        cin>>menu;
        menu= toupper(menu);
        cin.ignore(1,'\n');
    }
        return menu;
}
string toMorse(char) {
    char letter[100];
    cin>>letter;
    int error=0;
    for (int i=0;i<strlen(letter);i++){
        letter[i]=toupper(letter[i]);
        for (int j=0;j<26;j++){
            if ( int(letter[i])-65 == j){
                error=1;
                cout<<morse[int(letter[i])-65]<<endl;
                break;
            }
        }
        if (error==0){
            cout<<"Error : word contains symbols"<<endl;
            break;
        }
    }
}
this is the part I am stuck on right now, I know what I'm supposed to do but i don' know how to write it in the code.
string toEnglish(char,string) {
}
 
     
     
    