標題:
賽馬程式 (二)
[打印本頁]
作者:
tonyh
時間:
2015-7-11 12:01
標題:
賽馬程式 (二)
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
re:
system("cls");
int a=0,b=0,c=0,d=0,r;
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
system("cls");
while(a<=73 && b<=73 && c<=73 && d<=73)
{
r=rand()%4+1; // 1~4
if(r==1)
a++;
else if(r==2)
b++;
else if(r==3)
c++;
else
d++;
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");
}
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("pause");
goto re;
return 0;
}
複製代碼
作者:
李知易
時間:
2015-7-11 12:07
本帖最後由 李知易 於 2015-8-29 11:07 編輯
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
re:
system("cls");
int a=0,b=0,c=0,d=0,r;
srand(time(NULL));
cout<<"[馬到成功\] 賽馬場"<<endl;
cout<<"--------------------------------------------------------------------------|終點"<<endl;
cout<<"#1"<<endl;
cout<<"#2"<<endl;
cout<<"#3"<<endl;
cout<<"#4"<<endl;
cout<<endl;
cout<<"#1: 閃電"<<endl;
cout<<"#2: 傑哥"<<endl;
cout<<"#3: 內褲哥"<<endl;
cout<<"#4: 辣椒妹"<<endl;
cout<<endl;
system("pause");
system("cls");
while(a<=35 && c<=35 && b<=35 && d<=35)
{
r=rand()%4+1;
if(r==1)
a++;
else if(r==2)
b++;
else if(r==3)
c++;
else
d++;
cout<<"比賽進行中"<<endl;
cout<<"--------------------------------------------------------------------------|終點"<<endl;
for(int i=0;i<=a;i++)
cout<<" ";
cout<<"#1"<<endl;
for(int i=0;i<=b;i++)
cout<<" ";
cout<<"#2"<<endl;
for(int i=0;i<=c;i++)
cout<<" ";
cout<<"#3"<<endl;
for(int i=0;i<=d;i++)
cout<<" ";
cout<<"#4"<<endl;
system("cls");
}
cout<<"比賽結束"<<endl;
cout<<"--------------------------------------------------------------------------|終點"<<endl;
for(int i=0;i<=a;i++)
cout<<" ";
cout<<"#1"<<endl;
for(int i=0;i<=b;i++)
cout<<" ";
cout<<"#2"<<endl;
for(int i=0;i<=c;i++)
cout<<" ";
cout<<"#3"<<endl;
for(int i=0;i<=d;i++)
cout<<" ";
cout<<"#4"<<endl;
cout<<endl;
cout<<"#1: 閃電"<<endl;
cout<<"#2: 傑哥"<<endl;
cout<<"#3: 內褲哥"<<endl;
cout<<"#4: 辣椒妹"<<endl;
cout<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
謝瀞儀
時間:
2015-7-11 12:08
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re:
int x=0,b=0,g=0,u=0,l=0,p=0,r;
srand(time(NULL));
cout<<"「Greece letter Casino」Race court"<<endl;
cout<<"---------------------------------------------------------|FIN"<<endl;
cout<<"χ"<<endl;
cout<<"β"<<endl;
cout<<"γ"<<endl;
cout<<"μ"<<endl;
cout<<"λ"<<endl;
cout<<"π"<<endl;
while(x<=55 and b<=55 and g<=55 and u<=55 and l<=55 and p<=55)
{
r=rand()%6+1;
if(r==1)
x++;
else if(r==2)
b++;
else if(r==3)
g++;
else if(r==4)
u++;
else if(r==5)
l++;
else
p++;
cout<<"「Greece letter Casino」Race court GAME ON"<<endl;
cout<<"---------------------------------------------------------|FIN"<<endl;
for(int i=0 ;i<=x ;i++)
cout<<" ";
cout<<"χ"<<endl;
for(int i=0 ;i<=b ;i++)
cout<<" ";
cout<<"β"<<endl;
for(int i=0 ;i<=g; i++)
cout<<" ";
cout<<"γ"<<endl;
for(int i=0 ;i<=u; i++)
cout<<" ";
cout<<"μ"<<endl;
for(int i=0; i<=l ;i++)
cout<<" ";
cout<<"λ"<<endl;
for(int i=0; i<=p ;i++)
cout<<" ";
cout<<"π"<<endl;
system("cls");
}
cout<<"「Greece letter Casino」Race court GAME OVER"<<endl;
cout<<"---------------------------------------------------------|FIN"<<endl;
for(int i=0 ;i<=x ;i++)
cout<<" ";
cout<<"χ"<<endl;
for(int i=0 ;i<=b ;i++)
cout<<" ";
cout<<"β"<<endl;
for(int i=0 ;i<=g; i++)
cout<<" ";
cout<<"γ"<<endl;
for(int i=0 ;i<=u; i++)
cout<<" ";
cout<<"μ"<<endl;
for(int i=0; i<=l ;i++)
cout<<" ";
cout<<"λ"<<endl;
for(int i=0; i<=p ;i++)
cout<<" ";
cout<<"π"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
謝瀞儀
時間:
2015-7-11 13:41
修正版
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re:
system("cls");
int x=0,b=0,g=0,u=0,l=0,p=0,r;
srand(time(NULL));
cout<<"「Greece letter Casino」Race court"<<endl;
cout<<"---------------------------------------------------------|FIN"<<endl;
cout<<"χ"<<endl;
cout<<"β"<<endl;
cout<<"γ"<<endl;
cout<<"μ"<<endl;
cout<<"λ"<<endl;
cout<<"π"<<endl;
system("pause");
while(x<=55 and b<=55 and g<=55 and u<=55 and l<=55 and p<=55)
{
r=rand()%6+1;
if(r==1)
x++;
else if(r==2)
b++;
else if(r==3)
g++;
else if(r==4)
u++;
else if(r==5)
l++;
else
p++;
cout<<"「Greece letter Casino」Race court GAME ON"<<endl;
cout<<"---------------------------------------------------------|FIN"<<endl;
for(int i=0 ;i<=x ;i++)
cout<<" ";
cout<<"χ"<<endl;
for(int i=0 ;i<=b ;i++)
cout<<" ";
cout<<"β"<<endl;
for(int i=0 ;i<=g; i++)
cout<<" ";
cout<<"γ"<<endl;
for(int i=0 ;i<=u; i++)
cout<<" ";
cout<<"μ"<<endl;
for(int i=0; i<=l ;i++)
cout<<" ";
cout<<"λ"<<endl;
for(int i=0; i<=p ;i++)
cout<<" ";
cout<<"π"<<endl;
system("cls");
}
cout<<"「Greece letter Casino」Race court GAME OVER"<<endl;
cout<<"---------------------------------------------------------|FIN"<<endl;
for(int i=0 ;i<=x ;i++)
cout<<" ";
cout<<"χ"<<endl;
for(int i=0 ;i<=b ;i++)
cout<<" ";
cout<<"β"<<endl;
for(int i=0 ;i<=g; i++)
cout<<" ";
cout<<"γ"<<endl;
for(int i=0 ;i<=u; i++)
cout<<" ";
cout<<"μ"<<endl;
for(int i=0; i<=l ;i++)
cout<<" ";
cout<<"λ"<<endl;
for(int i=0; i<=p ;i++)
cout<<" ";
cout<<"π"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
洪振庭
時間:
2015-7-11 14:56
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,z;
srand(time(NULL));
cout<<"1.Harry Poter "<<endl;
cout<<"2.Ron Weasley "<<endl;
cout<<"3.Cedric Diggory "<<endl;
cout<<"4.Draco Malfoy "<<endl;
cout<<"5.Cho Chang "<<endl;
cout<<"6.Fred Weasley "<<endl;
cout<<"7.George Weasley "<<endl;
cout<<"8.Ginny Weasley "<<endl;
system("pause");
cout<<"Broomstick fling a match of Hogwarts"<<endl;
cout<<"---------------------------------------------------------|win"<<endl;
cout<<"1"<<endl;
cout<<"2"<<endl;
cout<<"3"<<endl;
cout<<"4"<<endl;
cout<<"5"<<endl;
cout<<"6"<<endl;
cout<<"7"<<endl;
cout<<"8"<<endl;
system("pause");
system("cls");
while(a<=65 && b<=65 && c<=65 && d<=65 && e<=65 && f<=65 && g<=65 && h<=65)
{
z=rand()%8+1;
if(z==1)
a++;
else if(z==1)
b++;
else if(z==1)
c++;
else if(z==1)
d++;
else if(z==1)
e++;
else if(z==1)
f++;
else if(z==1)
g++;
else
h++;
cout<<"RUN"<<endl;
cout<<"---------------------------------------------------------|win"<<endl;
for(int i=0;i<=a;i++)
cout<<" "<<endl;
cout<<"1"<<endl;
for(int i=0;i<=b;i++)
cout<<" "<<endl;
cout<<"2"<<endl;
for(int i=0;i<=c;i++)
cout<<" "<<endl;
cout<<"3"<<endl;
for(int i=0;i<=d;i++)
cout<<" "<<endl;
cout<<"4"<<endl;
for(int i=0;i<=e;i++)
cout<<" "<<endl;
cout<<"5"<<endl;
for(int i=0;i<=f;i++)
cout<<" "<<endl;
cout<<"6"<<endl;
for(int i=0;i<=g;i++)
cout<<" "<<endl;
cout<<"7"<<endl;
for(int i=0;i<=h;i++)
cout<<" "<<endl;
cout<<"8"<<endl;
system("cls");
}
cout<<"over"<<endl;
cout<<"---------------------------------------------------------|win"<<endl;
for(int i=0;i<=a;i++)
cout<<" "<<endl;
cout<<"1"<<endl;
for(int i=0;i<=b;i++)
cout<<" "<<endl;
cout<<"2"<<endl;
for(int i=0;i<=c;i++)
cout<<" "<<endl;
cout<<"3"<<endl;
for(int i=0;i<=d;i++)
cout<<" "<<endl;
cout<<"4"<<endl;
for(int i=0;i<=e;i++)
cout<<" "<<endl;
cout<<"5"<<endl;
for(int i=0;i<=f;i++)
cout<<" "<<endl;
cout<<"6"<<endl;
for(int i=0;i<=g;i++)
cout<<" "<<endl;
cout<<"7"<<endl;
for(int i=0;i<=h;i++)
cout<<" "<<endl;
cout<<"8"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
梁和雋
時間:
2015-7-18 10:52
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
re:
system("cls");
int a=0,b=0,c=0,d=0,r;
srand(time(NULL));
cout<<"「MY GO DID」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"as"<<endl;
cout<<"ad"<<endl;
cout<<"af"<<endl;
cout<<"ag"<<endl;
system("pause");
system("cls");
while(a<=35 && b<=35 && c<=35 && d<=35)
{
r=rand()%4+1;
if(r==1)
a++;
else if(r==2)
b++;
else if(r==3)
c++;
else
d++;
cout<<"進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=a; i++)
cout<<" ";
cout<<"as"<<endl;
for(int i=0; i<=b; i++)
cout<<" ";
cout<<"ad"<<endl;
for(int i=0; i<=c; i++)
cout<<" ";
cout<<"af"<<endl;
for(int i=0; i<=d; i++)
cout<<" ";
cout<<"ag"<<endl;
system("cls");
}
cout<<"結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=a; i++)
cout<<" ";
cout<<"as"<<endl;
for(int i=0; i<=b; i++)
cout<<" ";
cout<<"ad"<<endl;
for(int i=0; i<=c; i++)
cout<<" ";
cout<<"af"<<endl;
for(int i=0; i<=d; i++)
cout<<" ";
cout<<"ag"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
李大全
時間:
2015-7-18 10:52
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
re:
system("cls");
int a=0,b=0,c=0,d=0,r;
srand(time(NULL));
cout<<"「好事成雙」賽馬場"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
system("pause");
system("cls");
while(a<=73 && b<=73 && c<=73 && d<=73)
{
r=rand()%4+1; // 1~4
if(r==1)
a++;
else if(r==2)
b++;
else if(r==3)
c++;
else
d++;
cout<<"比賽進行中"<<endl;
cout<<"-------------------------------------------------------------------------| 終點"<<endl;
for(int i=0; i<=a; i++)
cout<<" ";
cout<<"1111"<<endl;
for(int i=0; i<=b; i++)
cout<<" ";
cout<<"111"<<endl;
for(int i=0; i<=c; i++)
cout<<" ";
cout<<"11"<<endl;
for(int i=0; i<=d; i++)
cout<<" ";
cout<<"1"<<endl;
system("cls");
}
cout<<"賽結束"<<endl;
cout<<"-------------------------------------------------------------------------| 終"<<endl;
for(int i=0; i<=a; i++)
cout<<" ";
cout<<"1111"<<endl;
for(int i=0; i<=b; i++)
cout<<" ";
cout<<"111"<<endl;
for(int i=0; i<=c; i++)
cout<<" ";
cout<<"11"<<endl;
for(int i=0; i<=d; i++)
cout<<" ";
cout<<"1"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
作者:
洪振庭
時間:
2015-7-18 10:59
本帖最後由 tonyh 於 2015-7-18 11:22 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,z;
srand(time(NULL));
cout<<"1.Harry Poter "<<endl;
cout<<"2.Ron Weasley "<<endl;
cout<<"3.Cedric Diggory "<<endl;
cout<<"4.Draco Malfoy "<<endl;
cout<<"5.Cho Chang "<<endl;
cout<<"6.Fred Weasley "<<endl;
cout<<"7.George Weasley "<<endl;
cout<<"8.Ginny Weasley "<<endl;
system("pause");
system("cls");
cout<<"Broomstick fling a match of Hogwarts"<<endl;
cout<<"-----------------------------------------------------------------------|win"<<endl;
cout<<"1"<<endl;
cout<<"2"<<endl;
cout<<"3"<<endl;
cout<<"4"<<endl;
cout<<"5"<<endl;
cout<<"6"<<endl;
cout<<"7"<<endl;
cout<<"8"<<endl;
system("pause");
system("cls");
while(a<=65 && b<=65 && c<=65 && d<=65 && e<=65 && f<=65 && g<=65 && h<=65)
{
z=rand()%8+1;
if(z==1)
a++;
else if(z==2)
b++;
else if(z==3)
c++;
else if(z==4)
d++;
else if(z==5)
e++;
else if(z==6)
f++;
else if(z==7)
g++;
else
h++;
cout<<"RUN"<<endl;
cout<<"-----------------------------------------------------------------------|win"<<endl;
for(int i=0;i<=a;i++)
cout<<" ";
cout<<"1"<<endl;
for(int i=0;i<=b;i++)
cout<<" ";
cout<<"2"<<endl;
for(int i=0;i<=c;i++)
cout<<" ";
cout<<"3"<<endl;
for(int i=0;i<=d;i++)
cout<<" ";
cout<<"4"<<endl;
for(int i=0;i<=e;i++)
cout<<" ";
cout<<"5"<<endl;
for(int i=0;i<=f;i++)
cout<<" ";
cout<<"6"<<endl;
for(int i=0;i<=g;i++)
cout<<" ";
cout<<"7"<<endl;
for(int i=0;i<=h;i++)
cout<<" ";
cout<<"8"<<endl;
system("cls");
}
cout<<"over"<<endl;
cout<<"--------------------------------------------------------------------|win"<<endl;
for(int i=0;i<=a;i++)
cout<<" ";
cout<<"1"<<endl;
for(int i=0;i<=b;i++)
cout<<" ";
cout<<"2"<<endl;
for(int i=0;i<=c;i++)
cout<<" ";
cout<<"3"<<endl;
for(int i=0;i<=d;i++)
cout<<" ";
cout<<"4"<<endl;
for(int i=0;i<=e;i++)
cout<<" ";
cout<<"5"<<endl;
for(int i=0;i<=f;i++)
cout<<" ";
cout<<"6"<<endl;
for(int i=0;i<=g;i++)
cout<<" ";
cout<<"7"<<endl;
for(int i=0;i<=h;i++)
cout<<" ";
cout<<"8"<<endl;
system("pause");
return 0;
}
複製代碼
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,z;
srand(time(NULL));
cout<<"Broomstick fling a match of Hogwarts"<<endl;
cout<<"---------------------------------------------------------|win"<<endl;
cout<<"1"<<endl;
cout<<"2"<<endl;
cout<<"3"<<endl;
cout<<"4"<<endl;
cout<<"5"<<endl;
cout<<"6"<<endl;
cout<<"7"<<endl;
cout<<"8"<<endl;
cout<<endl;
cout<<"1.Harry Poter "<<endl;
cout<<"2.Ron Weasley "<<endl;
cout<<"3.Cedric Diggory "<<endl;
cout<<"4.Draco Malfoy "<<endl;
cout<<"5.Cho Chang "<<endl;
cout<<"6.Fred Weasley "<<endl;
cout<<"7.George Weasley "<<endl;
cout<<"8.Ginny Weasley "<<endl;
cout<<endl;
system("pause");
system("cls");
while(a<=65 && b<=65 && c<=65 && d<=65 && e<=65 && f<=65 && g<=65 && h<=65)
{
z=rand()%8+1;
if(z==1)
a++;
else if(z==2)
b++;
else if(z==3)
c++;
else if(z==4)
d++;
else if(z==5)
e++;
else if(z==6)
f++;
else if(z==7)
g++;
else
h++;
cout<<"RUN"<<endl;
cout<<"---------------------------------------------------------|win"<<endl;
for(int i=0;i<=a;i++)
cout<<" ";
cout<<"1"<<endl;
for(int i=0;i<=b;i++)
cout<<" ";
cout<<"2"<<endl;
for(int i=0;i<=c;i++)
cout<<" ";
cout<<"3"<<endl;
for(int i=0;i<=d;i++)
cout<<" ";
cout<<"4"<<endl;
for(int i=0;i<=e;i++)
cout<<" ";
cout<<"5"<<endl;
for(int i=0;i<=f;i++)
cout<<" ";
cout<<"6"<<endl;
for(int i=0;i<=g;i++)
cout<<" ";
cout<<"7"<<endl;
for(int i=0;i<=h;i++)
cout<<" ";
cout<<"8"<<endl;
system("cls");
}
cout<<"over"<<endl;
cout<<"---------------------------------------------------------|win"<<endl;
for(int i=0;i<=a;i++)
cout<<" ";
cout<<"1"<<endl;
for(int i=0;i<=b;i++)
cout<<" ";
cout<<"2"<<endl;
for(int i=0;i<=c;i++)
cout<<" ";
cout<<"3"<<endl;
for(int i=0;i<=d;i++)
cout<<" ";
cout<<"4"<<endl;
for(int i=0;i<=e;i++)
cout<<" ";
cout<<"5"<<endl;
for(int i=0;i<=f;i++)
cout<<" ";
cout<<"6"<<endl;
for(int i=0;i<=g;i++)
cout<<" ";
cout<<"7"<<endl;
for(int i=0;i<=h;i++)
cout<<" ";
cout<<"8"<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2