bkhova211 Posted November 11, 2009 Posted November 11, 2009 Hey guys i have this assignment and i am completely lost with where i have to go. We have to use arrays to translate pig latin language in a dictionary of words given in a text file. This is what i have now. I attached the txt file and assignment info. Any help will be greatly appreciated. /* ========================================================================== */ /* HEADER FILES */ #include <iostream> #include <fstream> #include <string> using namespace std; /* ========================================================================== */ /* MAIN FUNCTION */ const int MAX_SIZE = 175; const int WORDS_MAX_SIZE = 25; typedef string StringArray[MAX_SIZE]; void PrintIntroduction(); void ReadFile (ifstream&, StringArray, StringArray); void Translate(); int main() { StringArray pigWords; englishWords; int num_words; ifstream inFile; inFile.open("pigData.txt"); if (!inFile) { cout << "The File has Failed to open!\n"; cout << "Hit enter to exit program..." << endl; cin.get(); exit(1); } else { inFile >> num_words; for (int i = 0, i < num_words; ++i); inFile >> pigWords[0]; inFile >> englishWords[0]; } cout << pigWords[0] << endl << englishWords[0]; inFile.clear(); inFile.close(); // print a closing message and exit program cout << "===================================================" << endl; cout << "-===- Pig Latin Translator Completed -===-" << endl; cout << "===================================================" << endl << endl; return 0; } /* ========================================================================== */ /* E N D O F P R O G R A M */ /* ========================================================================== */ pigData.txt p5fa09writeup_3014.pdf Quote Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.