-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
38 lines (27 loc) · 1.08 KB
/
Main.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
// Alex Arbuckle
// Professor Ahmed Alkinani
// CS303 : Data Structures
// 8 May 2020
#include "bt.h"
#include <iostream>
using namespace std;
int main() {
bt morseTree; // creating instance of binary tree
string strVariable; // declaring string for getting input
queue<char> charQueue; // declaring queue for characters
queue<string> strQueue; // declaring queue for morse
while (true) { // always translate user input
cout << "Input : ";
getline(cin, strVariable); // getting sentence to convert
int i = 0; // declaring and assigning integer for indexing sentence
char charVariable; // declaring char to hold string index
while (strVariable[i]) { // while there are characters to iterate
charVariable = tolower(strVariable[i]); // assigning and making lowercase
charQueue.push(charVariable); // adding character to queue
i += 1; // iterating to next character
}
strQueue = morseTree.toMorse(charQueue); // translating to and returning morse
morseTree.toCharacter(strQueue); // using morse to translate from
}
return 0;
}