標題:
賽馬程式 (五)
[打印本頁]
作者:
tonyh
時間:
2013-11-9 14:49
標題:
賽馬程式 (五)
本帖最後由 tonyh 於 2013-11-9 14:54 編輯
使買入, 下注, 離開的功能完善.
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int balance=0;
int bet,buyin,option,winner;
re1:
int a=0,b=0,c=0,d=0,r;
system("cls");
cout<<"$ 財源滾滾賽馬場 $"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
cout<<"◥1◣"<<endl;
cout<<"◥2◣"<<endl;
cout<<"◥3◣"<<endl;
cout<<"◥4◣"<<endl;
cout<<endl<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
balance+=buyin; //i+=2 i=i+2
goto re1;
}else if(option==2)
{
cout<<"下注: ";
cin>>bet;
if(bet>balance)
{
cout<<"可用餘額不足!請先買入!"<<endl<<endl;
system("pause");
goto re1;
}else
{
cout<<endl<<"(1)◥1◣ (2)◥2◣ (3)◥3◣ (4)◥4◣ 請選擇: ";
cin>>option;
cout<<"比賽即將開始!"<<endl<<endl;
}
}else if(option==3)
{
goto end;
}else
{
cout<<"輸入錯誤!"<<endl<<endl;
system("pause");
goto re1;
}
system("pause");
system("cls");
srand(time(NULL));
while((a!=70)&&(b!=70)&&(c!=70)&&(d!=70))
{
r=rand()%4; //產生0~3之隨機亂數
if(r==0)
a++;
if(r==1)
b++;
if(r==2)
c++;
if(r==3)
d++;
cout<<"比賽進行中"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("cls");
}
if(a>b && a>c && a>d)
winner=1;
else if(b>a && b>c && b>d)
winner=2;
else if(c>a && c>b && c>d)
winner=3;
else
winner=4;
cout<<"比賽結束! 由 "<<winner<<" 號選手先馳得點!"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
end:
system("pause");
return 0;
}
複製代碼
作者:
林以諾
時間:
2013-11-9 14:52
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int balance=0;
int bet,buyin,option,winner;
re1:
int a=0,b=0,c=0,d=0,r;
system("cls");
cout<<"以諾帥哥』賽馬場!"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
cout<<"◥1◣"<<endl;
cout<<"◥2◣"<<endl;
cout<<"◥3◣"<<endl;
cout<<"◥4◣"<<endl;
cout<<endl<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
balance+=buyin; //i+=2 i=i+2
goto re1;
}else if(option==2)
{
cout<<"下注: ";
cin>>bet;
if(bet>balance)
{
cout<<"可用餘額不足!請先買入!"<<endl<<endl;
system("pause");
goto re1;
}else
{
cout<<endl<<"(1)◥1◣ (2)◥2◣ (3)◥3◣ (4)◥4◣ 請選擇: ";
cin>>option;
cout<<"比賽即將開始!"<<endl<<endl;
}
}else if(option==3)
{
goto end;
}else
{
cout<<"輸入錯誤!"<<endl<<endl;
system("pause");
goto re1;
}
system("pause");
system("cls");
srand(time(NULL));
while((a!=70)&&(b!=70)&&(c!=70)&&(d!=70))
{
r=rand()%4;
if(r==0)
a++;
if(r==1)
b++;
if(r==2)
c++;
if(r==3)
d++;
cout<<"比賽進行中"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("cls");
}
if(a>b && a>c && a>d)
winner=1;
else if(b>a && b>c && b>d)
winner=2;
else if(c>a && c>b && c>d)
winner=3;
else
winner=4;
cout<<"比賽結束! 由 "<<winner<<" 號選手先馳得點!"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
end:
system("pause");
return 0;
}
複製代碼
作者:
黃崇維
時間:
2013-11-9 14:53
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int balance=0, n=1, money=0;
int option, buyin, bet, winner;
re1:
int a=0, b=0, c=0, d=0, r;
system("cls");
cout<<"「好事雙成」賽馬場 第"<<n<<"局"<<endl;
cout<<"---------------------------------------------------------|終點"<<endl;
cout<<"◥1◣"<<endl;
cout<<"◥2◣"<<endl;
cout<<"◥3◣"<<endl;
cout<<"◥4◣"<<endl;
re2:
cout<<endl<<"可用餘額:"<<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)◥1◣(2)◥2◣(3)◥3◣(4)◥4◣請選擇: ";
cin>>option;
cout<<"比賽即將開始!"<<endl<<endl;
system("pause");
}
}else if(option==3)
{
cout<<"輸入錯誤!"<<endl<<endl;
system("pause");
goto re1;
}
srand(time(NULL));
while((a!=60)&&(b!=60)&&(c!=60)&&(d!=60))
{
r=rand()%4;
if(r==0)
a++;
else if(r==1)
b++;
else if(r==2)
c++;
else
d++;
cout<<"比賽進行中...";
cout<<endl<<"---------------------------------------------------------|終點"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("cls");
}
if(a>b&&a>c&&a>d)
winner=1;
else if(b>a&&b>c&&b>d)
winner=2;
else if(c>a&&c>b&&c>d)
winner=3;
else
winner=4;
cout<<"比賽結束!"<<endl;
cout<<"由"<<winner<<"號選手拿到勝利----------------------------------------|終點"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
張瀚仁
時間:
2013-11-9 15:01
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int money=0,cg,n=1,buy,bet,player,choose;
choose:
cout<<"第"<<n<<"場"<<endl;
cout<<"*準備輸光吧賽馬場*"<<endl;
cout<<endl<<"-----------------------------------------------------------------------|終點|"<<endl;
cout<<"◢1◤"<<endl;
cout<<"◢2◤"<<endl;
cout<<"◢3◤"<<endl;
cout<<"◢4◤"<<endl;
cout<<"您有"<<money<<"元"<<endl;
cout<<"需先買入並下注"<<endl;
cout<<"(1)買入(2)賭(3)離開"<<endl;
cin>>choose;
if(choose==1)
{
cout<<"買多少?"<<endl;
cin>>buy;
money=money+buy;
system("cls");
goto choose;
}else if(choose==2)
{
cout<<"想賭哪位選手(共有4位)"<<endl;
cin>>player;
if(player>4 || player<1)
{
system("cls");
goto choose;
}
cout<<"想賭多少?"<<endl;
cin>>bet;
if(bet>money)
{
system("cls");
goto choose;
}
cout<<"(1)比賽開始(2)重選"<<endl;
cin>>cg;
system("cls");
if(cg==1)
goto re;
else if(cg==2)
goto choose;
else
cout<<"輸入錯誤"<<endl;
goto choose;
}else if(choose==3)
{
system("cls");
}
else
cout<<"輸入錯誤"<<endl;
system("cls");
goto choose;
re:
cout<<"*準備輸光吧賽馬場*"<<endl<<endl;
cout<<endl<<"-----------------------------------------------------------------------|終點|"<<endl;
cout<<"◢1◤"<<endl;
cout<<"◢2◤"<<endl;
cout<<"◢3◤"<<endl;
cout<<"◢4◤"<<endl;
system("pause");
system("cls");
srand(time(NULL));
int a=0 ,b=0, c=0, d=0,r,bigger,biggest,more;
while((a!=65) && (b!=65) && (c!=65) && (d!=65))
{
r=rand()%4;
if(r==0)
a++;
else if(r==1)
b++;
else if(r==2)
c++;
else if(r==3)
d++;
cout<<"比賽進行中"<<endl<<endl;
cout<<endl<<"-----------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◢1◤"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◢2◤"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◢3◤"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◢4◤"<<endl;
system("cls");
}
more=(a>b)?a:b;
bigger=(c>d)?c:d;
biggest=(bigger>more)?bigger:more;
if(biggest==a)
cout<<"1號勝利"<<endl;
else if(biggest==b)
cout<<"2號勝利"<<endl;
else if(biggest==c)
cout<<"3號勝利"<<endl;
else if(biggest==d)
cout<<"4號勝利"<<endl;
cout<<"第"<<n<<"場"<<endl;
cout<<endl<<"-----------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◢1◤"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◢2◤"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◢3◤"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◢4◤"<<endl;
n++;
if(biggest==a && player==1)
{
money=money+bet;
cout<<"恭喜你贏了"<<bet<<"元"<<endl;
}else if(biggest==b && player==2)
{
money=money+bet;
cout<<"恭喜你贏了"<<bet<<"元"<<endl;
}else if(biggest==c && player==3)
{
money==money+bet;
cout<<"恭喜你贏了"<<bet<<"元"<<endl;
}else if(biggest==d && player==4)
{
money=money+bet;
cout<<"恭喜你贏了"<<bet<<"元"<<endl;
}else
{
money=money-bet;
cout<<"恭喜你輸了"<<bet<<"元"<<endl;
}
system("pause");
system("cls");
goto choose;
system("pause");
return 0;
}
複製代碼
作者:
許逸群
時間:
2013-11-9 15:03
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int balance=0;
int bet,buyin,option,winner;
re1:
int a=0,b=0,c=0,d=0,r;
system("cls");
cout<<"$ 財源滾滾賽馬場 $"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
cout<<"◥1◣"<<endl;
cout<<"◥2◣"<<endl;
cout<<"◥3◣"<<endl;
cout<<"◥4◣"<<endl;
cout<<endl<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
balance+=buyin; //i+=2 i=i+2
goto re1;
}else if(option==2)
{
cout<<"下注: ";
cin>>bet;
if(bet>balance)
{
cout<<"可用餘額不足!請先買入!"<<endl<<endl;
system("pause");
goto re1;
}else
{
cout<<endl<<"(1)◥1◣ (2)◥2◣ (3)◥3◣ (4)◥4◣ 請選擇: ";
cin>>option;
cout<<"比賽即將開始!"<<endl<<endl;
}
}else if(option==3)
{
goto end;
}else
{
cout<<"輸入錯誤!"<<endl<<endl;
system("pause");
goto re1;
}
system("pause");
system("cls");
srand(time(NULL));
while((a!=70)&&(b!=70)&&(c!=70)&&(d!=70))
{
r=rand()%4; //產生0~3之隨機亂數
if(r==0)
a++;
if(r==1)
b++;
if(r==2)
c++;
if(r==3)
d++;
cout<<"比賽進行中"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("cls");
}
if(a>b && a>c && a>d)
winner=1;
else if(b>a && b>c && b>d)
winner=2;
else if(c>a && c>b && c>d)
winner=3;
else
winner=4;
cout<<"比賽結束! 由 "<<winner<<" 號選手先馳得點!"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
end:
system("pause");
return 0;
}
複製代碼
作者:
鎧言
時間:
2013-11-9 15:05
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int balance=0, n=1, money=0;
int option, buyin, bet, winner;
re1:
int a=0, b=0, c=0, d=0, r;
system("cls");
cout<<"「輸甲脫褲」賽馬場 第"<<n<<"局"<<endl;
cout<<"---------------------------------------------------------|終點"<<endl;
cout<<"◥1◣"<<endl;
cout<<"◥2◣"<<endl;
cout<<"◥3◣"<<endl;
cout<<"◥4◣"<<endl;
re2:
cout<<endl<<"可用餘額:"<<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)◥1◣(2)◥2◣(3)◥3◣(4)◥4◣請選擇: ";
cin>>option;
cout<<"比賽即將開始!"<<endl<<endl;
system("pause");
}
}else if(option==3)
{
cout<<"輸入錯誤!"<<endl<<endl;
system("pause");
goto re1;
}
srand(time(NULL));
while((a!=60)&&(b!=60)&&(c!=60)&&(d!=60))
{
r=rand()%4;
if(r==0)
a++;
else if(r==1)
b++;
else if(r==2)
c++;
else
d++;
cout<<"比賽進行中...";
cout<<endl<<"---------------------------------------------------------|終點"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("cls");
}
if(a>b&&a>c&&a>d)
winner=1;
else if(b>a&&b>c&&b>d)
winner=2;
else if(c>a&&c>b&&c>d)
winner=3;
else
winner=4;
cout<<"比賽結束!"<<endl;
cout<<"由"<<winner<<"號選手拿到勝利----------------------------------------|終點"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
劉泳鱔
時間:
2013-11-9 15:14
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int balance=0;
int bet,buyin,option,winner;
re1:
int a=0,b=0,c=0,d=0,r;
system("cls");
cout<<"$ 財源滾滾賽馬場 $"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
cout<<"◥1◣"<<endl;
cout<<"◥2◣"<<endl;
cout<<"◥3◣"<<endl;
cout<<"◥4◣"<<endl;
cout<<endl<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
balance+=buyin;
goto re1;
}else if(option==2)
{
cout<<"下注: ";
cin>>bet;
if(bet>balance)
{
cout<<"可用餘額不足!請先買入再來!"<<endl<<endl;
system("pause");
goto re1;
}else
{
cout<<endl<<"(1)◥1◣(2)◥2◣(3)◥3◣(4)◥4◣請選擇: ";
cin>>option;
cout<<"比賽即將開始!"<<endl<<endl;
}
}else if(option==3)
{
goto end;
}else
{
cout<<"輸入錯誤"<<endl<<endl;
system("pause");
goto re1;
}
system("pause");
system("cls");
srand(time(NULL));
while((a!=70)&&(b!=70)&&(c!=70)&&(d!=70))
{
r=rand()%4;
if(r==0)
a++;
if(r==1)
b++;
if(r==2)
c++;
if(r==3)
d++;
cout<<"比賽進行中"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("cls");
}
if(a>b && a>c && a>d)
winner=1;
else if(b>a && b>c && b>d)
winner=2;
else if(c>a && c>b && c>d)
winner=3;
else
winner=4;
cout<<"比賽結束! 由 "<<winner<<" 號選手先馳得點!"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
end:
system("pause");
return 0;
}
複製代碼
作者:
郭凡瑛
時間:
2013-11-9 15:18
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int balance=0;
int bet,buyin,option,winner;
re1:
int a=0,b=0,c=0,d=0,r;
system("cls");
cout<<"$ 財源滾滾賽馬場 $"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
cout<<"◥1◣"<<endl;
cout<<"◥2◣"<<endl;
cout<<"◥3◣"<<endl;
cout<<"◥4◣"<<endl;
cout<<endl<<"可用餘額: "<<balance<<"元"<<endl<<endl;
cout<<"(1)買入 (2)下注 (3)離開 請選擇: ";
cin>>option;
if(option==1)
{
cout<<"買入: ";
cin>>buyin;
balance+=buyin; //i+=2 i=i+2
goto re1;
}else if(option==2)
{
cout<<"下注: ";
cin>>bet;
if(bet>balance)
{
cout<<"可用餘額不足!請先買入!"<<endl<<endl;
system("pause");
goto re1;
}else
{
cout<<endl<<"(1)◥1◣ (2)◥2◣ (3)◥3◣ (4)◥4◣ 請選擇: ";
cin>>option;
cout<<"比賽即將開始!"<<endl<<endl;
}
}else if(option==3)
{
goto end;
}else
{
cout<<"輸入錯誤!"<<endl<<endl;
system("pause");
goto re1;
}
system("pause");
system("cls");
srand(time(NULL));
while((a!=70)&&(b!=70)&&(c!=70)&&(d!=70))
{
r=rand()%4; //產生0~3之隨機亂數
if(r==0)
a++;
if(r==1)
b++;
if(r==2)
c++;
if(r==3)
d++;
cout<<"比賽進行中"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
system("cls");
}
if(a>b && a>c && a>d)
winner=1;
else if(b>a && b>c && b>d)
winner=2;
else if(c>a && c>b && c>d)
winner=3;
else
winner=4;
cout<<"比賽結束! 由 "<<winner<<" 號選手先馳得點!"<<endl;
cout<<"---------------------------------------------------------------------|終點|"<<endl;
for(int i=1;i<=a;i++)
cout<<" ";
cout<<"◥1◣"<<endl;
for(int i=1;i<=b;i++)
cout<<" ";
cout<<"◥2◣"<<endl;
for(int i=1;i<=c;i++)
cout<<" ";
cout<<"◥3◣"<<endl;
for(int i=1;i<=d;i++)
cout<<" ";
cout<<"◥4◣"<<endl;
end:
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2