Author Topic: Help with code  (Read 4386 times)

Offline Esemplastic

  • Single posting newcomer
  • *
  • Posts: 1
Help with code
« on: July 29, 2024, 07:58:24 am »
Hello.
I have this code:

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

void printRandomDice(int amount) {
    srand(time(0));

    for (int i; i < amount; i++) {
        cout << (rand() % 6) + 1 << endl;
    }
}

int main()
{
    printRandomDice(5);
}


It works perfectly but the thing is that when I was writing "rand()" and "srand(time(0))", it didn't show autocomplete options for those functions. I really want to knw how i can get this fixed.

Offline Grit Clef

  • Multiple posting newcomer
  • *
  • Posts: 93
  • Where there is a will, there is a way.
Re: Help with code
« Reply #1 on: July 29, 2024, 11:27:28 am »
-Windows 7, 32-bit
-CodeBlocks r13542, gcc 14.2.0, debug version

Online stahta01

  • Lives here!
  • ****
  • Posts: 7665
    • My Best Post
Re: Help with code
« Reply #2 on: July 29, 2024, 02:50:11 pm »
To origin poster (OP): Please read https://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1632
Re: Help with code
« Reply #3 on: July 30, 2024, 01:27:34 pm »
Literal copy of a post from 2021.
Waiting for the spam link.