问题标题: Sl 足球

0
0
已解决
吴章鹏
吴章鹏
中级光能
中级光能
#include<bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
#include<windows.h>
#include <time.h>
#include <conio.h>
#include <fstream> 
#define start 0
#define end 9//选择队伍 
#define a1 80
#define b1 100
#define a2 1
#define b2 3//随机数 
using namespace std;
void tittle(){
	SetConsoleTitle("SL FOOTBALL 1.1 version");
}
void color(int corcorcor){
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),corcorcor);
}
	int suijishu; 
	int juli =50;
	int dsjilu=50;
	int shemenjilu;
	bool xianhou=1;//发球先后顺序 
    long long jinyan=0;
    long long shenjia=0;
    int fs=50;
    int jq=40;
    int cnt=0;//用来计算比赛的传球次数。 
    int js;
	string myduiwu;
	string name;
	string n;
	int zhuangtai; 
	int df1=0;
	int df2=0;
	const string duiwu[10] = {"巴黎圣日耳曼 ","皇家马德里 ","莱比锡红牛 ","** ","德国 ","阿根廷 ","巴西 ","葡萄牙 ","英格兰 ","克罗地亚 "};//不可修改! 
	int _1,_2,_3,_4,_5,_6;
	char a,b,c,d,e,f,g;
	string s;

	void suijishu1()
{
	int r;
    int i=RAND_MAX;
    int rad = 0;  
//	printf("%x\n",RAND_MAX);
//	printf("%d\n", (int)time(0));

    srand((int)time(NULL)); 


    	rad = rand()%(end-start)+start; 
 		r=( "%6d  ", rad);
		if(r==0){
			n=duiwu[0];
		} 
		if(r==1){
			n=duiwu[1];
		} 
		if(r==2){
			n=duiwu[2];
		} 
		if(r==3){
			n=duiwu[3];
		} 
		if(r==4){
			n=duiwu[4];
		} if(r==5){
			n=duiwu[5];
		} 
		if(r==6){
			n=duiwu[6];
		} 
		if(r==7){
			n=duiwu[7];
		} 
		if(r==8){
			n=duiwu[8];
		} 
		if(r==9){
			n=duiwu[9];
		} 
//    printf( "[a,b]: ");
}
void suijishu2()
{
	int r;
    int i=RAND_MAX;
    int rad = 0;  
//	printf("%x\n",RAND_MAX);
//	printf("%d\n", (int)time(0));

    srand((int)time(NULL)); 


    	rad = rand()%(b1-a1)+a1; 
 		r=( "%6d  ", rad);
		zhuangtai=r;
//    printf( "[a,b]: ");
}
void suijishu3()
{
	int r;
    int i=RAND_MAX;
    int rad = 0;  
//	printf("%x\n",RAND_MAX);
//	printf("%d\n", (int)time(0));

    srand((int)time(NULL)); 


    	rad = rand()%(b2-a2)+a2; 
 		js=( "%6d  ", rad);
//    printf( "[a,b]: ");
}
	void kaitou(){
		system("color f0");
		cout<<"                                            请保持网络畅通";
		cout<<endl;
		cout<<"                                            游戏即将开始";
		Sleep(3000);
		system("cls");
		cout<<"                                           --SL FOOTBALL--";
		cout<<endl;
		cout<<endl; 
		cout<<"                                             -SL sports-"; 
		cout<<endl;
		cout<<endl;
		cout<<"                                           [按任意键以开始]" ;
		getch(); 
	}
	int yonghucundang(){
		ttt:
		system("cls");
		cout<<"                                         是否是第一次登录?\n";
		cout<<"                                      a.是                b.不是\n";
		a=getch();
		
		if(a=='a'){
			system("cls");
			cout<<"输入用户姓名:"; 
			ofstream out("SL football 存档.txt", ios::out |ios::trunc);
			cin>>name;
			out<<name<< " ";		
			out.close();
			system("cls");
				sss:
				cout<<"选择队伍(0-9):\n";
				cout<<duiwu[0]<<duiwu[1]<<duiwu[2]<<duiwu[3]<<duiwu[4]<<duiwu[5]<<duiwu[6]<<duiwu[7]<<duiwu[8]<<duiwu[9];
				cin>>_1;
				if(_1==1){
					myduiwu=duiwu[1];
				}
				if(_1==2){
					myduiwu=duiwu[2];
				}
				if(_1==3){
					myduiwu=duiwu[3];
				}
				if(_1==4){
					myduiwu=duiwu[5];
				}
				if(_1==5){
					myduiwu=duiwu[5];
				}
				if(_1==6){
					myduiwu=duiwu[6];
				}
				if(_1==7){
					myduiwu=duiwu[7];
				}
				if(_1==8){
					myduiwu=duiwu[8];
				}
				if(_1==0){
					myduiwu=duiwu[0];
				}
				if(_1==9){
					myduiwu=duiwu[9];
				}
				if(_1>=11){
					goto sss;
				}
				ofstream ut("SL football 队伍存档.txt", ios::out |ios::trunc);
				ut <<myduiwu<<" ";		
				ut.close();	
				return 0;	
		}
		if(a=='b'){
			system("cls");
			string mima;
			//ifstream out("SL football 存档.txt", ios::in);
			ifstream OutFile("SL football 存档.txt");
			OutFile>>name;  
//		OutFile.close();
			cout<<"姓名:"<<name;
			OutFile.close();
			cout<<endl;
			cout<<endl;                                                               
			//ifstream sut("SL football 存档.txt", ios::in);
//			string sdc;
//			ifstream OutFile("SL football 队伍存档.txt");
//			OutFile>>sdc;  
//			cout<<"队伍:"<<sdc;
//			OutFile.close();
//			cout<<endl;
//			cout<<endl;
//			cout<<endl;
			cout<<"[按任意键继续]"; 
			getch();
			
		}else{
			goto ttt;
		}
		
}
void abc(){
		system("cls");
		
			ifstream OutFile("SL football 队伍存档.txt");
			OutFile>>s;  
			cout<<"队伍:"<<s;
			cout<<endl;
			cout<<endl;
			cout<<"[按任意键继续]"; 
			getch();
}
void abz(){
	system("cls"); 
	ifstream OutFile("经验.txt");
	OutFile>>jinyan;
	cout<<"经验:"<<jinyan; 
	cout<<endl;
	cout<<endl;
	cout<<"[按任意键继续]"; 
	getch();
}
void aby(){
	system("cls"); 
	ifstream OutFile("身价.txt");
	OutFile>>shenjia;
	cout<<"身价:"<<shenjia;
	cout<<endl;
	cout<<endl;
	cout<<"[按任意键继续]"; 
	getch();
}
int jy(){//把经验进行存档 
		ofstream out("经验.txt", ios::out |ios::trunc);
			out<<jinyan;
}
int sj(){
	ofstream out("身价.txt", ios::out |ios::trunc);
			out<<shenjia;
}
int chuanqiu(){
	suijishu3();
	if(xianhou==0){
		cout<<"球在对手脚下!!!";
	}else if(js==1){
		cout<<"传球成功!!!"; 
		juli+=10;
	}else{
		cout<<"传球失败,被对手给截胡了!!!";
		dsjilu+=10;
		xianhou=0;		
	}
	cout<<endl;
	system("pause");
}
int shemen(){
		if(xianhou==0){
		cout<<"球在对手脚下!!!";
	}else{
		goto eee;
	}
	eee:
		if(juli<80&&xianhou==1){
		cout<<"射门距离不够!";
		}else{
		suijishu3();
		if(shemenjilu%2==0&&xianhou==1){
			cout<<"成功射门!!!";
			cout<<endl;
			cout<<s<<"获得一分!!!";
			df1++;
			juli=50;
		}else{
			cout<<"射门失败!!!";
		}
		}
	cout<<endl;
	system("pause");
	system("cls"); 
}
int fangshou(){
	system("cls");
	if(dsjilu<70){
		cout<<"                                                   对手没来球门,防守无效!";
		goto dd;
	}
	uuu:
		system("cls");
		suijishu3();
		cout<<"                                                          防守:"<<endl;
		cout<<"                                                      a|向左扑    b|向右扑"<<endl;
		c=getch();
		system("cls");
		if(a=='a'){
			if(js%2==0){
				cout<<"                                                  扑救成功!!!";
			}else{
				cout<<"                                                  "<<n<<"获得一分!!!";
				df2++;
				cout<<"                                                  扑救失败!!!";
			}
		}
		if(a=='b'){
			if(js%2==0){
				cout<<"                                                  扑救成功!!!";
			}else{
				cout<<"                                                  扑救失败!!!";
				cout<<endl;
				cout<<"                                                  "<<n<<"获得一分!!!";
				df2++;
			}
		}
		if(a!='a'&&a!='b'){
			goto uuu;
		}
		dsjilu=50;
		cout<<endl;
		system("pause");
	dd:
		cout<<endl;
		system("pause");
}
int qiangqiu(){
	system("cls");
	if(xianhou==1){
		cout<<"球在你方脚里面!"; 
	}
	lll:
		suijishu3();
		if(xianhou==0){
			if(js%2==0){
				cout<<"                                         抢球成功!!!";
				xianhou=1;
			}else{
				cout<<"                                         抢球失败!!!"; 
			}
		}
	cout<<endl;
	system("pause");
}
int bisai(){
	while(cnt<20)
	{ 
	if(dsjilu>=70){
		system("cls");
		cout<<"                                                   对手快要接近你方球门了,注意防守!!!";
		Sleep(2000);
	}
	system("cls"); 
	cout<<"                                                      "<<s<<"vs"<<n<<endl;//注意,s是我方,n是敌方!
	cout<<"                                                      "<<df1<<" : "<<df2<<endl;//同理
	if(xianhou==1){
		cout<<"                                                 ";
		color(400);
		cout<<"球在你脚下";
		color(240); 
	}else{
		cout<<"                                                 ";
		color(400);
		cout<<"球在敌方脚下";
		color(240);
	} 
	cout<<endl;
	cout<<"                                                     ";
	color(400);
	cout<<"a.射门 b.传球 c.防守 d.抢球";
	color(240);
	cout<<endl;
	b=getch();
	cnt++;
	if(b=='a'){
		shemen();
	}
	if(b=='b'){
		chuanqiu();
	} 
	if(b=='c'){
		fangshou();
	}
	if(b=='d'){
		qiangqiu(); 
	}
}
	system("cls");
	cout<<"                                                          比赛结束!!!";
	cout<<endl;
	cout<<"                                                         "<<s<<"vs"<<n;
	cout<<endl;
	cout<<"                                                         "<<df1<<" : "<<df2;
	cout<<endl;
	cout<<endl;
	if(df1>df2){
		cout<<"                                                     "<<s<<"获胜!!!"; 
	}else if(df1<df2){
		cout<<"                                                     "<<n<<"获胜!!!";
	}else{
		cout<<"                                                     "<<"平局!!!";
	}
	cout<<endl;
	system("pause");
	system("cls");
	if(df1>df2||df1==df2){
		for(int i=1;i<=100;i++){
			cout<<"                                        身价:"<<i<<"万元";
			Sleep(5);
			system("cls"); 
		}
		system("cls");
		Sleep(900); 
		for(int i=1;i<=200;i++){
			cout<<"                                        经验:"<<i<<"经验值。";
			Sleep(5);
			system("cls"); 
		}
		system("cls");
		cout<<"                                                 [按任意键继续]";
		getch(); 
		system("cls");
		jinyan+=200;
		shenjia+=1000000;
		jy();
		sj();
		cout<<"正在存档!";
		Sleep(2000);
		cout<<"存档成功!";
		df1=0;
		df2=0;
	}
	
}
int bisai2(){
	system("color f1");
	while(cnt<20)
	{ 
	if(dsjilu>=70){
		system("cls");
		cout<<"                                                   对手快要接近你方球门了,注意防守!!!";
		Sleep(2000);
	}
	system("cls"); 
	system("color f1");
	cout<<"WORD CLUP";
	cout<<endl;
	cout<<endl; 
	cout<<"                                                      "<<s<<"vs"<<n<<endl;//注意,s是我方,n是敌方!
	cout<<"                                                      "<<df1<<" : "<<df2<<endl;//同理
	if(xianhou==1){
		cout<<"                                                 ";
		color(400);
		cout<<"球在你脚下";
		color(240); 
	}else{
		cout<<"                                                 ";
		color(400);
		cout<<"球在敌方脚下";
		color(240);
	} 
	cout<<endl;
	cout<<"                                                     ";
	color(400);
	cout<<"a.射门 b.传球 c.防守 d.抢球";
	color(240);
	cout<<endl;
	b=getch();
	cnt++;
	if(b=='a'){
		shemen();
	}
	if(b=='b'){
		chuanqiu();
	} 
	if(b=='c'){
		fangshou();
	}
	if(b=='d'){
		qiangqiu(); 
	}
}
	system("cls");
	cout<<"                                                          比赛结束!!!";
	cout<<endl;
	cout<<"                                                         "<<s<<"vs"<<n;
	cout<<endl;
	cout<<"                                                         "<<df1<<" : "<<df2;
	cout<<endl;
	cout<<endl;
	if(df1>df2){
		cout<<"                                                     "<<s<<"获胜!!!"; 
	}else if(df1<df2){
		cout<<"                                                     "<<n<<"获取世界杯!!!";
	}else{
		cout<<"                                                     "<<"平局!!!";
	}
	cout<<endl;
	system("pause");
	system("cls");
	if(df1>df2||df1==df2){
		for(int i=1;i<=600;i++){
			cout<<"                                        身价:"<<i<<"万元";
			Sleep(1);
			system("cls"); 
		}
		system("cls");
		Sleep(900); 
		for(int i=1;i<=1000;i++){
			cout<<"                                        经验:"<<i<<"经验值。";
			Sleep(1);
			system("cls"); 
		}
		system("cls");
		cout<<"                                                 [按任意键继续]";
		getch(); 
		system("cls");
		jinyan+=200;
		shenjia+=1000000;
		jy();
		sj();
		cout<<"正在存档!";
		Sleep(2000);
		cout<<"存档成功!";
		df1=0;
		df2=0;
	}
	
}
int race(){
	system("cls");
	cout<<"                                                        比赛阵型:";
	cout<<endl;
	cout<<"                                                   a.反击        b.防守";
	cout<<endl;
	a=getch();
	if(a=='a'){
		jq+=20;
	}
	if(a=='b'){
		fs+=20;
	}
system("cls");
system("cls");
cout<<"                                                              比赛开始";
cout<<endl;
cout<<"                                                               时间:";
system("time/T");			
Sleep(2000);
system("cls");
bisai(); 
}
int race2(){
	system("cls");
	system("color f1");
	cout<<"                                                         WORD CUP";
	cout<<endl;
	cout<<endl; 
	cout<<"                                                        比赛阵型:";
	cout<<endl;
	cout<<"                                                   a.反击        b.防守";
	cout<<endl;
	a=getch();
	if(a=='a'){
		jq+=20;
	}
	if(a=='b'){
		fs+=20;
	}
system("cls");
system("cls");
cout<<"                                                              比赛开始";
cout<<endl;
cout<<"                                                               时间:";
system("time/T");			
Sleep(2000);
system("cls");
bisai2();
} 
void zhiyeshenya(){
			system("cls");
			suijishu1();
			cout<<"SL FOOTBALL";
			cout<<endl;
			cout<<endl;
			cout<<"                                                     a|友谊赛";
			cout<<endl;
			cout<<"                                                  "<<s<<"vs"<<n; 
			cout<<endl;
			cout<<endl;
			suijishu2();
			cout<<"                                                    球员状态:"<<zhuangtai<<"分。";
			cout<<endl;
			cout<<"                                                     其他键|退出";
			a=getch();
			if(a=='a'){
				race(); 
			}
}
	int kuaisuyouxi(){
		system("cls");
		cout<<"                                               ";
		color(400);
		cout<<"选择队伍[0-9]:";
		color(240);
		cout<<endl;
		cout<<duiwu[0]<<duiwu[1]<<duiwu[2]<<duiwu[3]<<duiwu[4]<<duiwu[5]<<duiwu[6]<<duiwu[7]<<duiwu[8]<<duiwu[9];
		cin>>_1;
			if(_1==0){
			n=duiwu[0];
		} 
		if(_1==1){
			n=duiwu[1];
		} 
		if(_1==2){
			n=duiwu[2];
		} 
		if(_1==3){
			n=duiwu[3];
		} 
		if(_1==4){
			n=duiwu[4];
		} if(_1==5){
			n=duiwu[5];
		} 
		if(_1==6){
			n=duiwu[6];
		} 
		if(_1==7){
			n=duiwu[7];
		} 
		if(_1==8){
			n=duiwu[8];
		} 
		if(_1==9){
			n=duiwu[9];
		} 
		race();
	}
	int zhizuo(){
		cout<<"                                               ";
			color(400);
			cout<<"制作名单";
			color(240);
			cout<<endl;
			cout<<"                                               所有制作--吴章鹏";
			cout<<endl;
			cout<<"                                               [按任意键继续]";
			getch();
	}
	int tart(){
		system("start https://sway.office.com/6dEE862OmMX3xE5O?ref=Link&loc=mysways");
	}
	int wordcup(){
		system("cls");
		cout<<"                                                               ";
		color(400);
		cout<<"世界杯";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<"                                    想与哪国或俱乐部争锋对决,在世界杯上大放光彩!";
		cout<<endl; 
		cout<<duiwu[0]<<duiwu[1]<<duiwu[2]<<duiwu[3]<<duiwu[4]<<duiwu[5]<<duiwu[6]<<duiwu[7]<<duiwu[8]<<duiwu[9];
		cin>>_1;
			if(_1==0){
			n=duiwu[0];
		} 
		if(_1==1){
			n=duiwu[1];
		} 
		if(_1==2){
			n=duiwu[2];
		} 
		if(_1==3){
			n=duiwu[3];
		} 
		if(_1==4){
			n=duiwu[4];
		} if(_1==5){
			n=duiwu[5];
		} 
		if(_1==6){
			n=duiwu[6];
		} 
		if(_1==7){
			n=duiwu[7];
		} 
		if(_1==8){
			n=duiwu[8];
		} 
		if(_1==9){
			n=duiwu[9];
		} 
		race2();
	} 
	int geren(){
		system("cls");
		cout<<"名字:"<<name;
		cout<<endl;
		cout<<"球队:"<<s;
		cout<<endl;
		cout<<"经验值:"<<jinyan;
		cout<<endl;
		cout<<"身价:"<<shenjia; 
		cout<<endl;
		system("pause");
	}
	int main(){
	HWND hwnd=GetConsoleWindow();
	HMENU hmenu=GetSystemMenu(hwnd,0);
	RemoveMenu(hmenu, SC_CLOSE,MF_BYCOMMAND);
	LONG **=GetWindowLong(hwnd,GWL_STYLE);
	**&=~(WS_MINIMIZEBOX);
	SetWindowLong(hwnd,GWL_STYLE,**);
	SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
	ShowWindow(hwnd,SW_SHOWNORMAL);
	DestroyMenu(hmenu);
	ReleaseDC(hwnd, NULL);
		tittle();
		kaitou();
		yonghucundang();
		if(a=='b'){
			abc();
			abz();
			aby(); 
		} 
		if(a=='a'){
			cout<<"重启游戏!";
			return 0;
		}
	ddd:
		color(240);//界面学习沙宸安的,嘿嘿! 
		system("cls"); 
		cout<<"                                ▇▇▇▇▇      ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇    ▇    ▇      ▇         "<<endl;
		cout<<"                                ▇      ▇      ▇      ▇    ▇▇    ▇    ▇    ▇    ▇  ▇  ▇  ▇      ▇         "<<endl;
		cout<<"                                ▇▇▇▇▇      ▇▇▇  ▇    ▇▇    ▇    ▇    ▇▇▇   ▇▇▇▇ ▇      ▇         "<<endl;
		cout<<"                                      ▇▇      ▇      ▇    ▇▇    ▇    ▇    ▇    ▇ ▇    ▇ ▇      ▇         "<<endl;
		cout<<"                                ▇▇▇▇▇▇▇▇▇      ▇▇▇▇▇▇▇▇    ▇    ▇▇▇▇▇      ▇▇▇▇▇▇▇▇▇▇ "<<endl;
		cout<<"                                                                                                                      "<<endl;
		cout<<"                                                                                                                      "<<endl;
		cout<<"                                                                                                                      "<<endl;
		cout<<endl;
		cout<<"                                                             1.1 version";
		cout<<endl;
		cout<<endl;
		cout<<endl;
		cout<<"                                                       欢迎!"<<name;
		cout<<endl;
		cout<<endl;
		cout<<endl;
		color(240);
		cout<<"                                                       队伍: "<<s;
		cout<<endl;
		cout<<endl;
		cout<<endl;
		cout<<"                                                       "; 
		color(400); 
		cout<<"   A-职业生涯 Career     ";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<endl;
		color(240);
		cout<<"                                                       "; 
		color(400);
		cout<<"  B-快速游戏 Quick game  ";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<endl;
		cout<<"                                                       "; 
		color(400);   
		cout<<"  C-制作名单 Make list   ";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<endl;
		color(240);
		cout<<"                                                       "; 
		color(400); 
		cout<<"D-关于SL about SL science";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<endl;
		cout<<"                                                       "; 
		color(400);
		cout<<" E-世界杯 FIFA wordclup  ";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<endl;
		cout<<"                                                       "; 
		color(400);
		cout<<"F-** Personal Data ";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<endl;
		cout<<"                                                       "; 
		color(400);
		cout<<"        G-退出 exit      ";
		color(240);
		cout<<endl;
		cout<<endl;
		cout<<endl;
		a=getch();
		if(cnt>=1){
			bisai();
		}
		if(a=='a'||a=='a'){
			zhiyeshenya();
		}
		if(a=='b'||a=='B'){
			kuaisuyouxi();
		}
		if(a=='c'||a=='C'){
			system("cls");
			zhizuo();
		}
		if(a=='d'||a=='D'){
			tart();
		}
		if(a=='e'||a=='E'){
			wordcup();
		}
		if(a=='f'||a=='F'){
			geren();
		}
		if(a=='g'||a=='G'){
			system("cls");
			cout<<"再见,欢迎再次来玩!";
			exit(1);
		} 
		goto ddd;
	}

不知道是不是有些代码被脏话隐蔽掉了。

吴章鹏在2023-01-06 19:26:34追加了内容

吴章鹏在2023-01-06 20:19:29追加了内容


0
已采纳
李宜和
李宜和
高级启示者
高级启示者

你觉得我一眼就看到两个**的代码能运行吗...

0
0
0
0
沙宸安
沙宸安
高级启示者
高级启示者

你家是不是有能看到我电脑文件的设备qwq,怎么有一些东西在我即将发布的游戏里都有,比如说禁用“X”,还有结算界面,数字有上涨的动画,这些我们都有

0
薛乘志
薛乘志
初级启示者
初级启示者

这混乱的缩进,让我根本不想运行

 

再说也运行不了

0
王海成
王海成
初级天翼
初级天翼

运行不了你发个屁,**的地方,也不发出来

0
王海成
王海成
初级天翼
初级天翼

世界杯玩法时我还没玩呢,就自己结算了,还有每次比赛完结算时,为啥要从0开始?不能从上一次结算时的数值加吗

0
0
0
0
0
熊潇然
熊潇然
初级启示者
初级启示者

@沙宸安 关闭不了“X”我狼人杀 1.7.1版本也有,估计他是借鉴了我的

 

我要回答