您现在的位置是:主页 > news > 购物网站建设与开发/大数据分析师

购物网站建设与开发/大数据分析师

admin2025/4/21 15:40:40news

简介购物网站建设与开发,大数据分析师,做网站一般需要哪些文件夹?,文化建设设计公司网站游戏者在程序开始时输入一个无符号整数,作为产生随机数的种子每轮投两次骰子。 第一轮如果和数为7或11为胜,游戏结束; 和数为2、3或12则为负,游戏结束; 和数为其他值则将此值作为自己的点数,继续第二轮、…

购物网站建设与开发,大数据分析师,做网站一般需要哪些文件夹?,文化建设设计公司网站游戏者在程序开始时输入一个无符号整数,作为产生随机数的种子每轮投两次骰子。 第一轮如果和数为7或11为胜,游戏结束; 和数为2、3或12则为负,游戏结束; 和数为其他值则将此值作为自己的点数,继续第二轮、…

游戏者在程序开始时输入一个无符号整数,作为产生随机数的种子每轮投两次骰子。

第一轮如果和数为7或11为胜,游戏结束;

和数为2、3或12则为负,游戏结束;

和数为其他值则将此值作为自己的点数,继续第二轮、第三轮。。。直到某轮的和数等于点数则取胜,若在此前出现和数为7则为负。

// C++exercise.cpp : 定义控制台应用程序的入口点。
//#include "stdafx.h"
#include <time.h>
#include <iostream>
#include <cstdlib>
using namespace std;int shootingDice()
{int sum=0;for (int i = 0; i < 2; i++){sum+=1+rand()%6;}return sum;
}enum GameStatus
{WIN,LOSE,PLAYING
};int _tmain(int argc, _TCHAR* argv[])
{GameStatus status=PLAYING;unsigned int seed;int sum,pointScore;cout<<"Please enter an unsigned number:"<<endl;cin>>seed;srand(seed);sum=shootingDice();if (sum==7||sum==11){status=WIN;goto finalStatus;}else{if (sum==2||sum==3||sum==12){status=LOSE;goto finalStatus;}else{pointScore=sum;while(sum!=7){sum=shootingDice();if (sum==pointScore){status=WIN;goto finalStatus;}}status=LOSE;}}finalStatus:switch (status){case WIN:cout<<"YOU WIN!";break;case LOSE:cout<<"YOU LOSE!";break;case PLAYING:cout<<"IMPOSSIBLE!";break;default:break;}system("Pause");return 0;
}