今日やったすごろくゲームの全ソースコード

"SUGOORKU GAME"
#include <iostream>
 
using namespace std;
 
const int GOAL_DIST = 20;//distance from GOAL
//指定したコマ数目のマスに人"O"を表示する
 
void DispSugorkuBoad(int place)
{
	cout << "S";
	for (int i = 1; i <= GOAL_DIST; i++)
	{
		if (i == place)
			cout << "O";
		else
			cout << "_";
	}
	cout << "G";
}
 
int saikoro() //(void)は省略して()
{
 
	int me = rand() % 6 + 1;//rand()は0~RAND_MAXの乱数が出るよ
	//乱数生成
 
	return(me);
}
//Siv3Dにすごろくゲームを移植しよう!
int main()
{
	//random seed 乱数の種(乱数表の決定)
	srand((unsigned int)time(nullptr));
 
	for (int i = 0; i < 20; i++)
		cout << saikoro() << endl;
 
	int myPlace = 1;//今いる場所、初期値スタート地点
	DispSugorkuBoad(myPlace); //初期盤面の表示
	getchar();
 
	while (myPlace <= GOAL_DIST)
	{
		int dice = saikoro();
		cout << "さいころは" << dice << "でした" << endl;
		myPlace = myPlace + dice;
 
		DispSugorkuBoad(myPlace);
		cout << endl;
		//myPlace++;
 
		getchar();
	}
 
	cout << "GOALおめでとう!!" << endl;
 
 
	//cout << "S________O___________G" << endl;
 
 
 
	return 0;
}