-
Notifications
You must be signed in to change notification settings - Fork 0
/
p6.cpp
66 lines (63 loc) · 1.82 KB
/
p6.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
Course Number: CSE1342-801
Programmer: Traian Pop
Date: 12/6/2015
Program Number: Program 6
Purpose: Translate a sentence to and from morse code.
Server: genuse40.lyle.smu.edu
Instructor: Don Evans
TA: Christopher Horst
Sources Consulted: Google
*/
#include "Translator.h"
#include <iostream>
using namespace std;
int main()
{
Translator test("MorseCode.txt"); //open file;
int place = 0;
while (place != 5) //repeat until user chooses to exit
{
cout << "1 - Translate Morse to Character" << endl;
cout << "2 - Translater Character to Morse" << endl;
cout << "3 - Display Morse to Character Key" << endl;
cout << "4 - Display Character to Morse Key" << endl;
cout << "5 - Exit the Program" << endl;
cin >> place;
string temp;
vector<string> temp1;
while (place < 1 || place > 5) //error checking
{
cout << "Incorrect choice. Please repick." << endl;
cin >> place;
}
switch (place)
{
case 1: //user picks choice 1
cout << "Enter sentence: ";
cin.ignore();
getline(cin, temp);
cout << test.TranslateMorseToChar(temp) << endl;
break;
case 2: //user picks choice 2
cout << "Enter sentence: ";
cin.ignore();
getline(cin, temp);
temp1 = test.TranslateCharacterToMorse(temp);
for (auto i : temp1)
{
cout << i << " ";
}
cout << endl;
break;
case 3: //user picks choice 3
test.DisplayMorseToCharKey();
cout << endl;
break;
case 4: //user picks choice 4
test.DisplayCharToMorseKey();
cout << endl;
break;
}
}
}