include
include <windows.h>
using namespace std;
int s[4] = { 111,135,141,161 };
void setColor(int color) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
}
void March(int t,int v )//输出函数;
{
if (v == s[0])
{
setColor(5);
cout << "Acheron" << " " << t << endl;
cout << " " << endl;
}
if (v == s[1])
{
setColor(6);
cout << "Aventurine" << " " << t << endl;
cout << " " << endl;
}
if (v == s[2])
{
setColor(4);
cout << "Jiaoqiu" << " " << t << endl;
cout << " " << endl;
}
if (v == s[3])
{
setColor(1);
cout << "Pela" << " " << t << endl;
cout << " "<<endl;
}
setColor(7);
}
int main()
{
int i,k,index,temp,j,count=0;
int rate;
int temp_2;
int S = 10000;
int t[4][3], rt[12][2];
char input;
for (i = 0; i < 4; i++)
{
for (j = 0; j < 3;j++)
{
t[i][j] = S*(j+1) / s[i];
rt[count][0] = t[i][j];
rt[count][1] = s[i];
count++;
}
}
while (1)
{
input = getchar();
if (input == '\n')
{
system("cls");
for (k = 0; k < 11; k++)//排序
{
index = k;
for (i = k + 1; i < 12; i++)
{
if (rt[i][0] < rt[index][0])
{
index = i;
}
}
temp = rt[index][0];
temp_2 = rt[index][1];
rt[index][0] = rt[k][0];
rt[index][1] = rt[k][1];
rt[k][0] = temp;
rt[k][1] = temp_2;
}
rate = rt[0][0];
for (i = 0; i < 12; i++)//让第一项为0
{
rt[i][0] = rt[i][0] - rate;
}
for (i = 0; i < 12; i++)//输出
{
March(rt[i][0], rt[i][1]);
}
for (i = 11; i >=0; i--)//去除第一个行动值,计算下一次行动值
{
if (rt[i][1] == rt[0][1])
{
rt[0][0] = rt[i][0] + S / rt[0][1];
break;
}
}
}
}
return 0;
}
标签:rt,index,回合制,游戏,temp,int,count,++,BUG From: https://www.cnblogs.com/formygloryandpeacefulday/p/18536983