try cin.ignore(1); just before the function call ???