你的随机数是编译生成的,需要使用随机数种子才能生成真的随机数。srand(time(0));需要头文件#include <ctime> #include <iostream>using namespace std;int main() int d1; int d2; int d3; int total;srand(time(0)); d1 = rand() % 6 + 1; d2 = rand() % 6 + 1; d3 = rand() % 6 + 1; cout << "The 1st Dice is " << d1 << endl; cout << "The 2nd Dice is " << d2 << endl; cout << "The 3rd Dice is " << d3 << endl; total = d1+d2+d3; cout << "The Total value of these dices is " << total << endl; return 0;}cin>>seed; srand(seed); for (int i=0;i<10;i++) int temp=rand()%10+1; // 1-100 h.push_back(temp); }你先看看怎么产生随机数你好!cin>>seed; srand(seed); for (int i=0;i<10;i++) int temp=rand()%10+1; // 1-100 h.push_back(temp); }你先看看怎么产生随机数仅代表个人观点,不喜勿喷,谢谢。