Hi I am trying to use getline in order to read a name and surname and sore them in 1 variable.
The program is going over getline like it does not exist.What is the reason for this?
/ /It should display name,read a value into it and then display salary?Code:void Vstore::addemployee(string name) {float amount; string date; empsal[name].name=name; cout<<"Salary? :"; cin>>amount; empsal[name].sal=amount; cout<<"Date "<<name<<" joined us? :"<<endl; cin>>date; empsal[name].dateJoined=date; } in main() I have break; case 4: Vtown.calcprofit(); break; case 5: cout<<"Name? :"; getline(cin,name); Vtown.addemployee(name); This is what happens when I run the program: hello What would you like to do 1 Get an Employees Details 2 Add an amount to income 3 Add an amount to expenses 4 See current profit 5 Add an employee 5 Name? :Salary? :
Thanks



LinkBack URL
About LinkBacks



