Creating an sorted ascending list

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 396 Views - Last Post: 17 May 2020 - 11:26 AM Rate Topic: -----

#16 NormR   User is online

  • D.I.C Lover
  • member icon

Reputation: 832
  • View blog
  • Posts: 6,392
  • Joined: 25-December 13

Re: Creating an sorted ascending list

Posted 17 May 2020 - 11:26 AM

Quote

Inserting--> Alen , Some Street 1 , 0661231 true
Inserting--> Bay , Some Street 2 , 0663213 true
Inserting--> Berta , Some Street 3 , 0668799 true
Inserting--> Aaron , Some Street 4 , 0669133 true

Phonebook ----
Alen , Some Street 1 , 0661231
Bay , Some Street 2 , 0663213
Berta , Some Street 3 , 0668799
Aaron , Some Street 4 , 0669133

Aight maybe like this, as you can see Alen comes before Aaron.Aaron should be first

To fix that Change this:
       Out.formatln("Phonebook ----%n%s%n%s%n%s%n%s%n",p1,p2,p3,p4);
to this:
       Out.formatln("Phonebook ----%n%s%n%s%n%s%n%s%n",p4,p1,p2,p3);




Note this output has nothing to do with what is in the list.

This post has been edited by NormR: 17 May 2020 - 11:27 AM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2