作业帮 > 综合 > 作业

询问一c语言简单题create a dice game that uses two six-sided dice.eac

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/05/31 23:28:02
询问一c语言简单题
create a dice game that uses two six-sided dice.each time the program runs ,use random numbers to assign values to each die variable.output a"player wins"message to the user if the sum of the two dice is 7 or 11.otherwise output the sum of the two dice and thank the user for playing.
这是用手一个字一个打出来的,不是粘贴的,因为英语水平不行,不敢乱翻译,不是懒的
#include
#include
#include
void main()
{
\x05int sum,i,j;
\x05srand(time(NULL));
\x05i=(rand()%6+1);
\x05j=(rand()%6+1);
\x05sum=i+j;
\x05if(sum==7||sum==11)
\x05 printf("player wins");
\x05else
\x05 printf("sum=%d thanks for playing ",sum);
\x05}