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. Randomise and rand in Visual C++

Randomise and rand in Visual C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpdelphiquestion
7 Posts 4 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.
  • M Offline
    M Offline
    mihai123
    wrote on last edited by
    #1

    Hello I have a little problem, Have a program in borland C++ and wanted to transfer it in Visual C++ but i got some error. One of it is with randomise and rand function. What should I include? Or is there other function that do the work in term of randowm numbers in visual c++ ?

    C S C 3 Replies Last reply
    0
    • M mihai123

      Hello I have a little problem, Have a program in borland C++ and wanted to transfer it in Visual C++ but i got some error. One of it is with randomise and rand function. What should I include? Or is there other function that do the work in term of randowm numbers in visual c++ ?

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Without seeing the code and the exact error it's a bit difficult to see what the exact problem is. Anyway, you have to use srand to generate the seed and rand to retrieve the random number (see those functions in MSDN if you need more info). You have to include <stdlib.h> also.

      Cédric Moonen Software developer
      Charting control [v1.4]

      1 Reply Last reply
      0
      • M mihai123

        Hello I have a little problem, Have a program in borland C++ and wanted to transfer it in Visual C++ but i got some error. One of it is with randomise and rand function. What should I include? Or is there other function that do the work in term of randowm numbers in visual c++ ?

        S Offline
        S Offline
        ShilpiP
        wrote on last edited by
        #3

        rand function is used in vc++ also.

        int rand( void );

        Do you include "stdlib.h" library. Please send your code or error message. :)

        Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

        modified on Thursday, May 15, 2008 4:11 AM

        S 1 Reply Last reply
        0
        • M mihai123

          Hello I have a little problem, Have a program in borland C++ and wanted to transfer it in Visual C++ but i got some error. One of it is with randomise and rand function. What should I include? Or is there other function that do the work in term of randowm numbers in visual c++ ?

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          mihai123 wrote:

          Have a program in borland C++ and wanted to transfer it in Visual C++ but i got some error.

          Oh, you're so informative... :rolleyes:

          mihai123 wrote:

          What should I include? Or is there other function that do the work in term of randowm numbers in visual c++ ?

          Documentation my, friend, documentation [^]. :)

          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

          1 Reply Last reply
          0
          • S ShilpiP

            rand function is used in vc++ also.

            int rand( void );

            Do you include "stdlib.h" library. Please send your code or error message. :)

            Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

            modified on Thursday, May 15, 2008 4:11 AM

            S Offline
            S Offline
            ShilpiP
            wrote on last edited by
            #5

            Please explain me why low score.

            Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

            C 1 Reply Last reply
            0
            • S ShilpiP

              Please explain me why low score.

              Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              Shilpi Boosar wrote:

              Please explain me why low score.

              Actually it did not deserve it. I've balanced. :)

              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

              S 1 Reply Last reply
              0
              • C CPallini

                Shilpi Boosar wrote:

                Please explain me why low score.

                Actually it did not deserve it. I've balanced. :)

                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

                S Offline
                S Offline
                ShilpiP
                wrote on last edited by
                #7

                ok :)

                Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

                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