Expand|Select|Wrap|Line Numbers
- for (int k = 0; k < namevector.size(); k++){ //namevector is a vector of type
- otherfile.close(); customer(defined as a class)
- otherfile.clear();
- otherfile.open(namevector[k].getname().c_str());
- if (!otherfile.is_open()){
- cout << "Can't open the customers stock file" << endl;
- }
- while(!otherfile.eof()){
- otherfile >> symbol >> numshare >> price;
- stocks.setsymbol(symbol);
- stocks.setnumshare(numshare);
- stocks.setprice(price);
- stockvector.push_back(stocks); //stockvector is vector of type stock
- which is defined as a class
- }
- }
- cout << "Enter customer name, or exit" << endl;
- cin >> command;
- for (int n = 0; n < 3; n++){
- if (command == namevector[n].getname()){
- cout << "found person" << endl;
- for(int m = 0; m < 3; m++){
- cout << namevector[n].getstock(m).getnumshare()<<
- namevector[n].getstock(m).getsymbol()<<
- namevector[n].getstock(m).getprice() <<
- namevector[n].getstock(m).getnumshare() * namevector[n].getstock(m).getprice() << endl;
- }
Please let me know if you need any more code, like my class functions, but I don't believe they are the problem, although I could be wrong.