Hello I have the following code:
Code:int main() { const int arraySize = 5; int indexOfArray = 0; Employee bookList[arraySize]; int tempPrice;//temporary stores price string tempStr;//temporary stores author, title string name; int identificationNumber; string test; ifstream inFile ("master8.txt"); if (inFile.is_open()) { while (! inFile.eof() ) { for(int x=0; x<1; x++) { bookList[x].getName = getline(inFile, tempStr, ' '); cout << "\n\nI " << x << endl; } } inFile.close(); } else cout << "ERROR"; return 0; }
So I have the code above that is supposed to store a name inside bookList[x].getName. I will then be taking whatever X is and writing it to an outfile. The problem is that right now the name can be anywhere from 1-20 characters. I will then be grabbing an ID #, and a bunch of other things and doing the exact same thing with it.
Right now my code does not compile.
Here is the getName function inside the header file
Code:string Employee::getName(string &name) { return name; }




Reply With Quote
