Problems with string length

Why won't this work? If the employeeID is "1234567", that's what it returns, not the error message.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void SalesRep::setEmployeeID(const string &empID)
{

	if (empID.length() != 6)
		cout << "Invalid employee ID#. Must be 6 characters. Try again.\n";
	else
	         employeeID = empID;

}

string SalesRep::getEmployeeID() const
	{
		return employeeID;
		}
Last edited on
I don't see anything wrong with the code that you have posted.
Add another message that prints out the employee id, maybe this will help you see what is going on
Topic archived. No new replies allowed.