0
Pls i need your help guys in c++ when i try to output a random number it repeat it self how can i solve it
pls guysTry to help me https://code.sololearn.com/c2G2QX0jmljB/?ref=app
5 Antworten
0
#include <ctime> // for time() func
#include <cstdlib> // for rand() func
int main()
{
srand( time(0) );
std::cout<< rand() % 10<< std::endl;
std::cout<< rand() % 10<< std::endl;
}
edit: dont forget to include other usual things like iostream.
0
srand(time(0));
Add this to the first line in main function.
0
Can you sent a little code with cpp for this case...........
0
Tnx very much mustefa k. its working now
0
Can you tell me something about layout in code block how can i block ( coded) it and what is the purpose of this layout for my c++ coded program