The Prince of Wales has heard first-hand the frustrations of people who have faced homelessness during a visit to highlight the issue.