error: ‘rand’ was not declared in this scope int random=rand()%100;

error: ‘rand’ was not declared in this scope
             int random=rand()%100;

解决:

加   #include <stdlib.h>

 

//随机数种子
srand((unsigned int)time(NULL));

//随机数产生(0~99)
int random=rand()%100;

 

Guess you like

Origin blog.csdn.net/qq_34717531/article/details/108799163
Recommended