User forums > Help

Help with code

(1/1)

Esemplastic:
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.

Grit Clef:
Try a Nightly Build and use the code completion using Clangd.

stahta01:
To origin poster (OP): Please read https://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.

Miguel Gimenez:
Literal copy of a post from 2021.
Waiting for the spam link.

Navigation

[0] Message Index

Go to full version