0
已解决
李熙尧
新手光能
新手光能
上期:
来了,NBA球迷们
本游戏使用双循环赛制
有意见请评论
不废话了,上代码!
#include<cstdio>
#define hello(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#pragma GCC optimize(2)
#include<iomanip>
#include<stdio.h>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<map>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<windows.h>
using namespace std;
POINT p;
struct team{
string name;
int g=0;
int num=0;
int tl=0,jg=0,fs=0;
int sum(){
return tl*3+jg*2+fs*2;
}
}HUREN,a[10005];
void pr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
}void ppr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(70);
}
}
bool cmp(team t1,team t2){
if(t1.g!=t2.g) return t1.g>t2.g;
if(t1.num!=t2.num) return t1.num>t2.num;
if(t1.sum()!=t1.sum()) return t1.sum()>t2.sum();
if(t1.tl!=t2.tl) return t1.tl>t2.tl;
if(t1.jg!=t2.jg) return t1.jg>t2.jg;
if(t1.fs!=t2.fs) return t1.fs>t2.fs;
return t1.name<t2.name;
}
int gotoxy(int y, int x){
HANDLE handle;
COORD coord;
coord.X = x;
coord.Y = y;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, coord);
} void cls(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordScreen = { 0, 0 };
SetConsoleCursorPosition( hConsole, coordScreen );
}
void go1(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}int all;
int n;
int fs(int,int);
signed main(){
/*-------------------------基本内容设置开始-----------------------*/
go1();
srand(time(0));
system("title 小李工作室—五分钟小游戏系列之三---------NBA 1.0.0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
Sleep(1000);
pr("致敬当年我们追过的NBA球星");
Sleep(1000);
system("cls");
/*-------------------------基本内容设置结束-----------------------*/
/*---------------------------主题程序开始-----------------------*/
loop:
cout<<" 致敬当年我们追过的NBA球星 \n";
cout<<" ① 创建队伍 \n";
cout<<" ② 常规赛 \n";
cout<<" ③ 离开 \n";
int t;
cin>>t;
if(t==1){
printf(" team_name: ");
string hname;
cin>>hname;
a[++n].name=hname;
printf("\n OK");
int a1=10,b1=30;
a[n].jg=fs(a1,b1);
a[n].fs=fs(a1,b1);
a[n].tl=fs(a1,b1);
printf("\n组队中");
pr("……………………\n");
printf("完成!!\n");
pr("基本信息:\n");
Sleep(1000);
pr(" 队名:");
cout<<a[n].name;
pr("队 进攻力:");
cout<<a[n].jg;
pr(" 防守力:");
cout<<a[n].fs;
pr(" 篮板力:");
cout<<a[n].tl;
pr(" 总势力:");
cout<<a[n].sum();
Sleep(3000);
system("cls");
goto loop;
}
else if(t==2){
system("cls");
pr("第");
cout<<++all;
pr("赛季常规赛开始了!!\n\n");
int tmp=0;
for(int i=1;i<=n;i++) a[i].g=0;
pr("参战队伍:\n");
for(int i=1;i<=n;i++){
cout<<a[i].name<<"队 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i!=j){
tmp++;
cout<<"第"<<tmp<<"场:\n";
cout<<"主场"<<a[i].name<<"队VS"<<"客场"<<a[j].name<<"队"<<endl;
if(abs(a[i].sum()-a[j].sum())<=30){
pr("双方较量十分激烈,不分高下!\n");
}else{
pr("双方实力悬殊,一交手胜负已定!\n");
}
pr("得分:");
int ff1=(a[i].sum()+fs(40,70))/2+1,ff2=(a[j].sum()+fs(40,70)+4)/2+1;
cout<<a[i].name<<":"<<ff1<<" "<<a[j].name<<":"<<ff2<<endl;
if(ff1>ff2){
cout<<a[i].name<<"队胜!";
a[i].g+=2;
a[i].jg++;
a[i].fs++;
a[i].tl+=2;
a[j].tl--;
}else if(ff1==ff2){
cout<<"战平!";
a[i].g++;
a[j].g++;
a[i].fs++;
a[i].fs++;
}else{
cout<<a[j].name<<"队胜!";
a[j].g+=2;
a[j].jg++;
a[j].fs++;
a[j].tl+=2;
a[i].tl--;
}
cout<<endl;
system("pause");
system("cls");
}
}
}
sort(a+1,a+n+1,cmp);
pr("常规赛结束了\n");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
pr("决赛之钟敲响了!!\n");
team sub=a[1],ob=a[2];
Sleep(1000);
system("color 3f");
Sleep(1000);
system("color 6a");
Sleep(1000);
system("color 19");
Sleep(1000);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
pr("让我们为勇士们狂欢!\n");
Sleep(3000);
system("cls");
pr("决赛主场:");
cout<<sub.name<<"队"<<endl;
pr("决赛客场:");
cout<<ob.name<<"队"<<endl;
pr("加油!\n");
Sleep(4000);
system("pause");
system("cls");
pr("结果已出,让我们倒数5个数:\n");
team winner;
int ff1=(sub.sum()+fs(10,30))+10,ff2=(ob.sum()+fs(20,40));
if(ff1<ff2){
winner=ob;
}else if(ff1>ff2){
winner=sub;
}else{
if(sub.num>ob.num){
winner=sub;
}else{
winner=ob;
}
}
int tmp1=6;
while((tmp1--) >=1){
cout<<tmp1<<endl;
Sleep(1000);
}
ppr("第");
cout<<all;
ppr("赛季总冠军:");
cout<<winner.name<<"队!!!!!\n";
if(winner.name==a[1].name) {
a[1].num+=20;
a[2].fs++;
a[1].fs--;
}else {
a[2].num+=20;
a[2].fs--;
a[1].fs++;
}
system("pause");
system("cls");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}cout<<"历时"<<++tmp<<"场比赛,NBA第"<<all<<"赛季收官";
system("pause");
system("cls");
for(int i=1;i<=n;i++){
a[i].jg+=i;
}
goto loop;
}else if(t==3){
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
}
return false;
}
int fs(int min,int max){
return (rand()%(max-min+1))+min;
}
李熙尧在2022-07-27 12:22:00追加了内容
复制错了
#include<cstdio>
#define hello(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#pragma GCC optimize(2)
#include<iomanip>
#include<stdio.h>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<map>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<windows.h>
using namespace std;
POINT p;
struct team{
string name;
int g=0;
int num=0;
int tl=0,jg=0,fs=0;
int sum(){
return tl*3+jg*2+fs*2;
}
}HUREN,a[10005];
void pr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
}void ppr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(70);
}
}
bool cmp(team t1,team t2){
if(t1.g!=t2.g) return t1.g>t2.g;
if(t1.num!=t2.num) return t1.num>t2.num;
if(t1.sum()!=t1.sum()) return t1.sum()>t2.sum();
if(t1.tl!=t2.tl) return t1.tl>t2.tl;
if(t1.jg!=t2.jg) return t1.jg>t2.jg;
if(t1.fs!=t2.fs) return t1.fs>t2.fs;
return t1.name<t2.name;
}
int gotoxy(int y, int x){
HANDLE handle;
COORD coord;
coord.X = x;
coord.Y = y;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, coord);
} void cls(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordScreen = { 0, 0 };
SetConsoleCursorPosition( hConsole, coordScreen );
}
void go1(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}int all;
int n;
int fs(int,int);
signed main(){
/*-------------------------基本内容设置开始-----------------------*/
go1();
srand(time(0));
system("title 小李工作室—五分钟小游戏系列之三---------NBA 1.0.0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
Sleep(1000);
pr("致敬当年我们追过的NBA球星");
Sleep(1000);
system("cls");
/*-------------------------基本内容设置结束-----------------------*/
/*---------------------------主题程序开始-----------------------*/
loop:
cout<<" 致敬当年我们追过的NBA球星 \n";
cout<<" ① 创建队伍 \n";
cout<<" ② 常规赛 \n";
cout<<" ③ 离开 \n";
int t;
cin>>t;
if(t==1){
printf(" team_name: ");
string hname;
cin>>hname;
a[++n].name=hname;
printf("\n OK");
int a1=10,b1=30;
a[n].jg=fs(a1,b1);
a[n].fs=fs(a1,b1);
a[n].tl=fs(a1,b1);
printf("\n组队中");
pr("……………………\n");
printf("完成!!\n");
pr("基本信息:\n");
Sleep(1000);
pr(" 队名:");
cout<<a[n].name;
pr("队 进攻力:");
cout<<a[n].jg;
pr(" 防守力:");
cout<<a[n].fs;
pr(" 篮板力:");
cout<<a[n].tl;
pr(" 总势力:");
cout<<a[n].sum();
Sleep(3000);
system("cls");
goto loop;
}
else if(t==2){
system("cls");
pr("第");
cout<<++all;
pr("赛季常规赛开始了!!\n\n");
int tmp=0;
for(int i=1;i<=n;i++) a[i].g=0;
pr("参战队伍:\n");
for(int i=1;i<=n;i++){
cout<<a[i].name<<"队 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i!=j){
tmp++;
cout<<"第"<<tmp<<"场:\n";
cout<<"主场"<<a[i].name<<"队VS"<<"客场"<<a[j].name<<"队"<<endl;
if(abs(a[i].sum()-a[j].sum())<=30){
pr("双方较量十分激烈,不分高下!\n");
}else{
pr("双方实力悬殊,一交手胜负已定!\n");
}
pr("得分:");
int ff1=(a[i].sum()+fs(40,70))/2+1,ff2=(a[j].sum()+fs(40,70)+4)/2+1;
cout<<a[i].name<<":"<<ff1<<" "<<a[j].name<<":"<<ff2<<endl;
if(ff1>ff2){
cout<<a[i].name<<"队胜!";
a[i].g+=2;
a[i].jg++;
a[i].fs++;
a[i].tl+=2;
a[j].tl--;
}else if(ff1==ff2){
cout<<"战平!";
a[i].g++;
a[j].g++;
a[i].fs++;
a[i].fs++;
}else{
cout<<a[j].name<<"队胜!";
a[j].g+=2;
a[j].jg++;
a[j].fs++;
a[j].tl+=2;
a[i].tl--;
}
cout<<endl;
system("pause");
system("cls");
}
}
}
sort(a+1,a+n+1,cmp);
pr("常规赛结束了\n");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
pr("决赛之钟敲响了!!\n");
team sub=a[1],ob=a[2];
Sleep(1000);
system("color 3f");
Sleep(1000);
system("color 6a");
Sleep(1000);
system("color 19");
Sleep(1000);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
pr("让我们为勇士们狂欢!\n");
Sleep(3000);
system("cls");
pr("决赛主场:");
cout<<sub.name<<"队"<<endl;
pr("决赛客场:");
cout<<ob.name<<"队"<<endl;
pr("加油!\n");
Sleep(4000);
system("pause");
system("cls");
pr("结果已出,让我们倒数5个数:\n");
team winner;
int ff1=(sub.sum()+fs(10,30))+10,ff2=(ob.sum()+fs(20,40));
if(ff1<ff2){
winner=ob;
}else if(ff1>ff2){
winner=sub;
}else{
if(sub.num>ob.num){
winner=sub;
}else{
winner=ob;
}
}
int tmp1=6;
while((tmp1--) >=1){
cout<<tmp1<<endl;
Sleep(1000);
}
ppr("第");
cout<<all;
ppr("赛季总冠军:");
cout<<winner.name<<"队!!!!!\n";
if(winner.name==a[1].name) {
a[1].num+=20;
a[2].fs++;
a[1].fs--;
}else {
a[2].num+=20;
a[2].fs--;
a[1].fs++;
}
system("pause");
system("cls");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}cout<<"历时"<<++tmp<<"场比赛,NBA第"<<all<<"赛季收官";
system("pause");
system("cls");
for(int i=1;i<=n;i++){
a[i].jg+=i;
}
goto loop;
}else if(t==3){
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
}
return false;
}
int fs(int min,int max){
return (rand()%(max-min+1))+min;
}