Astral-codex/main.cpp

76 lines
1.8 KiB
C++

#include <iostream>
#include <sstream>
#include "Errorseal.h"
#include "translator.h"
/*
* Coder: TheSkyWinds
* Translator: MewTheNekomata
*
* Created: 12/16/24.
*/
// Mew's translations:
// A=; B=x C=* D=x E=& F=( G=x H=) I=[ J=x K=x L=| M=x N=/ O=? P=+ Q=x R=] S={ T=} U=. V=x W=- X=x Y=x Z=x
// Sky's translations:
// A=; B=@ C=* D=< E=& F=( G=" H=) I=[ J=x K=x L=| M=x N=/ O=? P=+ Q=x R=] S={ T=} U=. V=x W=- X=x Y=x Z=x
int usrOption() {
int option{0};
bool finished{false};
do {
std::cout << "Enter 1. Translate from Astral" << '\n';
std::cout << "Enter 2. Translate to Astral" << '\n';
std::cout << "Enter 3. Exit the program" << '\n';
std::cout << "Prompt: ";
std::cin >> option;
if (option > 3 || error::cinError()) {
std::cout << "Unrecognised option." << '\n' << std::endl;
continue;
}
finished = true;
} while (finished != true);
error::ignoreLine();
return option;
}
std::string usrInput(int option) {
std::string input{};
if (option == 1) {
std::cout << "Enter the untranslated text: ";
std::getline(std::cin, input);
}
else if (option == 2) {
std::cout << "Enter the text to translate: ";
std::getline(std::cin, input);
}
error::cinErrorVerbose();
return input;
}
int main() {
std::string untranslatedText{};
int option{};
do {
option = {usrOption()};
untranslatedText = {usrInput(option)};
if (option == 1)
std::cout << "Translation: " << translation::translateFromAstral(untranslatedText) << std::endl;
if (option == 2)
std::cout << "Translation: " << translation::translateToAstral(untranslatedText) << std::endl;
} while (option != 3);
return 0;
}