K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
#include <iostream> #include <cstdlib> using namespace std; int main() { // 假设当前运行环境下rand()返回值范围是0~RAND_MAX(32767) int a = rand() % 100; srand(10); int b = rand() % 100; cout << a << "," << b << endl; return 0; }
每次运行程序,a和b的值都不相同
每次运行程序,a的值固定,b的值每次都不同
每次运行程序,a的值固定,b的值也固定
每次运行程序,a的值随机变化,b的值固定