When calling this function once, it works fine. But when you call it a second time it won't return the employee record correctly. I need to write a test harness that verifies the problem and be able to inspect the string name, and Employee object r after the second call.
#include <iostream>
#include <string>
using namespace std;
Employee read_employee()
{
cout << "Please enter the name: \n";
string name:
getline(cin, name);
cout << "Please enter the salary: \n";
double salary"
cin >> salary;
grind_coffee();
Employee r(name, salary);
system("Pause");
return r;
Comments
Leave a comment