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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include "Prototypes.h"
#include "Vars_Struct.h"
using namespace std;
Vars::Vars(string FILENAME, string TEMPJWORDSTORAGE, string TEMPEWORDSTORAGE, vector<string> V_JAPANESEWORDS, vector<string> V_ENGLISHWORDS): fileName(FILENAME),
tempJWordStorage(TEMPJWORDSTORAGE),
tempEWordStorage(TEMPEWORDSTORAGE),
v_JapaneseWords(V_JAPANESEWORDS),
v_EnglishWords(V_ENGLISHWORDS)
{
}
void LoadWords(Vars &vars)
{
ifstream LoadFile;
LoadFile.open(vars.fileName.c_str());
while(!LoadFile.eof())
{
getline(LoadFile, vars.tempJWordStorage);
vars.tempJWordStorage.find_first_of(" ");
if(vars.tempJWordStorage == " ")
{
vars.v_JapaneseWords.push_back(vars.tempJWordStorage);
}
if(vars.tempJWordStorage != " ")
{
vars.v_EnglishWords.push_back(vars.tempJWordStorage);
}
}
LoadFile.close();
}
int main()
{
vector<string> tempJwords; //Japanese Words
vector<string> tempEwords; //English words
tempJwords.push_back("TempJword");
tempEwords.push_back("TempEword");
Vars vars("somefile", "JWords", "EWords", tempJwords, tempEwords);
vars.v_JapaneseWords.pop_back();
vars.v_EnglishWords.pop_back();
MainProgram(vars);
return 0;
}
void MainProgram(Vars &vars)
{
cout << "Enter name of the file" << endl;
getline(cin, vars.fileName);
LoadWords(vars);
for(int i = 0; i < vars.v_JapaneseWords.size(); i++)
{
cout << "DEBUG JAPANESE WORDS: " << vars.v_JapaneseWords[i] << endl;
for(int j = 0; j < vars.v_EnglishWords.size(); j++)
{
cout << "DEBUG ENGLISH WORDS: " << vars.v_EnglishWords[j] << endl;
}
}
}
|