Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 englishTranslation;

// the morseTranslation map holds information on morsecode translation

static map morseTranslation;

// 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions