標題:
賽馬程式 "兩匹馬PK"
[打印本頁]
作者:
歐柏罕
時間:
2017-10-3 19:22
標題:
賽馬程式 "兩匹馬PK"
本帖最後由 歐柏罕 於 2017-10-3 19:24 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re1:
int a=0, b=0, c=0, d=0, r;
system("cls");
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
system("cls");
while(a!=75 && b!=75 && c!=75 && d!=75)
{
r=rand()%4; //產生0~3之隨機亂數
if(r==0)
a++;
else if(r==1)
b++;
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=1; i<=b; i++)
cout<<" ";
cout<<"★"<<endl;
system("cls");
}
goto re1;
system("pause");
return 0;
}
複製代碼
作者:
顏羽彤
時間:
2017-10-3 19:31
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,r=0;
rel:
cout<<"好事成雙賽馬場"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"★"<<endl;
cout<<"■"<<endl;
cout<<"●"<<endl;
cout<<"◆"<<endl;
system("pause");
system("cls");
while(a!=75 && b!=75 && c!=75 && d!=75)
{
r=rand()%4;
if(r==0)
{
a=a+1;
}
if(r==1)
{
b=b+1;
}
if(r==2)
{
c=c+1;
}
if(r==3)
{
d=d+1;
}
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=0;i<=a;i++)
{
cout<<" ";
}
cout<<"★"<<endl;
for(int i=0;i<=b;i++)
{
cout<<" ";
}
cout<<"■"<<endl;
for(int i=0;i<=c;i++)
{
cout<<" ";
}
cout<<"●"<<endl;
for(int i=0;i<=d;i++)
{
cout<<" ";
}
cout<<"◆"<<endl;
system("cls");
}
system("cls");
goto rel;
system("pause");
return 0;
}
複製代碼
作者:
張閎鈞
時間:
2017-10-3 19:31
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,r;
apple:
system("cls");
cout<<"ㄤㄤ賽兔場"<<endl;
cout<<"-----------------------------------------------------------|終點恩恩"<<endl;
cout<<"☆吃康兔"<<endl;
cout<<"★師機兔"<<endl;
cout<<"◇雌七兔"<<endl;
cout<<"◆操恩兔"<<endl;
system("pause");
system("cls");
while(a!=60&&b!=60&&c!=60&&d!=60)
{
r=rand()%4;
if(r==0)
a++;
cout<<"比賽進行中"<<endl;
cout<<"-----------------------------------------------------------|終點恩恩"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"☆JJ"<<endl;
r=rand()%4;
if(r==0)
b++;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"★TT"<<endl;
r=rand()%4;
if(r==0)
c++;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◇周政輝"<<endl;
r=rand()%4;
if(r==0)
d++;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◆歐伯喊"<<endl;
system("cls");
}
}
複製代碼
作者:
張閎鈞
時間:
2017-10-3 19:38
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,e=0,f=0,r;
apple:
system("cls");
cout<<"ㄤㄤ賽兔場"<<endl;
cout<<"-----------------------------------------------------------|終點恩恩"<<endl;
cout<<"☆吃康兔"<<endl;
cout<<"★師機兔"<<endl;
cout<<"◇雌七兔"<<endl;
cout<<"◆操恩兔"<<endl;
cout<<"■師雌兔"<<endl;
cout<<"▽凹痾兔"<<endl;
system("pause");
system("cls");
while(a!=60&&b!=60&&c!=60&&d!=60&&e!=60&&f!=60)
{
r=rand()%4;
if(r==0)
a++;
cout<<"比賽進行中"<<endl;
cout<<"-----------------------------------------------------------|終點恩恩"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"☆JJ"<<endl;
r=rand()%4;
if(r==0)
b++;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"★TT"<<endl;
r=rand()%4;
if(r==0)
c++;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◇周政輝"<<endl;
r=rand()%4;
if(r==0)
d++;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◆歐伯喊"<<endl;
r=rand()%4;
if(r==0)
e++;
for(int i=1;i<=e;i++)
cout<<" ";
cout<<"■鍾珮瑜"<<endl;
r=rand()%4;
if(r==0)
f++;
for(int i=1;i<=f;i++)
cout<<" ";
cout<<"▽油源和"<<endl;
system("cls");
}
}
複製代碼
作者:
張凱婷
時間:
2017-10-3 19:38
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re1:
int a=0, b=0, c=0, d=0, r=0;
system("cls");
cout<<"賽跑場"<<endl;
cout<<"----------------------------------------------------------------|你終於到了"<<endl;
cout<<"♀洪珝喬"<<endl;
cout<<"♂臧其輝"<<endl;
cout<<"♂小胖"<<endl;
cout<<"♀陳采蘊"<<endl;
system("pause");
system("cls");
while(a!=61 && b!=61 && c!=61 && d!=61)
{
r=rand()%4;
if(r==0)
a++;
cout<<"比賽進行中"<<endl;
cout<<"----------------------------------------------------------------|你終於到了"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"♀洪珝喬"<<endl;
r=rand()%4;
if(r==1)
b++;
for(int i=1; i<=b; i++)
cout<<" ";
cout<<"♂臧其輝"<<endl;
r=rand()%4;
if(r==2)
c++;
for(int i=1; i<=c; i++)
cout<<" ";
cout<<"♂小胖"<<endl;
r=rand()%4;
if(r==0)
d++;
for(int i=1; i<=d; i++)
cout<<" ";
cout<<"♀陳采蘊"<<endl;
system("cls");
}
}
複製代碼
作者:
巫沛庭
時間:
2017-10-3 19:40
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
rel:
int a=0,b=0,c=0,d=0,r=0;
system("cls");
cout<<"人山人海人見人愛 賽馬場"<<endl;
cout<<"---------------------------------------------|終點"<<endl;
cout<<"Q"<<endl;
cout<<"∮"<<endl;
cout<<"㊣"<<endl;
cout<<"♂"<<endl;
system("pause");
system("cls");
while(a!=45&&b!=45&&c!=45&&d!=45)
{
r=rand()%4;
if(r==0)
a++;
if(r==1)
b++;
cout<<"比賽進行中"<<endl;
cout<<"---------------------------------------------| 終點"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"Q"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"∮"<<endl;
system("cls");
}
goto rel;
}
作者:
巫晉宇
時間:
2017-10-3 19:43
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
mm:
int r=0 ,a=0,b=0,c=0,d=0;
system("cls");
cout<<"<<ㄏㄏ賽馬場>>"<<endl;
cout<<"歡迎很閒人來尬賽喔"<<endl;
cout<<"============================================================================終點"<<endl;
cout<<"㊣"<<endl;
cout<<"↗"<<endl;
cout<<"◇"<<endl;
cout<<"≒"<<endl;
system("pause");
system("cls");
while(a!=75 && b!=75 && c!=75 && d!=75)
{
r=rand()%4;
if(r==0)
a++;
cout<<"尬賽中"<<endl;
cout<<"============================================================================終點"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"㊣"<<endl;
system("cls");
}
goto mm;
system("pause");
return 0;
}
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2