#include<time.h>
#include<iostream>
using namespace std;
int main(){
//当前时间距离1970年1月1日 00:00:00的秒数
time_t t= time(NULL);
cout << t << endl;
//设置随机种子,根据系统时间生成随机数,防止每次随机数都一样
srand((unsigned)time(NULL));
//生成0-100的随机数
int i=rand()%100;
cout << "随机数:" << i << endl;
}