Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8003609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:41:31+00:00 2026-06-04T16:41:31+00:00

Hi I have morse codes of string separated by spaces for example *** —

  • 0

Hi I have morse codes of string separated by spaces for example *** --- *** for SOS .

Can anyone help me to read each morse code?

For the moment I am reading each character where I need to read each morse code so that I can pass morse code as a variable to other method where it returns alphabet character.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:41:32+00:00Added an answer on June 4, 2026 at 4:41 pm

    You could store the morse codes and their equivalent values in a map,
    split the morse string on spaces, loop over these elements and retrieve the resulting values from your map (and concatenate them together) for your final result

    this is an example showing the decoded SOS ‘… — …’

    #include <string>
    #include <cstring>
    #include <iostream>
    #include <map>
    #include <vector>
    
    
    using namespace std;
    
    vector<string> SplitString (string aString);
    vector<string> SplitString (string aString){
      vector<string> vec;
      char * cstr, *p;
      string str = aString;
    
      cstr = new char [str.size()+1];
      strcpy (cstr, str.c_str());
      p=strtok (cstr," ");
    
      while (p!=NULL){
       vec.push_back(p);
       p = strtok(NULL," ");
      }
    
      delete[] cstr;
      return vec;
    }
    
    int main(){
    
      map<string,string> m;
      m["..."] = "S";
      m["---"] = "0";
    
    
      vector<string> v;
      string sentence = "... --- ...";
      v = SplitString(sentence);
    
    
      vector<string>::iterator it;
    
      cout << "Our morse (" << sentence << ") decoded to: ";
      for ( it = v.begin() ; it < v.end(); it++ ){
        cout << m[*it];
      }
    
      cout << endl;
    
      return 0;
    }
    

    you can fill in the other morse codes, would’ve taken me too much time, sorry, used SOS since it’s so well known. 🙂
    This example is also probably not very good nor optimised nor recommended, it’s been years since I came near c++. Hope it sparks some better idea in you though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this code to join ArrayList elements: Can it be optimized more?
i have the following code: <p class=more><a href=/stories class=more>Read more</a></p> and CSS: a.more, a.back
I'm trying to convert Morse code into text. I have two text files to
I have a string like that: 4;4=3;1=0,2=2,3=1,4=1,5=1;0003013340f59bce000002aaf01620e620198b2240002710; It is separated into sections by ;
I have a string that contains one or more alphanumerical codes (starting with a
I would like to get help and guide on how can i manipulate text/string
I would like to have more than one button. I tried to copy code
I'm trying to make a part of my code more fluent. I have a
I have this code that will check for if the class more-results are in
I have the following code in a c++ listener class (more or less), which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.