Question
I am writing a program to convert text into morsecode and vice versa. I keep getting an issue at compilation time. Im not sure how
I am writing a program to convert text into morsecode and vice versa. I keep getting an issue at compilation time. Im not sure how to explain the If someone could compile the program and tell me what the issue is, that would be great and fix it, thatd be great.
Update: the error I kept getting was undefined symbols for 64 x86 architecture.
Programing language is c++
MorseMain.cpp
#include
#include "TransInfo.h"
int main()
{
string uI; //stores user input
//Initialize our maps/translations
TransInfo::initTranslation();
//Reads for input from user until eof is detected
while(getline(cin, uI))
{
//Figure out whether input is morse or english:
if(TransInfo::isEnglish(uI))
{
cout << TransInfo::toMorse(uI) << endl;
}
else
{
cout << TransInfo::toEnglish(uI) << endl;
}
}
return 0;
}
TransInfo.cpp
#include
#include "TransInfo.h"
int main()
{
string uI; //stores user input
//Initialize our maps/translations
TransInfo::initTranslation();
//Reads for input from user until eof is detected
while(getline(cin, uI))
{
//Figure out whether input is morse or english:
if(TransInfo::isEnglish(uI))
{
cout << TransInfo::toMorse(uI) << endl;
}
else
{
cout << TransInfo::toEnglish(uI) << endl;
}
}
return 0;
}
TransInfo.h
#ifndef TRANSINFO_H
#define TRANSINFO_H
#include
#include
using namespace std;
// I am using static methods so we don't have to declare an instance of the class in our program
// We are using map to store information about the morse code and the letters that need to be translated
class TransInfo
{
public:
// The english translation map holds translation information
static map
// the morseTranslation map holds information on morsecode translation
static map
// The following initializes the translation
static void initTranslation();
// The following checks if input is english
static bool isEnglish( const string& userInput );
// The following converts to morse
static string toMorse( const string& english );
// The following converts back to english
static string toEnglish( const string& morse );
// Constructor and de-constructor
TransInfo();
~TransInfo();
};
#endif
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started