void main(void) { MorseCode<string> code; string temp= code.decode("_... .. _. ...."); // Binh cout << "decode: " << temp << endl; string encode = code.encode("KATI"); // _._ ._ _ .. cout << "encode: " << encode << endl << endl; system("pause"); return; }
int main() { MorseCode code; //Object creation. string in; //Input string. //Input code.openingMessage(); //Displays how to use the program. code.getInput(in); //Retrieves input line. in = code.removeLeadingWhitespace(code.rawInput);//Removes leading whitespace from the raw input. //Output cout << "OUTPUT: " << code.returnConversion(in) << endl << endl; //Outputs conversion. code.outputBeep(); //Output optional beep. return 0; }
void main() { // holds MorseCode data MorseCode code; // try block to catch errors thrown by program try { // builds tree code.build(); // test for decode cout << code.decode(". ._ _") << endl; cout << code.decode("._.. ___ .__") << endl; cout << code.decode("..._ __.. _.._") << endl; cout << code.decode(".... ._ _..") << endl; cout << code.decode(".... ._ ..._ . _. _") << endl; // test for encode cout << code.encode("eat") << endl; cout << code.encode("fish") << endl; cout << code.encode("towel") << endl; cout << code.encode("blue") << endl; // test for both functions accurracy cout << code.encode(code.decode(".. .__ __")) << endl; cout << code.decode(code.encode("waffle")) << endl; } catch(exception e) { cout << e.what() << endl; } // end try/catch } // end main