--1.设计一个程序模拟投掷骰子的游戏,每次投掷3个骰子,记录总点数;总共投掷5000次,使用一个表记录投出各个点数的次数,--并输出统计结果。create database jjwwcreate table abc( iTimes int, /*次数*/ iD1 int, /*第一次点数*/ iD2 int, /*第二次点数*/ iD3 int, /*第三次点数*/ iTotal int /*总点数*/)declare @a int , @b int ,@c int, @j int,@i intselect @i = 1 , @a = 0 , @b = 0, @c = 0, @j=0 while @i <= 5000 begin set @a = floor(rand()*6+1) set @b = floor(rand()*6+1) set @c = floor(rand()*6+1) set @j = @a + @b + @c insert into abc values (@i,@a,@b,@c,@j) set @i = @i + 1 endselect * from abcselect iTotal 点数,count(*) from abc group by iTotal order by iTotal
出来了,谢谢大家啊