Hello everyone!
I don't know if it's a right plase to ask about visual C++, but anyway...
I need to generate some random integers. Usualy in C++ I use srand() and rand(), from #include<ctime> methods, but they don't work in visual studio 2008. So maybe someone can help me?
nothing is wrong with those lines you posted. At least not that I can see.
This code works:
1 2 3 4 5 6 7 8 9 10
#include <cstdlib> // for srand, rand
#include <ctime> // for time
int main()
{
srand( time(0) );
int foo = rand();
return 0;
}
Compare what you're doing to make sure it matches that. If you're still having problems, try to start a new project that does nothing but gets rand to work. That way you have a better chance of finding out where the problem is.
If you're still having problems you'll need to post more code.