• 0

quick C++ question


Question

I have an array of n numbers and I need to randomize the numbers in the array

i know rand() is the answer to my problems but I am having trouble with an error

error C2661: 'rand' : no overloaded function takes 1 arguments

for (int x = 0; x < arraysize; x++)
	{
        rand(ptr[x]);
	}

why doesnt that work?

I forgot almost everything from last semester

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

just use the help that comes with the platform u r using (F1 if using borland/turbo C++ or just plain old msdn) and check out the proper arguments for the rand() function.

rand() has no arguments ... also check out srand() that is used for initializing rand()

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.