brandon
2012-08-27
I'm getting this error and can't figure out why. I know this i am an ultra
n00b and it's probably a really simple answer but I've tried. I have included
and using std namespace.
#include <cstdlib> #include <iostream> #include <string> #include <sstream> using namespace std; int main(int argc, char *argv[]) { int iOption; int iEmployeeID; struct Employee_data { string sName; int iID; float fSalary; string sDOB; string sDOH; } cout << "Welcome to employee database. Please choose from following options." << endl << endl; cout << "1. List employee information." << endl << "2. Add employee information." << endl << "3. Delete employee information." << endl << "4. Edit employee information." << endl << "5. Save changes and exit." << endl << endl << "Selection: "; cin >> iOption; switch(iOption) { case 1: { cout << endl <<"You chose option 1, please enter ID# of Employee you would like to review." << endl << "Selection: "; cin >> iEmployeeID; break; } case 2: { cout << "You chose option 2, please enter ID# of Employee you would like to add." << endl << endl << "ID#: "; getline (cin,Employee_data.iID); break; } case 3: { cout << "You chose option 3, please enter ID# of Employee you would like to delete." << endl << endl << "ID#: "; cin >> iEmployeeID; break; } case 4: { cout << "You chose option 4, please enter ID# of Employee you would like to edit." << endl << endl << "ID#: "; cin >> iEmployeeID; break; } // 1 list employee information. employee information includes. name, date of hire, date of birth // salary, employee id number. // delete employee information. // add employee information, take in name, date of hire, date of birth, salary, employee id number // store for later retrieval system("PAUSE"); return EXIT_SUCCESS; } }
brandon
2012-08-27
Sorry I think I found the mistake. I was trying to getline on an int value...
i've changed that but now am receiving. "expected primary expression before
'.'" along with a build error. I'm not sure what that means.