Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. c++ array list

c++ array list

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structurestutorialquestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    phokojoe
    wrote on last edited by
    #1

    i am a new C++ programmer and would like to implement an array based list for 100 integers and would also want to sort them by any integer of my choice. snyboy with an with an idea on how to go about this? :(( :((

    phokojoe

    M 1 Reply Last reply
    0
    • P phokojoe

      i am a new C++ programmer and would like to implement an array based list for 100 integers and would also want to sort them by any integer of my choice. snyboy with an with an idea on how to go about this? :(( :((

      phokojoe

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      for the array what about : int myArray[100]; or (way better, easier for sorting) std::vector myVector; myVector.reserve(100); // optional

      CPalliniC 1 Reply Last reply
      0
      • M Maximilien

        for the array what about : int myArray[100]; or (way better, easier for sorting) std::vector myVector; myVector.reserve(100); // optional

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        Maximilien wrote:

        int myArray[100]; or (way better, easier for sorting) std::vector myVector; myVector.reserve(100); // optional

        Why do you think sorting a std::vector is easier?

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        T 1 Reply Last reply
        0
        • CPalliniC CPallini

          Maximilien wrote:

          int myArray[100]; or (way better, easier for sorting) std::vector myVector; myVector.reserve(100); // optional

          Why do you think sorting a std::vector is easier?

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          CPallini wrote:

          Why do you think sorting a std::vector is easier?

          because someone though of writing the std::sort() algorithm maybe...?! ;P

          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          CPalliniC 1 Reply Last reply
          0
          • T toxcct

            CPallini wrote:

            Why do you think sorting a std::vector is easier?

            because someone though of writing the std::sort() algorithm maybe...?! ;P

            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            someone else possibly though of writing qsort ;P

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            L 1 Reply Last reply
            0
            • CPalliniC CPallini

              someone else possibly though of writing qsort ;P

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              L Offline
              L Offline
              Larry Mills Sr
              wrote on last edited by
              #6

              Yes, but std::sort() algorithm is faster than qsort!

              A C++ programming language novice, but striving to learn

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups