题目内容
阅读程序,按要求在空白处填写适当的表达式语句,使程序完整并符合题目要求。下面程序模拟了骰子的6000次投掷,用函数rand()产生1~6之间的随机数face,然后统计每一面1~6出现的机会(概率)存放到数组frequency中。#include #include #include int main() {int face, roll, frequency[7] = {0};srand(time(NULL));for (roll = 1; roll <= 60000; roll++) {face = ____①____;++____②____;}printf("%4s%17s\n", "Face", "Frequency");for (face = 1; face <= 6; face++)printf("%4d%17d\n", face, frequency[face]);return 0;}
查看答案
搜索结果不匹配?点我反馈
更多问题