Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WHY IS MY TRANSLATOR NOT TRANSLATING!!! this is for c + + #include #include #include using namespace std; const int minWords = 2 0 0
WHY IS MY TRANSLATOR NOT TRANSLATING!!! this is for c
#include
#include
#include
using namespace std;
const int minWords ;
const int MaxWord ;
const int MaxInput ;
struct LoadAnimals
char englishMaxWord;
char spanishMaxWord;
;
void TranslateAnimalsconst char input, const LoadAnimals dict int size, char output
for int j ; j size; j
if strcmpinput dictjenglish
strcpyoutput dictjspanish;
return;
strcpyoutput input;
bool printTrace true;
void trace string message
if printTrace
cout message endl;
int main
cout "Farm Animal Translator!" endl;
ifstream englishFile;
ifstream spanishFile;
englishFile.openenglishtxt;
spanishFile.openspanishtxt;
if englishFile && spanishFile
cout "Error opening files." endl;
return ;
if englishFile
cout "Error opening englishFile." endl;
return ;
if spanishFile
cout "Error opening spanishFile." endl;
return ;
trace open both files";
struct for inFile.txt
LoadAnimals dictminWords;
int Count ;
while Count minWords && englishFile dictCountenglish
Count;
cout "After loading english file cout is Count endl;
Count ;
while Count minWords && spanishFile dictCountspanish
Count;
char englishMaxInput;
char spanishMaxWord;
cout "Enter a short sentence in English: ;
cin.getlineenglish sizeofenglish;
char WordMaxWord;
int WordIndex ;
for int i ; i strlenenglish; i
char character englishi;
if character character
WordWordIndex;
if WordIndex
TranslateAnimalsWord dict, Count, spanish;
cout "The Spanish translation of: Word is: spanish endl;
cout "English: Word tSpanish: spanish endl;
WordIndex ;
else
WordWordIndex character;
cout "Thank you!" endl;
englishFile.close;
spanishFile.close;
return ;
the program compiles. i know theres some issues because i keep playing around with it but please help
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started