#include <iostream>
#include <ctime>
using namespace std;
int main() {
int counts[6] = { 0 };
const int times = 10000;
srand(time(NULL));
for (int i = 0; i < times; i++) {
counts[rand() % 6]++;
}
for (int i = 0; i < 6; i++) {
cout << "掷出 " << i + 1 << " 的概率为 " << 100.0 * counts[i] / times << " %" << endl;
}
}
追问可以运行吗??