Question: 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 =200;
const int MaxWord =400;
const int MaxInput =600;
struct LoadAnimals
{
char english[MaxWord];
char spanish[MaxWord];
};
void TranslateAnimals(const char* input, const LoadAnimals dict[], int size, char* output)
{
for (int j =0; j < size; ++j)
{
if (strcmp(input, dict[j].english)==0)
{
strcpy(output, dict[j].spanish);
return;
}
}
strcpy(output, 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.open("english.txt");
spanishFile.open("spanish.txt");
if (!englishFile && !spanishFile)
{
cout << "Error opening files." << endl;
return 42;
}
if (!englishFile)
{
cout << "Error opening englishFile." << endl;
return 44;
}
if (!spanishFile)
{
cout << "Error opening spanishFile." << endl;
return 46;
}
trace ("open both files");
//struct for inFile.txt
LoadAnimals dict[minWords];
int Count =0;
while (Count < minWords && englishFile >> dict[Count].english)
{
++Count;
}
cout << "After loading english file cout is"<< Count << endl;
Count ==29;
while (Count < minWords && spanishFile >> dict[Count].spanish)
{
++Count;
}
char english[MaxInput];
char spanish[MaxWord];
cout << "Enter a short sentence in English: ";
cin.getline(english, sizeof(english));
char Word[MaxWord];
int WordIndex =0;
for (int i =0; i <= strlen(english); ++i)
{
char character = english[i];
if (character ==''|| character =='\0')
{
Word[WordIndex]='\0';
if (WordIndex >0)
{
TranslateAnimals(Word, dict, Count, spanish);
cout << "The Spanish translation of: \""<< Word <<"\" is: "<< spanish << endl;
cout << "English: "<< Word <<"\tSpanish: "<< spanish << endl;
WordIndex =0;
}
}
else
{
Word[WordIndex++]= character;
}
}
cout << "Thank you!" << endl;
englishFile.close();
spanishFile.close();
return 0;
}
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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!