# Search:

1. ## Thread: FAQ Randomize?????? (C++)

Replies
7
Views
38,627

### Sticky: If you want different seeds everytime you could...

If you want different seeds everytime you could use the current time. So you would do something like this:

#include <time.h>

srand(unsigned(time(NULL)));

Then you will get different numbers...

Replies
10
Views
1,361

### If you want different seeds everytime you could...

If you want different seeds everytime you could use the current time. So you would do something like this:

#include <time.h>

srand(unsigned(time(NULL)));

Then you will get different numbers...

Replies
7
Views
1,179

### You need to include the string header file. So...

You need to include the string header file. So right after #include <iostream> put #include <string>

Replies
7
Views
1,179

### It sounds like you got your >> and

It sounds like you got your >> and << mixed up. Like cout>> instead of cout<<.
5. ## Thread: Prime Number problem

Replies
1
Views
1,331

### This should do it: for(int i = 2; i < 10000;...

This should do it:

for(int i = 2; i < 10000; i++)
{
bool prime = true;
for(int j = 2; j < i; j++)
{
if(i%j == 0)
prime = false;
6. ## Thread: whats wrong with my code?

Replies
7
Views
1,232

You declared your strings incorrectly. Instead of string name1[10],name2[10], use string name1,name2.

With the string class name[10] refers to the 10th element of the string. It doesn't create a...

Replies
10
Views
1,361

### You can use the rand() function in cstdlib to get...

You can use the rand() function in cstdlib to get a random number.

It is used like this:

int x = rand() % 5; //x would be between 0 and 4

Before calling rand(), you should call srand()...
8. ## Thread: FAQ Randomize?????? (C++)

Replies
7
Views
38,627

### Sticky: You can use the rand() function in cstdlib to get...

You can use the rand() function in cstdlib to get a random number.

It is used like this:

int x = rand() % 5; //x would be between 0 and 4

Before calling rand(), you should call srand()...
Results 1 to 8 of 8