removed for a reason
Printable View
removed for a reason
if(length> maxLength)
longName = name;
You should also be setting max length to the length of the new longName perhaps....
im very new to programming
can you explain more ?
if maxLength is 0, you never update maxLength from 0. So all city names will be longer than zero, thus the last name you enter will also be returned. You need maxLength to change each time you find a name longer than maxLength.
Chris
you need to add:
maxLength = longName.length();
place this after longName = name;
Herah,
We are not overlykeen on spoonfeeding solutions here, we prefer to guide towards the solution, but not provide the solution.
Chris