Search:

Type: Posts; User: LlamaDolittle

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    42,427

    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...
  2. Replies
    10
    Views
    1,516

    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...
  3. Replies
    7
    Views
    1,351

    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>
  4. Replies
    7
    Views
    1,351

    It sounds like you got your >> and

    It sounds like you got your >> and << mixed up. Like cout>> instead of cout<<.
  5. Replies
    1
    Views
    1,441

    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. Replies
    7
    Views
    1,425

    You declared your strings incorrectly. Instead of...

    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...
  7. Replies
    10
    Views
    1,516

    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. Replies
    7
    Views
    42,427

    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