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