標題:
賽馬程式 (七)
[打印本頁]
作者:
陳品肇
時間:
2019-5-4 13:03
標題:
賽馬程式 (七)
完成選項 (3)離開 的相對應程式碼
在離開時顯示戰果, 譬如:
"沒輸沒贏! 全身而退!"
"恭喜你! 這次總共贏了100元!"
"不好意思! 讓你損失了200元!"
[attach]6409[/attach]
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n=1,balance=0,winner,money=0;
re1:
int a=0, b=0, c=0, d=0, r, option, buyin, bet;
system("cls");
cout<<"「好事成雙」賽馬場 第 "<<n<<" 局"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
cout<<endl;
cout<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
balance+=buyin; //balance=balance+buyin
goto re1;
}else if(option==2)
{
if(balance==0)
{
cout<<"可用餘額不足! 請先買入!"<<endl<<endl;
system("pause");
goto re1;
}
cout<<"下注: ";
cin>>bet;
if(bet>balance)
{
cout<<"可用餘額不足! 請先買入!"<<endl<<endl;
system("pause");
goto re1;
}else
{
cout<<endl<<"(1)◆ (2)★ (3)▲ (4)● 請選擇: ";
cin>>option;
cout<<"比賽即將開始..."<<endl<<endl;
system("pause");
}
}else if(option==3)
{
goto end;
}else
{
cout<<"輸入錯誤!"<<endl;
system("pause");
goto re1;
}
system("cls");
srand(time(NULL));
while(a!=75 && b!=75 && c!=75 && d!=75)
{
r=rand()%4; //產生0~3之隨機亂數
if(r==0)
a++;
else if(r==1)
b++;
else if(r==2)
c++;
else
d++;
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=1; i<=b; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=1; i<=c; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=1; i<=d; i++)
cout<<" ";
cout<<"●"<<endl;
system("cls");
}
cout<<"比賽結束! 由 ";
if(a==75)
{
cout<<"◆";
winner=1;
}
else if(b==75)
{
cout<<"★";
winner=2;
}
else if(c==75)
{
cout<<"▲";
winner=3;
}
else
{
cout<<"●";
winner=4;
}
cout<<" 先馳得點!"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=1; i<=b; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=1; i<=c; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=1; i<=d; i++)
cout<<" ";
cout<<"●"<<endl<<endl;
if(option==winner)
{
cout<<"贏了"<<bet*3<<"元!"<<endl;
balance+=bet*3;
money+=bet*3;
}else
{
cout<<"損失"<<bet<<"元!"<<endl;
balance-=bet;
money-=bet;
}
system("pause");
n++;
goto re1;
end:
if(money==0)
{
cout<<"沒輸沒贏! 全身而退!"<<endl;
}else if(money>0)
{
cout<<"恭喜你! 這次總共贏了"<<money<<"元!"<<endl;
}else
{
cout<<"不好意思! 讓你損失了"<<money<<"元!"<<endl;
}
cout<<"謝謝光臨! 下次再來!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
吳孟書
時間:
2019-5-4 13:46
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int t=1,m=0,total=0;
re:
system("cls");
int a=0,b=0,c=0,d=0,r,choose,in,bet,h,w;
cout<<"「好事成雙」賽馬場 第"<<t<<"局"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl<<endl;
cout<<"可用餘額:"<<m<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇:";
cin>>choose;
if(choose==1)
{
w1:
cout<<"買入: ";
cin>>in;
if(in>0)
{
m=m+in;
goto re;
}
else
{
cout<<"輸入錯誤"<<endl;
system("pause");
goto w1;
}
}else if(choose==2)
{
cout<<"請下注:";
cin>>bet;
cout<<endl;
if(bet>m)
{
cout<<"您餘額不足,請重新輸入!"<<endl;
system("pause");
goto re;
}else if(bet>=0 && bet<= m)
{
cout<<"(1)◆ (2)★ (3)▲(4)● 請選擇:";
cin>>h;
cout<<"比賽即將開始!"<<endl<<endl;
}else
{
cout<<"輸入錯誤"<<endl;
system("pause");
goto re;
}
}else if(choose==3)
{
goto end;
}else
{
cout<<"輸入錯誤"<<endl;
system("pause");
goto re;
}
system("pause");
system("cls");
srand(time(NULL));
while(a!=70 && b!=70 && c!=70 && d!=70)
{
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
r=rand()%4+1;
if(r==1)
{
a++;
}
if(r==2)
{
b++;
}
if(r==3)
{
c++;
}
if(r==4)
{
d++;
}
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<<"比賽結束!由";
if(a==70)
{
cout<<"◆";
w=1;
}
else if(b==70)
{
cout<<"★";
w=2;
}
else if(c==70)
{
cout<<"▲";
w=3;
}
else if(d==70)
{
cout<<"●";
w=4;
}
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;
if(h==w)
{
m=m+bet*3;
cout<<"贏了"<<bet*3<<"元"<<endl;
total=total+bet*3;
}else
{
m=m-bet;
cout<<"損失"<<bet<<"元"<<endl;
total=total-bet;
}
system("pause");
system("cls");
t++;
goto re;
end:
cout<<endl;
if(total>0)
{
cout<<"恭喜你!這次總共贏了"<<total<<"元!"<<endl;
}else if(total<0)
{
cout<<"不好意思!讓你損失了"<<-total<<"元!"<<endl;
}else
{
cout<<"沒輸沒贏!全身而退!"<<endl;
}
cout<<endl;
cout<<"謝謝光臨!下次再來!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
曲書辰
時間:
2019-5-4 13:47
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n=1,mon=0,in,choose,out=0,peo;
re:
int a=0,b=0,c=0,d=0,h;
cout<<"「好事成雙」賽馬場"<<"第"<<n<<"場"<<endl;
cout<<"|--------------------------------------------------|"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
cout<<"可用餘額為"<<mon<<endl;
cout<<"1.買入\t2.下注\t3.離開"<<endl;
cin>>choose;
if(choose==1)
{ system("cls");
cout<<"請輸入買入金額:";
cin>>in ;
mon+=in;
system("cls");
goto re;
}
else if(choose==2)
{
cout<<"請輸入下注金額:";
cin>>out;
if(mon>=out && out>=1)
{
cout<<"下注對象\ta:◆\tb:★\tc:▲\td:●:";
cin>>peo;
mon-=out;
goto start;
}else
{cout<<"錯誤";
system("pause");
system("cls");
goto re;
}
}else
{ system("cls");
goto end;
}
srand(time(NULL));
start:
system("pause");
system("cls");
while(a!=50 && b!=50 && c!=50 && d!=50)
{
cout<<"賽馬進行中"<<endl;
cout<<"|--------------------------------------------------|"<<endl;
h = rand()%4+1;
if(h==1)
a++;
if(h==2)
b++;
if(h==3)
c++;
if(h==4)
d++;
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<<"比賽結束\t";
if(a==50)
{cout<<"由◆拿下勝利";
if(peo==a)
{
cout<<"贏得"<<out*3<<endl;
mon+=out*3;
}else
{cout<<"損失"<<out<<endl;
}
}
else if(b==50)
{cout<<"由★拿下勝利";
if(peo==a)
{
cout<<"贏得"<<out*3<<endl;
mon+=out*3;
}else
{cout<<"損失"<<out<<endl;
}
}
else if(c==50)
{cout<<"由▲拿下勝利";
if(peo==a)
{
cout<<"贏得"<<out*3<<endl;
mon+=out*3;
}else
{cout<<"損失"<<out<<endl;
}
}
else
{cout<<"由●拿下勝利";
if(peo==a)
{
cout<<"贏得"<<out*3<<endl;
mon+=out*3;
}else
{cout<<"損失"<<out<<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");
system("cls");
n++;
goto re;
end:
system("pause");
system("cls");
return 0;
}
複製代碼
作者:
湯郡一
時間:
2019-5-4 13:51
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n=1,balance=0,winner,money=0;
re1:
int a=0, b=0, c=0, d=0, r, option, buyin, bet;
system("cls");
cout<<"「好事成雙」賽馬場 第 "<<n<<" 局"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
cout<<endl;
cout<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
balance+=buyin;
goto re1;
}else if(option==2)
{
if(balance==0)
{
cout<<"可用餘額不足! 請先買入!"<<endl<<endl;
system("pause");
goto re1;
}
cout<<"下注: ";
cin>>bet;
if(bet>balance)
{
cout<<"可用餘額不足! 請先買入!"<<endl<<endl;
system("pause");
goto re1;
}else
{
cout<<endl<<"(1)◆ (2)★ (3)▲ (4)● 請選擇: ";
cin>>option;
cout<<"比賽即將開始..."<<endl<<endl;
system("pause");
}
}else if(option==3)
{
goto end;
}else
{
cout<<"輸入錯誤!"<<endl;
system("pause");
goto re1;
}
system("cls");
srand(time(NULL));
while(a!=75 && b!=75 && c!=75 && d!=75)
{
r=rand()%4;
if(r==0)
a++;
else if(r==1)
b++;
else if(r==2)
c++;
else
d++;
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=1; i<=b; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=1; i<=c; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=1; i<=d; i++)
cout<<" ";
cout<<"●"<<endl;
system("cls");
}
cout<<"比賽結束! 由 ";
if(a==75)
{
cout<<"◆";
winner=1;
}
else if(b==75)
{
cout<<"★";
winner=2;
}
else if(c==75)
{
cout<<"▲";
winner=3;
}
else
{
cout<<"●";
winner=4;
}
cout<<" 先馳得點!"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
for(int i=1; i<=a; i++)
cout<<" ";
cout<<"◆"<<endl;
for(int i=1; i<=b; i++)
cout<<" ";
cout<<"★"<<endl;
for(int i=1; i<=c; i++)
cout<<" ";
cout<<"▲"<<endl;
for(int i=1; i<=d; i++)
cout<<" ";
cout<<"●"<<endl<<endl;
if(option==winner)
{
cout<<"贏了"<<bet*3<<"元!"<<endl;
balance+=bet*3;
money+=bet*3;
}else
{
cout<<"損失"<<bet<<"元!"<<endl;
balance-=bet;
money-=bet;
}
system("pause");
n++;
goto re1;
end:
if(money==0)
{
cout<<"沒輸沒贏! 全身而退!"<<endl;
}else if(money>0)
{
cout<<"恭喜你! 這次總共贏了"<<money<<"元!"<<endl;
}else
{
cout<<"不好意思! 讓你損失了"<<money<<"元!"<<endl;
}
cout<<"謝謝光臨! 下次再來!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
吳孟修
時間:
2019-5-4 13:55
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n=1,money=0,total=0;
re:
int a=0,b=0,c=0,d=0,r,option,buyin,bet,horse,winner;
system("cls");
cout<<"「好事成雙」賽馬場 第"<<n<<"局"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
cout<<"\n可用金額:"<<money<<"元\n"<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇:";
cin>>option;
if(option==1)
{
cout<<"請買入:";
cin>>buyin;
if(buyin<0)
{
cout<<"您輸入的金額有誤,請重新買入!"<<endl;
}
money+=buyin;
goto re;
}
else if(option==2)
{
cout<<"請下注:";
cin>>bet;
if(bet>money)
{
cout<<"您的金額不足,請重新下注!"<<endl;
system("pause");
goto re;
}
else if(bet>=0 && bet<=money)
{
cout<<"(1)◆ (2)★ (3)▲ (4)● 請選擇:";
cin>>horse;
if(horse!=1 && horse!=2 && horse!=3 && horse!=4)
{
cout<<"您輸入的編號有誤,請重新選擇!"<<endl;
system("pause");
goto re;
}
else
{
cout<<"比賽即將開始!\n\n";
}
}
else
{
cout<<"您輸入的金額有誤,請重新下注!"<<endl;
system("pause");
goto re;
}
}
else if(option==3)
{
goto end;
}
else
{
cout<<"您輸入錯誤,請重新選擇!"<<endl;
system("pause");
goto re;
}
system("pause");
system("cls");
srand(time(NULL));
while(a!=70 && b!=70 && c!=70 && d!=70)
{
cout<<"比賽進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
r=rand()%4+1;
if(r==1)
{
a++;
}
if(r==2)
{
b++;
}
if(r==3)
{
c++;
}
if(r==4)
{
d++;
}
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<<"比賽結束!由";
if(a==70)
{
cout<<"◆";
winner=1;
}
if(b==70)
{
cout<<"★";
winner=2;
}
if(c==70)
{
cout<<"▲";
winner=3;
}
if(d==70)
{
cout<<"●";
winner=4;
}
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;
if(horse==winner)
{
money+=bet*3;
cout<<"贏了"<<bet*3<<"元!"<<endl;
total+=bet*3;
}
else
{
money-=bet;
cout<<"損失"<<bet<<"元!"<<endl;
total-=bet;
}
system("pause");
system("cls");
n++;
goto re;
end:
if(total>0)
{
cout<<"\n恭喜您,贏了"<<total<<"元!\n"<<endl;
}
else if(total<0)
{
cout<<"\n不好意思,讓您損失了"<<-total<<"元!\n"<<endl;
}
else
{
cout<<"\n不輸不贏,全身而退!\n"<<endl;
}
cout<<"謝謝光臨,下次再來!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
洪寬瀧
時間:
2019-5-4 13:57
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int n=1,f=0,win,money=0;
re:
int a=0,b=0,c=0,d=0,r,j,k,bet,horse,winner;
system("cls");
cout<<"「好事成雙」賽馬場 第"<<n<<"局"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
cout<<endl;
cout<<"可用餘額: "<<f<<"元"<<endl;
cout<<"(1)買入(2)下注(3)離開 請選擇: "<<endl;
cin>>j;
if(j==1)
{
cout<<"買入: ";
cin>>k;
f+=k;
goto re;
}else if(j==2)
{
cout<<"請下注";
cin>>bet;
if(bet>k)
{
cout<<"您餘額不足,請重新下注!"<<endl;
system("pause");
goto re;
}else if(bet>=0 && bet<= f)
{
cout<<"(1)◆ (2)★ (3)▲(4)● 請選擇:";
cin>>horse;
cout<<"比賽即將開始"<<endl;
}else
{
cout<<"您輸入錯誤!!請重新下注!"<<endl;
system("pause");
goto re;
}
}else
{
goto end;
}
system("pause");
system("cls"); //清空畫面
srand(time(NULL)); //撒亂樹種子
while(a!=70 && b!=70 && c!=70&& d!=70) //判斷四隻馬只要有一隻到終點就跳離while
{
cout<<"賽馬進行中"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
r = rand()%4+1; //產生1~4亂數 隨機挑馬1~4其中一隻
if(r==1)
a++;
if(r==2)
b++;
if(r==3)
c++;
if(r==4)
d++;
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<<"賽馬結束!";
if(a==70)
{
cout<<"由◆先馳得點!"<<endl;
}else if(b==70)
{
cout<<"由★先馳得點!"<<endl;
}else if(c==70)
{
cout<<"由▲先馳得點!"<<endl;
}else
{
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;
if(horse==winner)
{
cout<<"贏了"<<bet*3<<"元!"<<endl;
f+=bet*3;
money=bet*3;
}else
{
f-=bet;
money-=bet;
cout<<"損失"<<bet<<"元"<<endl;
}
n++;
system("pause");
system("cls");
goto re;
end:
if(money==0)
{
cout<<"沒輸沒贏!全身而退"<<endl;
}else if(money>0)
{
cout<<"恭喜你! 贏了"<<money<<"元"<<endl;
}else
{
cout<<"不好意思,讓你輸了"<<-money<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
田宇任
時間:
2019-5-4 14:06
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int s=1,m=0,bg=0;
re:
int a=0,b=0,c=0,d=0,r,o,z,h,w;
system("cls");
cout<<"賽馬場 第"<<s<<"局"<<endl;
cout<<"--------------------------------------------------------------------|終點"<<endl;
cout<<"◆"<<endl;
cout<<"★"<<endl;
cout<<"▲"<<endl;
cout<<"●"<<endl;
cout<<"可用餘額: "<<m<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇:";
cin>>o;
if(o==1)
{
cout<<"買入: ";
cin>>z;
m=m+z;
goto re;
}else if(o==2)
{
cout<<"請下注: ";
cin>>z;
if(z > m)
{
cout<<"餘額不足,請重新下注!"<<endl;
system("pause");
goto re;
}else if(z>=0 && z<= m)
{
cout<<"(1)◆馬 (2)★馬 (3)▲馬 (4)●馬 請選擇:";
cin>>h;
cout<<"比賽即將開始!"<<endl<<endl;
}
}else if(o==3)
{
goto end;
}
else
{
cout<<"您輸入錯誤!!請重新下注!"<<endl;
system("pause");
goto re;
}
system("pause");
system("cls");
srand(time(NULL));
while(a!=70 && b!=70 && c!=70 && d!=70)
{
cout<<"起跑嘍~~~~~"<<endl;
cout<<"------------------------------------------------------------------------| 終點"<<endl;
r = rand()%4+1;
if(r==1)
a++;
if(r==2)
b++;
if(r==3)
c++;
if(r==4)
d++;
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<<"比賽結束! 由";
if(a==75)
{
cout<<"◆";
w = 1;
}
else if(b==75)
{
cout<<"★";
w = 2;
}
else if(c==75)
{
cout<<"▲";
w = 3;
}
else
{
cout<<"●";
w = 4;
}
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;
if(h==w)
{
m=m+(z*3);
cout<<"贏了"<<z*3<<"元!"<<endl;
bg+=z*3;
}else
{
m=m-z;
cout<<"損失"<<z<<"元!"<<endl;
bg-=z;
}
system("pause");
s++;
goto re;
end:
if(bg==0)
{
cout<<"沒輸沒贏!"<<endl;
}else if(bg>0)
{
cout<<"恭喜你! 這次總共贏了"<<bg<<"元!"<<endl;
}else
{
cout<<"哈哈 你損失了"<<-bg<<"元!"<<endl;
}
cout<<"銘謝惠顧! 下次再來!"<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2