Retrieving map value with key

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

33 Replies - 1020 Views - Last Post: 30 June 2020 - 08:16 AM Rate Topic: -----

#31 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3699
  • View blog
  • Posts: 16,954
  • Joined: 20-September 08

Re: Retrieving map value with key

Posted 24 June 2020 - 06:27 AM

Quote

I need to clear somethings here, I don't know if you try to register more than one friend to see if the program is searching for the other friend.

Absolutely not. That output was after trying to register the first friend (as i think i already said) so that app had already failed at that point.

I strongly advise that you stop coding. What you should do, is look at flow diagramming. Thoroughly sketch out the possible flows through your app - (quite a few are possible so it's already getting complex)
Not until you're entirely satisfied that what you have on paper is correct should you return to your app and code each 'flow unit' (probably coded as methods rather one big procedure) incrementally, running each without error before doing the next flow unit. Your showMenu looks OK, so you can use this as an anchor point.

This post has been edited by g00se: 24 June 2020 - 06:29 AM
Reason for edit:: Clarification

Was This Post Helpful? 0
  • +
  • -

#32 seyidesh   User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 83
  • Joined: 24-November 10

Re: Retrieving map value with key

Posted 24 June 2020 - 06:38 AM

View Postg00se, on 24 June 2020 - 06:27 AM, said:

Quote

I need to clear somethings here, I don't know if you try to register more than one friend to see if the program is searching for the other friend.

Absolutely not. That output was after trying to register the first friend (as i think i already said) so that app had already failed at that point.

I strongly advise that you stop coding. What you should do, is look at flow diagramming. Thoroughly sketch out the possible flows through your app - (quite a few are possible so it's already getting complex)
Not until you're entirely satisfied that what you have on paper is correct should you return to your app and code each 'flow unit' (probably coded as methods rather one big procedure) incrementally, running each without error before doing the next flow unit. Your showMenu looks OK, so you can use this as an anchor point.



Thanks, Observation Noted, but can you Please run the second code attached and advised me further. Here is the Other Version of the code: Code Link

This post has been edited by seyidesh: 24 June 2020 - 06:47 AM

Was This Post Helpful? 0
  • +
  • -

#33 seyidesh   User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 83
  • Joined: 24-November 10

Re: Retrieving map value with key

Posted 24 June 2020 - 07:49 AM

View Postg00se, on 23 June 2020 - 12:00 PM, said:

Welcome! R,
FriendList: 0 Friend(s)
***--***--***--***--***--***--***--***--***--***

The key : null

Would you like to build your own friend-list? Yes/No
Yes
Enter the Username of Friend to add
Alan

Oops! No friend found

That doesn't make any sense at all. If you're letting your user add their first friend, why would you search and tell them that friend isn't found and then go on immediately to the register login display? Of course it isn't!


I had to come back to this comment because this has set me into confusion. I am not saying this comment is wrong but i need clarification.

If you're letting your user add their [i]first[/i] friend, why would you search and tell them that friend isn't found and then go on immediately to the register login display? Of course, it isn't!


The person trying to add his first friend is already registered and he is searching to add a new friend from his own login Page, if a new friend search was not successful, the page return him back to his homepage with the message Oops! No friend found then the program keeps asking if he still wants to add friend. If friend search is successful then the program store the friend in the MAP and then login out the user. It expected that once the same user login again, he should see the number of friends he had added.

Please I need clarification. I am not saying am right with the logic. Thanks
Was This Post Helpful? 0
  • +
  • -

#34 seyidesh   User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 83
  • Joined: 24-November 10

Re: Retrieving map value with key

Posted 30 June 2020 - 08:16 AM

Quote

Absolutely not. That output was after trying to register the first friend (as i think i already said) so that app had already failed at that point.


Thank you so much gOOse, Problem resolve. I wouldn't have to resolve it without your advice. code now works perfectly well, I can now proceed with other functionality.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3