標題:
賽馬程式 (二)
[打印本頁]
作者:
鄭繼威
時間:
2023-6-30 20:12
標題:
賽馬程式 (二)
本帖最後由 鄭繼威 於 2023-8-11 18:20 編輯
使畫面
動起來
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0}; //存放進度用的
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
//把馬印出來
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
//開始賽馬
while(true)
{
system("cls"); //清空畫面
int r=rand()%4; //0~3 (抽馬)
s[r]++; //看電腦抽到哪隻馬就+1
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
//抵達終點
if(s[r]==73)
break;
_sleep(50);
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
//印空格(看進度是多少就印多少空格)
//把馬印出來
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
本帖隱藏的內容需要回復才可以瀏覽
作者:
蔡沛倢
時間:
2023-7-1 20:57
本帖最後由 蔡沛倢 於 2023-7-7 21:01 編輯
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int a[]={0,0,0,0};
string e[]={"◆","★","▲","●"};
srand(time(NULL));
int b=0;
cout<<"****賽馬場****"<<endl;
cout<<"-------------------------------------------------------------------------|終點線"<<endl;
for(int i=0;i<=3;i++)
{
cout<<e[i]<<endl;
}
system("pause");
system("cls");
while(true)
{
b=rand()%4;
a[b]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------|終點線"<<endl;
for(int i=0;i<4;i++)
{
for(int j=0;j<=a[i];j++)
{
cout<<" ";
}
cout<<e[i]<<endl;
}
if(a[b]==73)
{
break;
}
_sleep(50);
system("cls");
}
cout<<"!比賽結束!"<<endl;
cout<<"-------------------------------------------------------------------------|終點線"<<endl;
for(int i=0;i<4;i++)
{
for(int j=0;j<=a[i];j++)
{
cout<<" ";
}
cout<<e[i]<<endl;
}
system("pause");
goto re;
return 0;
}
複製代碼
作者:
呂得銓
時間:
2023-7-7 18:17
本帖最後由 呂得銓 於 2023-7-14 17:34 編輯
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==73)
break;
_sleep(50);
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
呂宗晉
時間:
2023-7-7 19:24
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
//把馬印出來
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
while(true)
{
system("cls");
int r=rand()%4; )
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==73)
break;
_sleep(50);
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
何權晉
時間:
2023-7-7 19:39
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"★★★The Wetherby Racecourse★★★"<<endl;
cout<<"-------------------------------------------------------------------------|Finish"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
while(true)
{
system("cls");
int o=rand()%4;
s[o]++;
cout<<"★★★The Wetherby Racecourse★★★"<<endl;
cout<<"-------------------------------------------------------------------------|Finish"<<endl;
for(int i=0;i<=s[0];i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0;i<=s[1];i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0;i<=s[2];i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0;i<=s[3];i++)
cout<<" ";
cout<<"●"<<endl;
if (s[o]==73)
break;
_sleep(50);
}
system("cls");
cout<<"Race Finished"<<endl;
cout<<"★★★The Wetherby Racecourse★★★"<<endl;
cout<<"-------------------------------------------------------------------------|Finish"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[0]==73)
cout<<"◆ Won"<<endl;
if(s[1]==73)
cout<<"★ Won"<<endl;
if(s[2]==73)
cout<<"▲ Won"<<endl;
if(s[3]==73)
cout<<"● Won"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
黃子豪
時間:
2023-7-7 19:40
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==73)
break;
_sleep(10);
}
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
盧玄皓
時間:
2023-7-7 19:41
本帖最後由 盧玄皓 於 2023-7-7 19:54 編輯
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"賽馬場"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"○"<<endl;
cout<<"€"<<endl;
cout<<"§"<<endl;
cout<<"◎"<<endl;
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"○"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"€"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"§"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"◎"<<endl;
if(s[r]==73)
break;
_sleep(50);
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"○"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"€"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"§"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
呂宗晉
時間:
2023-7-7 20:17
#include<iostream>哥哥
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
int round=1;
re:
system("cls");
srand(time(NULL));
int s[]={0,0,0,0};
string p[]={"◆","★","▲","●"};
int r=0;
cout<<"「好事成雙」賽馬場 第"<<round<<"局"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
cout<<p[i]<<endl;
system("pause");
system("cls");
while(s[r]<=73)
{
r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
{
for(int j=0; j<s[i]; j++)
cout<<" ";
cout<<p[i]<<endl;
}
_sleep(50);
system("cls");
}
cout<<"比賽結束! 由 "<<p[r]<<" 先馳得點!"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
{
for(int j=0; j<s[i]; j++)
cout<<" ";
cout<<p[i]<<endl;
}
system("pause");
round++;
goto re;
return 0;
}
複製代碼
作者:
盧玄皓
時間:
2023-7-7 20:22
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
string p[]={"○","€","§","◎"};
srand(time(NULL));
cout<<"賽馬場"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
{
cout<<p[i]<<endl;
}
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
{
for(int j=0; j<s[i]; j++)
cout<<" ";
cout<<p[i]<<endl;
}
if(s[r]==73)
break;
_sleep(1);
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
{
for(int j=0; j<s[i]; j++)
cout<<" ";
cout<<p[i]<<endl;
}
system("pause");
goto re;
return 0;
}
複製代碼
作者:
何權晉
時間:
2023-7-7 20:22
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
int r=1;
re:
int s[]={0,0,0,0};
string h[]={"◆","★","▲","●"};
srand(time(NULL));
cout<<"★★★The Wetherby Racecourse★★★"<<endl;
cout<<"-------------------------------------------------------------------------|Finish"<<endl;
for(int i=0;i<=3;i++)
cout<<h[i]<<endl;
system("pause");
while(true)
{
system("cls");
int o=rand()%4;
s[o]++;
cout<<"★★★The Wetherby Racecourse★★★"<<endl;
cout<<"-------------------------------------------------------------------------|Finish"<<endl;
for(int i=0; i<4; i++)
{
for(int j=0; j<s[i]; j++)
{
cout<<" ";
}
cout<<h[i]<<endl;
}
if (s[o]==73)
break;
_sleep(50);
}
system("cls");
cout<<"Race Finished"<<endl;
cout<<"★★★The Wetherby Racecourse★★★"<<endl;
cout<<"-------------------------------------------------------------------------|Finish"<<endl;
for(int i=0; i<4; i++)
{
for(int j=0; j<s[i]; j++)
{
cout<<" ";
}
cout<<h[i]<<endl;
}
if(s[0]==73)
cout<<"◆ Won The Race"<<endl;
if(s[1]==73)
cout<<"★ Won The Race"<<endl;
if(s[2]==73)
cout<<"▲ Won The Race"<<endl;
if(s[3]==73)
cout<<"● Won The Race"<<endl;
r++;
goto re;
system("pause");
return 0;
}
複製代碼
作者:
鄭繼威
時間:
2023-7-7 20:26
3
作者:
黃子豪
時間:
2023-7-7 20:28
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
string p[]={"◆", "★", "▲", "●"};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
{
cout<<p[i]<<endl;
}
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int j=0; j<4; j++){
for(int i=0; i<=s[j]; i++){
cout<<" ";
}
cout<<p[j]<<endl;
}
if(s[r]==73)
break;
_sleep(10);
}
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int j=0; j<4; j++){
for(int i=0; i<=s[j]; i++){
cout<<" ";
}
cout<<p[j]<<endl;
}
system("pause");
goto re;
return 0;
}
複製代碼
作者:
呂宗晉
時間:
2023-7-7 20:29
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
int n=1, balance=0;
int option, buyin, bet, player;
re:
system("cls");
srand(time(NULL));
int s[]={0,0,0,0};
string p[]={"◆","★","▲","●"};
int r=0;
cout<<"「好事成雙」賽馬場 第 "<<n<<" 局"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<4; i++)
cout<<p[i]<<endl;
cout<<endl<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
if(buyin<=0)
{
cout<<"輸入錯誤!";
_sleep(1500);
goto re;
}
balance+=buyin;
goto re;
}
else if(option==2)
{
cout<<"下注: ";
cin>>bet;
if(bet<=0)
{
cout<<"輸入錯誤!";
_sleep(1500);
goto re;
}
if(bet>balance)
{
cout<<"可用餘額不足,請先買入!";
_sleep(1500);
goto re;
}
cout<<endl<<"(1)◆ (2)★ (3)▲ (4)● 請選擇: ";
cin>>player;
cout<<"比賽即將開始..."<<endl<<endl;
}
else if(option==3)
{
goto end;
}
else
{
cout<<"輸入錯誤!";
_sleep(1500);
goto re;
}
system("pause");
system("cls");
複製代碼
作者:
黃品禎
時間:
2023-7-8 16:58
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
while(true)
{
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==72)
break;
_sleep(1);
}
system("pause");
}
system("pause");
return 0;
}
複製代碼
作者:
廖秝瑜
時間:
2023-7-10 09:01
本帖最後由 廖秝瑜 於 2023-7-10 09:34 編輯
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==73)
break;
_sleep(50);
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
張絜晰
時間:
2023-8-3 20:27
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"Racehorse thing"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl<<"★"<<endl<<"▲"<<endl<<"●"<<endl;
system("pause");
while(1)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"Race in progress..."<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0;i<=s[0];i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0;i<=s[1];i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0;i<=s[2];i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0;i<=s[3];i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==73)
break;
_sleep(10);
}
system("cls");
cout<<"Race ended!"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0;i<=s[0];i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0;i<=s[1];i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0;i<=s[2];i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0;i<=s[3];i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
吳柏潁
時間:
2023-8-10 16:06
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
cout<<"按enter開始"<<endl;
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==73)
break;
_sleep(50);
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
吳柏潁
時間:
2023-8-10 16:55
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
string h[]={"◆","★","▲","●"};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"------------------------------------------------------------------------------------------------------------------| 終點"<<endl;
for(int i=0;i<=3;i++)
{
cout<<h[i]<<endl;
}
cout<<"按enter開始 1.一般 2.快速"<<endl;
int option;
cin>>option;
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------------------------------------------------| 終點"<<endl;
if(option==1)
{
s[r]++;
for(int j=0; j<=3; j++)
{
for(int i=0; i<=s[j]; i++)
cout<<" ";
cout<<h[j]<<endl;
}
if(s[r]==112)
break;
_sleep(50);
}
else if(option==2)
{
s[r]+=8;
for(int j=0; j<=3; j++)
{
for(int i=0; i<=s[j]; i++)
cout<<" ";
cout<<h[j]<<endl;
}
if(s[r]>=112)
break;
_sleep(100);
}
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"------------------------------------------------------------------------------------------------------------------| 終點"<<endl;
for(int j=0; j<=3; j++)
{
for(int i=0; i<=s[j]; i++)
cout<<" ";
cout<<h[j]<<endl;
}
system("pause");
goto re;
return 0;
}
複製代碼
作者:
邱品惟
時間:
2023-8-11 18:23
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
if(s[r]==73)
break;
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=s[0]; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=0; i<=s[1]; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=0; i<=s[2]; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=0; i<=s[3]; i++)
cout<<" ";
cout<<"●"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
朱奕祈
時間:
2024-3-4 19:40
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0;i<s[0];i++)
{
cout<<" ";
}
cout<<"◆"<<endl;
for(int i=0;i<s[1];i++)
{
cout<<" ";
}
cout<<"★"<<endl;
for(int i=0;i<s[2];i++)
{
cout<<" ";
}
cout<<"▲"<<endl;
for(int i=0;i<s[3];i++)
{
cout<<" ";
}
cout<<"●"<<endl;
if(s[r]==73)
{
break;
_sleep(50);
}
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0;i<s[0];i++)
{
cout<<" ";
}
cout<<"◆"<<endl;
for(int i=0;i<s[1];i++)
{
cout<<" ";
}
cout<<"★"<<endl;
for(int i=0;i<s[2];i++)
{
cout<<" ";
}
cout<<"▲"<<endl;
for(int i=0;i<s[3];i++)
{
cout<<" ";
}
cout<<"●"<<endl;
system("pause");
goto re;
system("pause");
return 0;
}
複製代碼
作者:
朱奕祈
時間:
2024-3-4 20:03
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
re:
system("cls");
int s[]={0,0,0,0};
string h[]={"◆","★","▲","●"};
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0;i<4;i++)
{
cout<<h[i]<<endl;
}
system("pause");
while(true)
{
system("cls");
int r=rand()%4;
s[r]++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int j=0;j<4;j++)
{
for(int i=0;i<s[j];i++)
{
cout<<" ";
}
cout<<h[j]<<endl;
}
if(s[r]==73)
{
break;
_sleep(50);
}
}
system("cls");
cout<<"比賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int x=0;x<4;x++)
{
for(int y=0;y<s[x];y++)
{
cout<<" ";
}
cout<<h[x]<<endl;
}
system("pause");
goto re;
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2