我是靠谱客的博主 机灵高跟鞋,最近开发中收集的这篇文章主要介绍【C++】原神角色管理系统——基于vs的系统开发,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

首先成果展示给大家放上链接:

B站:【原神】原神系统演示_原神

以下是代码部分(有点长):

#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
#include<cstring>
#include<iomanip>
#include<windows.h>
#include<stdlib.h>
#include<time.h>
#include<filesystem>

using namespace std;

int IFRUN = 0;
#define SIZE 100//最大用户容量
int scount = 0;//用作储存当前已注册用户数

void COLOR_PRINT(const char* s, int color)
{
	HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color);
	printf(s);
	SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7);
}
void mihayo() {
	cout << "tt===============================================================" << endl;
	cout << "tttt─ ─ ─ ╔ ╦ ╗ ╔ ╗ ─ ╔ ═ ╦ ╗      " << endl;
	cout << "tttt╔ ═ ═ ╬ ╣ ╚ ╝ ╠ ═ ╬ ╗ ║ ╠ ═ ╗" << endl;
	cout << "tttt║ ║ ║ ║ ║ ╔ ╗ ║ ╬ ╠ ╩ ╗ ║ ╬ ║" << endl;
	cout << "tttt╚ ╩ ╩ ╩ ╩ ╝ ╚ ╩ ═ ╩ ═ ═ ╩ ═ ╝" << endl;
	cout << "tt===============================================================" << endl;
}


class Controller
{
public:
	Controller() {}
	void full_screen()
	{
		HWND hwnd = GetForegroundWindow();
		int cx = GetSystemMetrics(SM_CXSCREEN);            /* 屏幕宽度 像素 */
		int cy = GetSystemMetrics(SM_CYSCREEN);            /* 屏幕高度 像素 */

		LONG l_WinStyle = GetWindowLong(hwnd, GWL_STYLE);   /* 获取窗口信息 */
		/* 设置窗口信息 最大化 取消标题栏及边框 */
		SetWindowLong(hwnd, GWL_STYLE, (l_WinStyle | WS_POPUP | WS_MAXIMIZE));
		SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, 0);
	}
	void SetFont(int size = 30) {
		CONSOLE_FONT_INFOEX cfi;
		cfi.cbSize = sizeof cfi;
		cfi.nFont = 0;
		cfi.dwFontSize.X = 0;
		cfi.dwFontSize.Y = size;  //设置字体大小
		cfi.FontFamily = FF_DONTCARE;
		cfi.FontWeight = FW_NORMAL; //字体粗细 FW_BOLD
		wcscpy_s(cfi.FaceName, L"黑体");  //设置字体,必须是控制台已有的
		SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
		HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
		CONSOLE_FONT_INFO consoleCurrentFont;
		GetCurrentConsoleFont(handle, FALSE, &consoleCurrentFont);
	}


	COORD getXY()							//通过WindowsAPI函数获取光标的位置
	{
		CONSOLE_SCREEN_BUFFER_INFO pBuffer;
		GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &pBuffer);//利用标准输出句柄获得光标坐标信息
		return COORD{ pBuffer.dwCursorPosition.X, pBuffer.dwCursorPosition.Y };//封装为表示坐标的COORD结构
	}
	COORD getScrnInfo()										//获取控制台窗口缓冲区大小
	{
		HANDLE hStd = GetStdHandle(STD_OUTPUT_HANDLE);		//获得标准输出设备句柄
		CONSOLE_SCREEN_BUFFER_INFO scBufInf;				//定义一个窗口缓冲区信息结构体
		GetConsoleScreenBufferInfo(hStd, &scBufInf);		//获取窗口缓冲区信息
		return scBufInf.dwSize;								//返回窗口缓冲区大小
	}
	void moveXY(COORD pstn)
	{
		SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pstn);
		//通过标准输出句柄控制光标的位置
	}
	void clearDisplay(COORD firstPst, COORD lastPst)		//清除部分屏幕内容,从firstPst坐标到lastPst坐标之间的内容
	{
		int yDValue(lastPst.Y - firstPst.Y);					//记录首末位置纵坐标差值,控制迭代次数

		COORD size(getScrnInfo());								//记录目前控制台缓冲区大小

		moveXY(firstPst);							//移动光标到首位置
		for (int y(0); y <= yDValue; y++)			//一层循环控制清除行数
		{
			for (int x(firstPst.X); x <= size.X; x++)			//二层循环避免重复清除
			{
				std::cout << ' ';						//输出一个空格来覆盖原内容,达到清除效果
				int px;									//记录光标当前位置的横坐标
				if (x != size.X)
					px = x + 1;
				else
					px = 0;
				if (y == yDValue && px == lastPst.X)		//与光标末位置作对比,达到末位置即退出循环
					break;
			}
		}
		moveXY(firstPst);
	}
	void loading()									//等待界面,模拟动态进度条过程
	{
		COORD headPst(getXY());						//记录最初位置,便于结束后清除进度条内容
		HANDLE hStd(GetStdHandle(STD_OUTPUT_HANDLE));
		CONSOLE_CURSOR_INFO  cInfo;
		GetConsoleCursorInfo(hStd, &cInfo);			//获取光标信息的句柄
		cInfo.bVisible = false;						//修改光标可见性
		SetConsoleCursorInfo(hStd, &cInfo);			//设置光标不可见


		COORD firstPst;								//存储光标坐标,为清除做铺垫
		COORD lastPst;

		int n(0);									//模拟进度条数字
		int m(0);									//记录进度条方块总数
		srand((unsigned)time(NULL));                //取时间作为随机数种子,避免伪随机数

		mihayo();

		cout << "tttLoading";
		while (n < 100)								//达到较好的动态效果
		{
			m = n / 5;
			n += rand() % 14 + 1;
			if (n < 100)
			{
				for (int i(n / 5 - m); i > 0; i--)
					std::cout << "█";
				firstPst = getXY();						//获取输出前坐标
				//std::cout << n << "%";					//输出百分比进度条
				lastPst = getXY();						//获取输出之后的光标位置
			}
			else
			{
				n = 100;								//最大值为100,达到则退出操作
				std::cout << "█";
				//std::cout << n << "%";
				lastPst = getXY();
				break;
			}

			Sleep(80);
			clearDisplay(firstPst, lastPst);		//清除现有图形,重新绘制
		}

		cout << endl;
		//clearDisplay(headPst, lastPst);				//清除进度条图形
		cInfo.bVisible = true;						//光标可见性改为可见
		SetConsoleCursorInfo(hStd, &cInfo);

	}

};

void printspace()//输出空格
{
	cout << endl;
}

void printFireAttack()//火输
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt迪卢克" << "   火系" << "    输出" << "n"
		<< "tttt可莉" << "     火系" << "    输出" << "n"
		<< "tttt胡桃" << "     火系" << "    输出" << "n"
		<< "tttt安柏" << "     火系" << "    输出" << "n"
		<< "tttt香菱" << "     火系" << "    输出" << "n"
		<< "tttt烟绯" << "     火系" << "    输出" << endl;
}
void printFireDefend()//输出火系的辅助角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt班尼特" << "   火系" << "     辅助" << "n"
		<< "tttt辛焱" << "     火系" << "     辅助" << endl;
}
void printIceAttack()//输出冰系的输出角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt甘雨" << "     冰系" << "     输出" << "n"
		<< "tttt优菈" << "     冰系" << "     输出" << "n"
		<< "tttt凯亚" << "     冰系" << "     输出" << endl;
}
void printIceDefend()//输出冰系的辅助角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt七七" << "        冰系" << "     辅助" << "n"
		<< "tttt重云" << "        冰系" << "     辅助" << "n"
		<< "tttt迪奥娜" << "      冰系" << "     辅助" << "n"
		<< "tttt罗莎莉亚" << "    冰系" << "     辅助" << endl;
}
void printWaterAttack()//输出水系的输出角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt达达利亚" << "     水系" << "    输出" << endl;
}
void printWaterDefend()//输出水系的辅助角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt莫娜" << "      水系" << "     辅助" << "n"
		<< "tttt芭芭拉" << "    水系" << "     辅助" << "n"
		<< "tttt行秋" << "      水系" << "     辅助" << endl;
}
void printThunderAttack()//输出雷系的输出角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt刻晴" << "     雷系" << "    输出" << "n"
		<< "tttt雷泽" << "     雷系" << "    输出" << "n"
		<< "tttt北斗" << "     雷系" << "    输出" << endl;
}
void printThunderDefend()//输出雷系的辅助角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt丽莎" << "       雷系" << "     辅助" << "n"
		<< "tttt菲谢尔" << "     雷系" << "     辅助" << endl;
}
void printRockAttack()//岩输
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt凝光" << "     岩系" << "    输出" << endl;
}
void printRockDefend()//输出岩系的辅助角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt钟离" << "      岩系" << "     辅助" << "n"
		<< "tttt阿贝多" << "    岩系" << "     辅助" << "n"
		<< "tttt诺艾尔" << "    岩系" << "     辅助" << endl;
}
void printWindAttack()//风输
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt魈" << "     风系" << "    输出" << endl;
}
void printWindDefend()//输出风系的辅助角色
{
	cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "tttt======================" << endl;
	cout << "tttt琴" << "           风系" << "     辅助" << "n"
		<< "tttt温迪" << "         风系" << "     辅助" << "n"
		<< "tttt枫原万叶" << "     风系" << "     辅助" << "n"
		<< "tttt砂糖" << "         风系" << "     辅助" << endl;
}

class SystemControl
{
public:
	SystemControl()
	{
		HeroNum = 0;
	}
	void RunControl();

	int choHero(int work=0);//选择角色
	int search(int work=0);//角色图鉴
	void reaction();//元素反应
	void card();//抽卡
	void my();//我的
	void army();//编队
	void old();//历史方案
	void setTeam();//创建新方案
	void damage(string id,string he[4]);//伤害
	double level(string user,int lel)
	{
		double damage1=0;
		
		if (lel > 0 && lel <= 20)
		{
			damage1 = (lel * 1.815);
		}
		if (lel > 20 && lel <= 30)
		{
			damage1 = 36.3 + ((lel - 20) * 2.5);
		}
		if (lel > 30 && lel <= 40)
		{
			damage1 = 61.3 + ((lel - 30) * 3.16);
		}
		if (lel > 40 && lel <= 50)
		{
			damage1 = 92.9 + ((lel - 40) * 5.21);
		}
		if (lel > 50 && lel <= 60)
		{
			damage1 = 145 + ((lel - 50) * 7.6);
		}
		if (lel > 60 && lel <= 70)
		{
			damage1 = 221 + ((lel - 60) * 10.3);
		}
		return damage1;
	}
	void menu();//菜单   
	//Hero Num[100];//最多放100个角色信息
	int HeroNum;
};

void SystemControl::menu()
{
	system("cls");
	cout << endl;
	mihayo();
	printspace();
	cout << "tttt  ==========================" << endl;
	cout << "tttt  ||请选择你要进行的操作:||" << endl;
	cout << "tttt  ||      1.模拟抽卡      ||" << endl;
	cout << "tttt  ||      2.角色图鉴      ||" << endl;
	cout << "tttt  ||      3.元素反应      ||" << endl;
	cout << "tttt  ||        4.我的        ||" << endl;
	cout << "tttt  ==========================" << endl;
	cout << "tttt 请选择你要进行的操作(1,2,3,4):";
	IFRUN = 1;
}

//主控函数 
void SystemControl::RunControl()
{
	while (true)
	{
		menu();
		int i;
		cin >> i;
		switch (i)
		{
		case 1:system("cls"); mihayo(); card(); break;
		case 2:system("cls"); mihayo(); search(); break;
		case 3:system("cls"); mihayo(); reaction(); break;
		case 4:system("cls"); mihayo(); my(); break;
		default:cout << "ttt您的选择有误,请重新选择!"; system("pause"); break;
		}
	}
}

//抽卡
class wuqi
{
public:
	wuqi() {}
	wuqi(string a) {
		name = a;
	}
	string getname() {
		return name;
	}
private:
	string name;
};
class  juse {
public:
	juse() {}
	juse(string n, wuqi a) {
		name = n;
		zhuanwu = a.getname();
	}
	juse(string n) {
		name = n;
		zhuanwu = " ";
	}
	void shuchu() {
		cout <<"t"<< name << "  " << zhuanwu << endl;
	}
private:
	string name;
	string zhuanwu;
};
string* chouka(int a, int b, int c) {
	srand((unsigned)time(NULL));
	string* name;
	name = new string[c + 2];
	int n, x;
	for (int i = 0; i < c; i++) {
		if (a < 79) {
			n = rand() % 1000;
			if (n <= 4) {
				a = 0;
				x = rand() % 5;
				if (x == 0)
					name[i] = "胡桃";
				if (x == 1)
					name[i] = "甘雨";
				if (x == 2)
					name[i] = "魈";
				if (x == 3)
					name[i] = "刻晴";
				if (x == 4)
					name[i] = "钟离";
			}
			if (b < 9) {
				if (n > 4 && n <= 104) {
					a++; b = 0;
					x = rand() % 5;
					if (x == 0)
						name[i] = "凝光";
					if (x == 1)
						name[i] = "行秋";
					if (x == 2)
						name[i] = "重云";
					if (x == 3)
						name[i] = "香菱";
					if (x == 4)
						name[i] = "辛炎";
				}
				else if (n > 104) {
					a++; b++;
					name[i] = "信使";
				}
				continue;
			}
			if (b == 9) {
				a++; b = 0;
				x = rand() % 5;
				if (x == 0)
					name[i] = "凝光";
				if (x == 1)
					name[i] = "行秋";
				if (x == 2)
					name[i] = "重云";
				if (x == 3)
					name[i] = "香菱";
				if (x == 4)
					name[i] = "辛炎";
			}
			continue;
		}
		if (a == 79) {
			n = rand() % 5;
			if (n <= 4) {
				a = 0; b = 0;
				x = rand() % 5;
				if (x == 0)
					name[i] = "胡桃";
				if (x == 1)
					name[i] = "甘雨";
				if (x == 2)
					name[i] = "魈";
				if (x == 3)
					name[i] = "刻晴";
				if (x == 4)
					name[i] = "钟离";
			}
		}
	}
	name[c] = to_string(a);
	name[c + 1] = to_string(b);
	return name;
}
void SystemControl::card()
{
	CARD:
	cout << "tttt请输入抽卡次数:" ;
	string* chouka(int a, int b, int c);
	int a, b, wuxing;
	char cho;
	a = 0; b = 0;
	while (1) {
		wuxing = 0;
		int cishu;
		cin >> cishu;
		if (cishu == -1)
			exit(0);
		string* r;
		string* w;
		r = new string[cishu];
		w = new string[cishu];
		r = chouka(a, b, cishu);
		a = stoi(r[cishu]);
		b = stoi(r[cishu + 1]);
		for (int i = 0; i < cishu; i++) {
			if (r[i] == "胡桃") {
				w[i] = "护摩之杖";
				wuxing++;
			}
			if (r[i] == "甘雨") {
				w[i] = "阿莫斯之弓";
				wuxing++;
			}
			if (r[i] == "魈") {
				w[i] = "和璞鸢";
				wuxing++;
			}
			if (r[i] == "刻晴") {
				w[i] = "磐岩结绿";
				wuxing++;
			}
			if (r[i] == "钟离") {
				w[i] = "贯虹之槊";
				wuxing++;
			}
		}
		for (int i = 0; i < cishu; i++) {
			wuqi q(w[i]);
			juse j(r[i], q);
			cout << "tttt"<<i + 1 << " . "; 
			j.shuchu();
		}
		cout << endl;
		cout << "tttt本次抽卡的五星角色数量为:"<<wuxing << endl;
		cout << endl;
		if (wuxing == 0)
			cout << "tttt您还是回非洲吧!" << endl;
		if (wuxing >= 1 && wuxing <= 3)
			cout << "tttt恭喜!您已脱非入欧!" << endl;
		cout << endl;
		if (wuxing > 3)
			cout << "tttt您就是欧皇本皇!" << endl;
		delete[]r;
		delete[]w;
		break;
	}
	cout << "tttt继续抽卡(y/n):";
	getchar();
	cin >> cho;
	cout << endl;
	if (cho == 'y' || cho == 'Y')
		goto CARD;
}


//元素反应
void SystemControl::reaction()
{
	cout << "ttt  名称   " << "   元素    " << "    伤害值/生命值" << endl;
	cout << "ttt -------   -------       -----------" << endl;
	cout << "ttt "蒸发"  " << "   火+水       " << "  伤害倍率 2" << "n"
		<< "ttt "融化"  " << "   火+冰       " << "  伤害倍率 1.5" << "n"
		<< "ttt "冻结"  " << "   冰+水       " << "  伤害倍率 3" << "n"
		<< "ttt "感雷"  " << "   雷+水       " << "  伤害倍率 4.8" << "n"
		<< "ttt "超载"  " << "   火+雷       " << "  伤害倍率 4" << "n"
		<< "ttt "扩散"  " << "   风+任何元素  " << " 伤害倍率 1.2" << "n"
		<< "ttt "结晶"  " << "   岩+任何元素  " << " 生命倍率 1" << "n"
		<< "ttt "燃烧"  " << "   火+草       " << "  伤害倍率 3" << "n"
		<< "ttt "共鸣"  " << "   任意两种元素 " << " 伤害倍率 2" << endl;
	system("pause");
	
}


struct Hero { string name, element, position; };
Hero H[33] = {
	"甘雨","冰","输出","凯亚" ,"冰","输出","优菈","冰","输出","七七" ,"冰","辅助","重云","冰","辅助" ,"迪奥娜","冰","辅助","罗莎莉亚","冰","辅助","达达利亚" ,
	"水","输出","莫娜","水" ,"辅助" ,"芭芭拉","水" ,"辅助","行秋","水" ,
	"辅助","雷泽","雷","输出","刻晴","雷","输出","北斗","雷","输出","丽莎" ,"雷","辅助","菲谢尔","雷","辅助" ,
	"凝光","岩","输出" ,"阿贝多","岩" ,"辅助","钟离","岩","辅助","诺艾尔","岩" ,"辅助",
	"琴","风","辅助","温迪","风","辅助","枫原万叶","风","辅助","砂糖","风","辅助","魈","风","输出",
	"可莉","火","输出" ,"迪卢克" ,"火","输出" , "胡桃"  ,"火","输出","安柏" ,"火","输出","香菱","火","输出" ,"烟绯","火","输出","班尼特","火" ,"辅助" ,"辛焱" ,"火" ,"辅助" };
//角色图鉴

int SystemControl::search(int work)
{
	Hero h;
	int choice = 0;
	int i = 33;
	char cho;
	string item;
SEARCH:
	system("cls"); 
	mihayo();
    printspace();
	cout << "ttt   ============查询角色信息============="<<endl ;
	cout << "ttt   ||                                 ||" << endl;
	cout << "ttt   ||        <1>通过姓名查询          ||" << endl;
	cout << "ttt   ||        <2>通过系别查询          ||" << endl;
	cout << "ttt   ||        <3>返回上一级菜单        ||" << endl;
	cout << "ttt   ||                                 ||" << endl;
	cout << "ttt   =====================================" << endl;
	cout << endl << "ttt 请输入您的查询方式(1,2,3):" ;
	cin >> choice;

	system("cls"); mihayo();

	switch (choice)
	{
	case 1:
		cout << "ttt 输入姓名:";
		cin >> item;
		lop:
		if (item == "甘雨")
			i = 0;
		if (item == "凯亚")
			i = 1;
		if (item == "优菈")
			i = 2;
		if (item == "七七")
			i = 3;
		if (item == "重云")
			i = 4;
		if (item == "迪奥娜")
			i = 5;
		if (item == "罗莎莉亚")
			i = 6;
		if (item == "达达利亚")
			i = 7;
		if (item == "莫娜")
			i = 8;
		if (item == "芭芭拉")
			i = 9;
		if (item == "行秋")
			i = 10;
		if (item == "刻晴")
			i = 12;
		if (item == "雷泽")
			i = 11;
		if (item == "北斗")
			i = 13;
		if (item == "丽莎")
			i = 14;
		if (item == "菲谢尔")
			i = 15;
		if (item == "凝光")
			i = 16;
		if (item == "阿贝多")
			i = 17;
		if (item == "钟离")
			i = 18;
		if (item == "诺艾尔")
			i = 19;
		if (item == "琴")
			i = 20;
		if (item == "温迪")
			i = 21;
		if (item == "枫原万叶")
			i = 22;
		if (item == "砂糖")
			i = 23;
		if (item == "魈")
			i = 24;
		if (item == "迪卢克")
			i = 26;
		if (item == "可莉")
			i = 25;
		if (item == "胡桃")
			i = 27;
		if (item == "安柏")
			i = 28;
		if (item == "香菱")
			i = 29;
		if (item == "烟绯")
			i = 30;
		if (item == "班尼特")
			i = 31;
		if (item == "辛焱")
			i = 32;
		if (i == 33) {
			cout << "ttt未找到相应角色!请重新输入姓名:";
				cin >> item;
				goto lop;
		}
		cout << "tttt姓名" << "  t系别" << "  t定位" << endl;
		cout << "tttt======================" << endl;
		cout <<"tttt"<< H[i].name <<"t"<< H[i].element<<"t" << H[i].position << "n";

		break;
	case 2:
		cout << "ttt输入系别(火、雷、风、岩、冰、水):";
		cin >> item;
		cout << "ttt输入定位(1.辅助 2.输出):";
		cin >> i;
		switch (i)
		{
		case 1:
			if (item=="火")
			{
				printFireDefend();
			}
			if (item == "风")
			{
				printWindDefend();
			}
			if (item == "岩")
			{
				printRockDefend();
			}
			if (item == "雷")
			{
				printThunderDefend();
			}
			if (item == "水")
			{
				printWaterDefend();
			}
			if (item == "冰")
			{
				printIceDefend();

			}
			break;
		case 2:
			if (item == "火")
			{
				printFireAttack();
			}
			if (item == "风")
			{
				printWindAttack();
			}
			if (item == "岩")
			{
				printRockAttack();
			}
			if (item == "雷")
			{
				printThunderAttack();
			}
			if (item == "水")
			{
				printWaterAttack();
			}
			if (item == "冰")
			{
				printIceAttack();
			}
			break;
		}
		break;

	case 3:
		return -1;
	default:
		goto SEARCH;
		break;
	}

	if (i >= HeroNum)
	{
		cout << "ttt继续查找(y/n):"; 
		getchar();
		cin >> cho;
		if (cho == 'y' || cho == 'Y')
			goto SEARCH;
		else
			return -1;
	}


	if (work == 1)
	{
		cout << endl;
		return i;
	}
	cout << endl << endl;
	cout << "ttt是否继续查找(y/n):";
	cin >> cho;
	if (cho == 'y' || cho == 'Y')
		goto SEARCH;
	return 1;
}


int SystemControl::choHero(int work)
{
	return 0;
}



class User:public SystemControl
{
private:
	string id;//账号
	string password;//密码
public:	
	int damage1=0;//角色等级伤害
	Hero Heros[4]; //储存已选择英雄
	char he[4] = { 0 }; //储存系别
	User() {};
	void Registers();//注册
	void Login();//登录
	void save();//保存
	void read();//读取
	void setid(string s)
	{
		
		id = s;
	}
	string getid() {
		return id;
	}
	void setpassword()
	{
		string s;
		cout << "密码:";
		cin >> s;
		password = s;
	}
	string getpassword() {
		return password;
	}
}us;
User user[SIZE];

void User::save()
{
	ofstream ofile;
	ofile.open("user.txt", ios::out);

	for (int i = 0; i < scount; i++)
	{
		ofile << user[i].id << endl;
		ofile << user[i].password << endl;
	}
	ofile.close();
}

//读取
void User::read()
{
	ifstream ifile;
	ifile.open("user.txt", ios::in);

	scount = 0;

	if (!ifile.is_open())
	{
		//cout << "文件打开失败!" << endl;
		return;
	}

	for (int i = 0; !ifile.eof(); i++)
	{
		ifile >> user[i].id;
		ifile >> user[i].password;
		scount++;
	}
	scount--;
	ifile.close();
}

//注册
void User::Registers()
{
	us.read();//读取已储存用户数据
	string pw1;//密码1
	string pw2;//密码2
	for (int i = scount; i < SIZE; i++)
	{
	here:
		cout << "ttt请输入用户名:";
		cin >> id;
		//判断新输入的用户信息是否已存在(如果已存在则重新输入)
		for (int i = 0; i < scount; i++)
		{
			if (id == user[i].id)
			{
				cout << "ttt用户已存在!" << endl;
				goto here;
			}
		}
		user[i].id = id;

		int chose = -1;
		cout << endl;
		cout << "ttt┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓n";
		cout << "ttt┃       1.显示密码     2.隐藏密码      ┃tn";
		cout << "ttt┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛n";
		cout << "ttt请输入你的选择:";
		cin >> chose;
		if (chose > 2 || chose < -1)
		{
			cout << "ttt输入格式错误,请重新输入:";
			cin >> chose;
		}

		string pword;
		char ch, passwords0[20];
		int x = 0;
		string pword1;
		char ch1, passwords1[20];
		int x1 = 0;
		switch (chose)
		{
		case 1:
			cout << "ttt请输入密码:";
			cin >> pword;
			user[i].password = pword;
			cout << "ttt请再次输入密码:";
			cin >> pword1;
			if (pword1 != user[i].password)
			{
				cout << "ttt密码不一致!" << endl;
				goto here;
			}
			else
			{
				scount++;//已注册用户加1
				cout << "ttt注册成功!" << endl;
				us.save();//保存用户数据
				filesystem::path p{ id + ".txt" };
				ofstream output(p);
				output.open(p);
				output << id << endl;
				output.close();

				int n = 0;//选择次数
				int choice = 0;
				int i = 33;
				char cho;
				string item;
				string it;//选择的角色名
			SEARCH:
				system("cls");
				printspace();
				cout << "ttt请查询角色信息后选择您的初始四位角色:" << endl; 
				cout << endl;
				cout << "ttt============查询角色信息=============" << endl; 
				cout << "ttt||        <1>通过姓名查询          ||" << endl; 
				cout << "ttt||        <2>通过系别查询          ||" << endl; 
				cout << "ttt=====================================" << endl; 
				cout << endl << "ttt请输入您的查询方式(1,2):";
				cin >> choice;

				switch (choice)
				{
				case 1:
					cout << "ttt输入姓名:";
					cin >> item;
					lop:
					if (item == "甘雨")
						i = 0;
					if (item == "凯亚")
						i = 1;
					if (item == "优菈")
						i = 2;
					if (item == "七七")
						i = 3;
					if (item == "重云")
						i = 4;
					if (item == "迪奥娜")
						i = 5;
					if (item == "罗莎莉亚")
						i = 6;
					if (item == "达达利亚")
						i = 7;
					if (item == "莫娜")
						i = 8;
					if (item == "芭芭拉")
						i = 9;
					if (item == "行秋")
						i = 10;
					if (item == "刻晴")
						i = 12;
					if (item == "雷泽")
						i = 11;
					if (item == "北斗")
						i = 13;
					if (item == "丽莎")
						i = 14;
					if (item == "菲谢尔")
						i = 15;
					if (item == "凝光")
						i = 16;
					if (item == "阿贝多")
						i = 17;
					if (item == "钟离")
						i = 18;
					if (item == "诺艾尔")
						i = 19;
					if (item == "琴")
						i = 20;
					if (item == "温迪")
						i = 21;
					if (item == "枫原万叶")
						i = 22;
					if (item == "砂糖")
						i = 23;
					if (item == "魈")
						i = 24;
					if (item == "迪卢克")
						i = 26;
					if (item == "可莉")
						i = 25;
					if (item == "胡桃")
						i = 27;
					if (item == "安柏")
						i = 28;
					if (item == "香菱")
						i = 29;
					if (item == "烟绯")
						i = 30;
					if (item == "班尼特")
						i = 31;
					if (item == "辛焱")
						i = 32;
					if (i == 33) {
						cout << "ttt未找到相应角色!请重新输入姓名:";
						cin >> item;
						goto lop;
					}
					cout << "ttt姓名" << "  t系别" << "  t定位" << endl;
					cout << "ttt======================" << endl;
					cout <<"ttt"<< H[i].name << "t" << H[i].element << "t" << H[i].position << "n";
					break;
				case 2:
					cout << "ttt输入系别(火、雷、风、岩、冰、水):";
					cin >> item;
					cout << "ttt输入定位(1.辅助 2.输出):";
					cin >> i;
					switch (i)
					{
					case 1:
						if (item == "火")
						{
							printFireDefend();
						}
						if (item == "风")
						{
							printWindDefend();
						}
						if (item == "岩")
						{
							printRockDefend();
						}
						if (item == "雷")
						{
							printThunderDefend();
						}
						if (item == "水")
						{
							printWaterDefend();
						}
						if (item == "冰")
						{
							printIceDefend();

						}
						break;
					case 2:
						if (item == "火")
						{
							printFireAttack();
						}
						if (item == "风")
						{
							printWindAttack();
						}
						if (item == "岩")
						{
							printRockAttack();
						}
						if (item == "雷")
						{
							printThunderAttack();
						}
						if (item == "水")
						{
							printWaterAttack();
						}
						if (item == "冰")
						{
							printIceAttack();
						}
						break;
					}
					break;
				default:
					goto SEARCH;
					break;
				}


				ofstream ofile;
				ofile.open(id + ".txt", ios::out | ios::app);
				
				if (i >= HeroNum)
				{
					cout << "ttt请输入要选择的角色名字:" ;
					cin >> it;
					if (it == "甘雨")
						i = 0;
					if (it == "凯亚")
						i = 1;
					if (it == "优菈")
						i = 2;
					if (it == "七七")
						i = 3;
					if (it == "重云")
						i = 4;
					if (it == "迪奥娜")
						i = 5;
					if (it == "罗莎莉亚")
						i = 6;
					if (it == "达达利亚")
						i = 7;
					if (it == "莫娜")
						i = 8;
					if (it == "芭芭拉")
						i = 9;
					if (it == "行秋")
						i = 10;
					if (it == "刻晴")
						i = 12;
					if (it == "雷泽")
						i = 11;
					if (it == "北斗")
						i = 13;
					if (it == "丽莎")
						i = 14;
					if (it == "菲谢尔")
						i = 15;
					if (it == "凝光")
						i = 16;
					if (it == "阿贝多")
						i = 17;
					if (it == "钟离")
						i = 18;
					if (it == "诺艾尔")
						i = 19;
					if (it == "琴")
						i = 20;
					if (it == "温迪")
						i = 21;
					if (it == "枫原万叶")
						i = 22;
					if (it == "砂糖")
						i = 23;
					if (it == "魈")
						i = 24;
					if (it == "迪卢克")
						i = 26;
					if (it == "可莉")
						i = 25;
					if (it == "胡桃")
						i = 27;
					if (it == "安柏")
						i = 28;
					if (it == "香菱")
						i = 29;
					if (it == "烟绯")
						i = 30;
					if (it == "班尼特")
						i = 31;
					if (it == "辛焱")
						i = 32;

					
					ofile<<"ttt"<< H[i].name << "t" << H[i].element << "t" << H[i].position << "n";
					us.Heros[n].name = H[i].name;
					us.Heros[n].element = H[i].element;
					us.Heros[n].position = H[i].position;

					ofile.close(); n++;
					if (n >= 4) {

						ofile.open(id + ".txt", ios::out | ios::app);
						ofile << endl;
						ofile.close();

						cout << "ttt您已选满四个英雄,请按任意键进入主页";  system("pause");
				loop:
					SystemControl::RunControl();
					goto loop;
					}
					else {
						cout << "ttt还剩 " << 4 - n << " 个英雄可选择" << endl;
						system("pause");
							goto SEARCH;
					}
				}

			}
			break;

		case 2:
			cout << "ttt请输入密码:";
			while ((ch = _getch()) != 'r' && x <= 20)
			{
				if (ch == 'b')
				{
					if (x > 0)
					{
						x--;
						cout << "b b";//密码支持退格的实现
					}
					else
						putchar(7);
				}
				else
				{
					passwords0[x++] = ch;
					printf("*");
				}
			}
			passwords0[x] = '';
			cout << endl;
			user[i].password = passwords0;

			cout << "ttt请再次密码:";
			while ((ch1 = _getch()) != 'r' && x1 <= 20)
			{
				if (ch1 == 'b')
				{
					if (x1 > 0)
					{
						x1--;
						cout << "b b";//密码支持退格的实现
					}
					else
						putchar(7);
				}
				else
				{
					passwords1[x1++] = ch1;
					printf("*");
				}
			}
			passwords1[x1] = '';
			cout << endl;
			//比较两次输入的密码是否统一(如果不统一则重新输入)
			if (passwords1 != user[i].password)
			{
				cout << "ttt密码不一致!" << endl;
				goto here;
			}
			else
			{
				scount++;//已注册用户加1
				cout << "ttt注册成功!" << endl;
				us.save();//保存用户数据
				//id=to_string(user[i].)
				filesystem::path p{ id + ".txt" };
				ofstream output(p);
				output.open(p);
				output << id << endl;
				output.close();

				int n = 0;//选择次数
				int choice = 0;
				int i = 33;
				char cho;
				string item;
				string it;//选择的角色名
			SEARCHag:
				system("cls");
				mihayo();
				printspace();
				cout << "ttt请查询角色信息后选择您的初始四位角色:" << endl;
				cout << endl; 
				cout << "ttt============查询角色信息=============" << endl; 
				cout << "ttt||        <1>通过姓名查询          ||" << endl; 
				cout << "ttt||        <2>通过系别查询          ||" << endl; 
				cout << "ttt=====================================" << endl; 
				cout << endl << "ttt请输入您的查询方式(1,2):";
				cin >> choice;

				switch (choice)
				{
				case 1:
					cout << "ttt输入姓名:";
					cin >> item;
					lop1:
					if (item == "甘雨")
						i = 0;
					if (item == "凯亚")
						i = 1;
					if (item == "优菈")
						i = 2;
					if (item == "七七")
						i = 3;
					if (item == "重云")
						i = 4;
					if (item == "迪奥娜")
						i = 5;
					if (item == "罗莎莉亚")
						i = 6;
					if (item == "达达利亚")
						i = 7;
					if (item == "莫娜")
						i = 8;
					if (item == "芭芭拉")
						i = 9;
					if (item == "行秋")
						i = 10;
					if (item == "刻晴")
						i = 12;
					if (item == "雷泽")
						i = 11;
					if (item == "北斗")
						i = 13;
					if (item == "丽莎")
						i = 14;
					if (item == "菲谢尔")
						i = 15;
					if (item == "凝光")
						i = 16;
					if (item == "阿贝多")
						i = 17;
					if (item == "钟离")
						i = 18;
					if (item == "诺艾尔")
						i = 19;
					if (item == "琴")
						i = 20;
					if (item == "温迪")
						i = 21;
					if (item == "枫原万叶")
						i = 22;
					if (item == "砂糖")
						i = 23;
					if (item == "魈")
						i = 24;
					if (item == "迪卢克")
						i = 26;
					if (item == "可莉")
						i = 25;
					if (item == "胡桃")
						i = 27;
					if (item == "安柏")
						i = 28;
					if (item == "香菱")
						i = 29;
					if (item == "烟绯")
						i = 30;
					if (item == "班尼特")
						i = 31;
					if (item == "辛焱")
						i = 32;
					if (i == 33) {
						cout << "ttt未找到相应角色!请重新输入姓名:";
						cin >> item;
						goto lop1;
					}
					cout <<"ttt"<< H[i].name << "t" << H[i].element << "t" << H[i].position << "n";

					break;
				case 2:
					cout << "ttt输入系别(火、雷、风、岩、冰、水):";
					cin >> item;
					cout << "ttt输入定位(1.辅助 2.输出):";
					cin >> i;
					switch (i)
					{
					case 1:
						if (item == "火")
						{
							printFireDefend();
						}
						if (item == "风")
						{
							printWindDefend();
						}
						if (item == "岩")
						{
							printRockDefend();
						}
						if (item == "雷")
						{
							printThunderDefend();
						}
						if (item == "水")
						{
							printWaterDefend();
						}
						if (item == "冰")
						{
							printIceDefend();

						}
						break;
					case 2:
						if (item == "火")
						{
							printFireAttack();
						}
						if (item == "风")
						{
							printWindAttack();
						}
						if (item == "岩")
						{
							printRockAttack();
						}
						if (item == "雷")
						{
							printThunderAttack();
						}
						if (item == "水")
						{
							printWaterAttack();
						}
						if (item == "冰")
						{
							printIceAttack();
						}
						break;
					}
					break;
				default:
					goto SEARCHag;
					break;
				}


				ofstream ofile;
				ofile.open(id + ".txt", ios::out | ios::app);

				if (i >= HeroNum)
				{
					cout << "ttt请输入要选择的角色名字:" ;
					cin >> it;
					if (it == "甘雨")
						i = 0;
					if (it == "凯亚")
						i = 1;
					if (it == "优菈")
						i = 2;
					if (it == "七七")
						i = 3;
					if (it == "重云")
						i = 4;
					if (it == "迪奥娜")
						i = 5;
					if (it == "罗莎莉亚")
						i = 6;
					if (it == "达达利亚")
						i = 7;
					if (it == "莫娜")
						i = 8;
					if (it == "芭芭拉")
						i = 9;
					if (it == "行秋")
						i = 10;
					if (it == "刻晴")
						i = 12;
					if (it == "雷泽")
						i = 11;
					if (it == "北斗")
						i = 13;
					if (it == "丽莎")
						i = 14;
					if (it == "菲谢尔")
						i = 15;
					if (it == "凝光")
						i = 16;
					if (it == "阿贝多")
						i = 17;
					if (it == "钟离")
						i = 18;
					if (it == "诺艾尔")
						i = 19;
					if (it == "琴")
						i = 20;
					if (it == "温迪")
						i = 21;
					if (it == "枫原万叶")
						i = 22;
					if (it == "砂糖")
						i = 23;
					if (it == "魈")
						i = 24;
					if (it == "迪卢克")
						i = 26;
					if (it == "可莉")
						i = 25;
					if (it == "胡桃")
						i = 27;
					if (it == "安柏")
						i = 28;
					if (it == "香菱")
						i = 29;
					if (it == "烟绯")
						i = 30;
					if (it == "班尼特")
						i = 31;
					if (it == "辛焱")
						i = 32;


					ofile << H[i].name << "t" << H[i].element << "t" << H[i].position << "n";
					us.Heros[n].name = H[i].name;
					us.Heros[n].element = H[i].element;
					us.Heros[n].position = H[i].position;

					ofile.close(); n++;

					if (n >= 4) {

						ofile.open(id + ".txt", ios::out | ios::app);
						ofile << endl;
						ofile.close();

						cout << "ttt,请按任意键进入主页";  system("pause");
					loopag:
						SystemControl::RunControl();
						goto loopag;
					}
					else {
						cout << "ttt还剩 " << 4 - n << " 个英雄可选择" << endl;
						system("pause");
						goto SEARCHag;
					}
				}
			}
			break;
		}
		char choice;
		while (1)
		{
			cin >> choice;
			if (choice == 'y' || choice == 'Y' || choice == 'n' || choice == 'N')
				break;
			else
				cout << "ttt输入格式错误,请重新输入: ";
		}
		if (choice == 'n' || choice == 'N')
		{
			break;
		}
	}
	

}

//登录
void User::Login()
{
	us.read();//读取已储存用户数据
	string id1;//雷话
	string pw;//密码
	int time = 0;//统计比较次数
here:
	cout << "ttt请输入帐号:";
	cin >> id1;
	int chose = -1;
	cout << endl;
	cout << "ttt┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓n";
	cout << "ttt┃       1.显示密码     2.隐藏密码      ┃tn";
	cout << "ttt┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛n";
	cout << "ttt请输入你的选择:";
	cin >> chose;
	if (chose > 2 || chose < -1)
	{
		cout << "ttt输入格式错误,请重新输入:";
		cin >> chose;
	}

	string pword;
	char ch, passwords0[20];
	int x = 0;
	switch (chose)
	{
	case 1:
		cout << "ttt请输入密码:";
		cin >> pword;
		for (int i = 0; i < scount; i++)
		{
			if (id1 == user[i].id && pword == user[i].password)
			{
				time++;
				//cout << "ttt【系统提示】登录成功!" << endl;
			}
		}
		if (time == 0)
		{
			cout << "ttt帐号或密码错误!" << endl;
			goto here;
		}
		break;
	case 2:
		cout << "ttt请输入密码:";
		while ((ch = _getch()) != 'r' && x <= 20)
		{
			if (ch == 'b')
			{
				if (x > 0)
				{
					x--;
					cout << "b b";//密码支持退格的实现
				}
				else
					putchar(7);
			}
			else
			{
				passwords0[x++] = ch;
				printf("*");
			}
		}
		passwords0[x] = '';
		cout << endl;
		//依次比较已储存信息,比较是否匹配(如不匹配则提示错误)
		for (int i = 0; i < scount; i++)
		{
			if (id1 == user[i].id && passwords0 == user[i].password)
			{
				time++;
				cout << "ttt登录成功!" << endl;
			}
		}
		if (time == 0)
		{
			cout << "ttt帐号或密码错误!" << endl;
			goto here;
		}
		break;
	}
}





//我的
void SystemControl::my()
{
	void display();
	void Army();
	int choice = 0;
	int i = 0;
	char cho;
	string item;
MY:
	system("cls");
	mihayo();
	printspace();
	cout << "tttt===============请选择================"<<endl ;
	cout << "tttt||        <1>查看已有角色          ||" << endl;
	cout << "tttt||        <2>进行编队              ||" << endl;
	cout << "tttt||        <3>返回上一级            ||" << endl;
	cout << "tttt=====================================" << endl;
	cout << endl << "tttt请输入您的查询方式(1,2,3):";
	cin >> choice;
	system("cls"); mihayo();
	switch (choice)
	{
	case 1:
		display();
		break;
	case 2:
		army();
		break;
	case 3:
	loop:
		SystemControl::RunControl();
		goto loop;
	default:
		goto MY;
		break;
	}
}
void display()
{
	string id;
	cout << "ttt请输入您的账号名: " ;
	cin >> id;
	cout << endl;

	ifstream file(id + ".txt");
	/*if (input.fail())
	{
		cout << "啊哦!无法打开!" << endl;
		exit(0);
	}*/

	cout << "ttt已有角色如下:" << endl;
	cout << endl;
	cout << "ttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "ttt======================" << endl;
	string str;
	while (!file.eof())
	{
		getline(file, str);
		cout << str << endl;
	}
	system("pause");

}
void SystemControl::army()
{
	int choice = 0;
	int i = 0;
	char cho;
	string item;
ELE:
	system("cls");
	mihayo();
	printspace();
	cout << "ttt===============请选择================" << endl; 
	cout << "ttt||        <1>查看历史方案          ||" << endl; 
	cout << "ttt||        <2>创建新方案            ||" << endl; 
	cout << "ttt||        <3>返回上一级            ||" << endl; 
	cout << "ttt=====================================" << endl; 
	cout << endl << "ttt请输入您的查询方式(1,2,3):";
	cin >> choice;
	switch (choice)
	{
	case 1:
		old();
		break;
	case 2:
		setTeam();
		break;
	case 3:
	loop:
		SystemControl::my();
		goto loop;
	default:
		goto ELE;
		break;
	}
}
void SystemControl::setTeam() {

	//选择
	int n = 0;//选择次数
	int choice = 0;
	int i = 33;
	char cho;
	string item;
	string it;//选择的角色名
	string id;//账号名
	string he[4];

	cout << "ttt请输入您的账号名:" ;
	cin >> id;
SEARCH:
	system("cls");
	mihayo();
	printspace();
	cout << "ttt请查询角色信息后选择您的队伍:" << endl;
	cout << endl;
	cout << "ttt============查询角色信息=============" << endl;
	cout << "ttt||        <1>通过姓名查询          ||" << endl; 
	cout << "ttt||        <2>通过系别查询          ||" << endl; 
	cout << "ttt||        <3>返回上一级            ||" << endl; 
	cout << "ttt=====================================" << endl; 
	cout << endl << "ttt请输入您的查询方式(1,2,3):";
	cin >> choice;

	switch (choice)
	{
	case 1:
		cout << "ttt输入姓名:";
		cin >> item;
		lop:
		if (item == "甘雨")
			i = 0;
		if (item == "凯亚")
			i = 1;
		if (item == "优菈")
			i = 2;
		if (item == "七七")
			i = 3;
		if (item == "重云")
			i = 4;
		if (item == "迪奥娜")
			i = 5;
		if (item == "罗莎莉亚")
			i = 6;
		if (item == "达达利亚")
			i = 7;
		if (item == "莫娜")
			i = 8;
		if (item == "芭芭拉")
			i = 9;
		if (item == "行秋")
			i = 10;
		if (item == "刻晴")
			i = 12;
		if (item == "雷泽")
			i = 11;
		if (item == "北斗")
			i = 13;
		if (item == "丽莎")
			i = 14;
		if (item == "菲谢尔")
			i = 15;
		if (item == "凝光")
			i = 16;
		if (item == "阿贝多")
			i = 17;
		if (item == "钟离")
			i = 18;
		if (item == "诺艾尔")
			i = 19;
		if (item == "琴")
			i = 20;
		if (item == "温迪")
			i = 21;
		if (item == "枫原万叶")
			i = 22;
		if (item == "砂糖")
			i = 23;
		if (item == "魈")
			i = 24;
		if (item == "迪卢克")
			i = 26;
		if (item == "可莉")
			i = 25;
		if (item == "胡桃")
			i = 27;
		if (item == "安柏")
			i = 28;
		if (item == "香菱")
			i = 29;
		if (item == "烟绯")
			i = 30;
		if (item == "班尼特")
			i = 31;
		if (item == "辛焱")
			i = 32;
		if (i == 33)
		{
			cout << "ttt未找到相应角色!请重新输入:";
			cin >> item;
			goto lop;
		}

		cout << "ttt姓名" << "  t系别" << "  t定位" << endl;
		cout << "ttt======================" << endl;
		cout << "ttt"<<H[i].name << "t" << H[i].element << "t" << H[i].position << "n";
		break;
	case 2:
		cout << "ttt输入系别(火、雷、风、岩、冰、水):";
		cin >> item;
		cout << "ttt输入定位(1.辅助 2.输出):";
		cin >> i;
		switch (i)
		{
		case 1:
			if (item == "火")
			{
				printFireDefend();
			}
			if (item == "风")
			{
				printWindDefend();
			}
			if (item == "岩")
			{
				printRockDefend();
			}
			if (item == "雷")
			{
				printThunderDefend();
			}
			if (item == "水")
			{
				printWaterDefend();
			}
			if (item == "冰")
			{
				printIceDefend();

			}
			break;
		case 2:
			if (item == "火")
			{
				printFireAttack();
			}
			if (item == "风")
			{
				printWindAttack();
			}
			if (item == "岩")
			{
				printRockAttack();
			}
			if (item == "雷")
			{
				printThunderAttack();
			}
			if (item == "水")
			{
				printWaterAttack();
			}
			if (item == "冰")
			{
				printIceAttack();
			}
			break;
		}
		break;
	case 3:
	loop:SystemControl::my();
		goto loop;
	default:
		goto SEARCH;
		break;
	}

	ofstream ofile;
	ofile.open(id+ "team.txt", ios::out | ios::app);

	if (i >= 0)
	{
		cout << "ttt请输入要选择的角色名字:" ;
		cin >> it;
		if (it == "甘雨")
			i = 0;
		if (it == "凯亚")
			i = 1;
		if (it == "优菈")
			i = 2;
		if (it == "七七")
			i = 3;
		if (it == "重云")
			i = 4;
		if (it == "迪奥娜")
			i = 5;
		if (it == "罗莎莉亚")
			i = 6;
		if (it == "达达利亚")
			i = 7;
		if (it == "莫娜")
			i = 8;
		if (it == "芭芭拉")
			i = 9;
		if (it == "行秋")
			i = 10;
		if (it == "刻晴")
			i = 12;
		if (it == "雷泽")
			i = 11;
		if (it == "北斗")
			i = 13;
		if (it == "丽莎")
			i = 14;
		if (it == "菲谢尔")
			i = 15;
		if (it == "凝光")
			i = 16;
		if (it == "阿贝多")
			i = 17;
		if (it == "钟离")
			i = 18;
		if (it == "诺艾尔")
			i = 19;
		if (it == "琴")
			i = 20;
		if (it == "温迪")
			i = 21;
		if (it == "枫原万叶")
			i = 22;
		if (it == "砂糖")
			i = 23;
		if (it == "魈")
			i = 24;
		if (it == "迪卢克")
			i = 26;
		if (it == "可莉")
			i = 25;
		if (it == "胡桃")
			i = 27;
		if (it == "安柏")
			i = 28;
		if (it == "香菱")
			i = 29;
		if (it == "烟绯")
			i = 30;
		if (it == "班尼特")
			i = 31;
		if (it == "辛焱")
			i = 32;

		ofile <<"ttt"<< H[i].name << "t" << H[i].element << "t" << H[i].position << "n";
		/*us.Heros[n].name = H[i].name;
		us.Heros[n].element = H[i].element;
		us.Heros[n].position = H[i].position;*/
        he[n] = H[i].element;

		
		ofile.close(); n++;

		if (n >= 4) {

			ofile.open(id + "team.txt", ios::out | ios::app);

			double kill, ALLkill = 0;
			int lel;
			cout << "ttt请输入角色等级(1-70):";
			cin >> lel;
			if (lel <= 0 || lel > 70)
			{
				cout << "ttt输入有误,清重新输入! ";
				cin >> lel;
			}
			
				cout << endl;
				cout << "ttt  名称   " << "   元素    " << "    伤害值/生命值" << endl;
				cout << "ttt -------   -------       -----------" << endl;
				for (int a = 0; a < 4; a++)
				{
					for (int b = a + 1; b < 4; b++)
					{
						if ((he[a] == "风" && he[b] == "火") || (he[a] == "火" && he[b] == "风"))
						{
							kill = level(id, lel) * 1.2;
							ALLkill += kill;
							cout << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "风" && he[b] == "水") || (he[a] == "水" && he[b] == "风"))
						{
							kill = level(id, lel) * 1.2;
							ALLkill += kill;
							cout << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "风" && he[b] == "岩") || (he[a] == "岩" && he[b] == "风"))
						{
							kill = level(id, lel) * 1.2;
							ALLkill += kill;
							cout << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值" << setprecision(4) << kill << "n";
							ofile << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值" << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "风" && he[b] == "冰") || (he[a] == "冰" && he[b] == "风"))
						{
							kill = level(id, lel) * 1.2;
							ALLkill += kill;
							cout << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "风" && he[b] == "雷") || (he[a] == "雷" && he[b] == "风"))
						{
							kill = level(id, lel) * 1.2;
							ALLkill += kill;
							cout << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "风" && he[b] == "草") || (he[a] == "草" && he[b] == "风"))
						{
							kill = level(id, lel) * 1.2;
							ALLkill += kill;
							cout << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "扩散"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}

						else if ((he[a] == "岩" && he[b] == "火") || (he[a] == "火" && he[b] == "风"))
						{
							kill = level(id, lel) * 1;
							ALLkill += kill;
							cout << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "岩" && he[b] == "水") || (he[a] == "水" && he[b] == "岩"))
						{
							kill = level(id, lel) * 1;
							ALLkill += kill;
							cout << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "岩" && he[b] == "冰") || (he[a] == "冰" && he[b] == "岩"))
						{
							kill = level(id, lel) * 1;
							ALLkill += kill;
							cout << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "岩" && he[b] == "雷") || (he[a] == "雷" && he[b] == "岩"))
						{
							kill = level(id, lel) * 1;
							ALLkill += kill;
							cout << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "岩" && he[b] == "草") || (he[a] == "草" && he[b] == "岩"))
						{
							kill = level(id, lel) * 1;
							ALLkill += kill;
							cout << "ttt "结晶"    " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "结晶"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}

						if ((he[a] == "水" && he[b] == "火") || (he[a] == "火" && he[b] == "水"))
						{
							kill = level(id, lel) * 2;
							ALLkill += kill;
							cout << "ttt "蒸发"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "蒸发"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "冰" && he[b] == "火") || (he[a] == "火" && he[b] == "冰"))
						{
							kill = level(id, lel) * 1.5;
							ALLkill += kill;
							cout << "ttt "融化"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "融化"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "雷" && he[b] == "火") || (he[a] == "火" && he[b] == "雷"))
						{
							kill = level(id, lel) * 4;
							ALLkill += kill;
							cout << "ttt "超载"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "超载"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
						else if ((he[a] == "草" && he[b] == "火") || (he[a] == "火" && he[b] == "草"))
						{
							kill = level(id, lel) * 3;
							ALLkill += kill;
							cout << "ttt "燃烧"   " << he[a] << "+" << he[b] << "    伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "燃烧"  " << he[a] << "+" << he[b] << "    伤害值 " << setprecision(4) << kill << "n";
						}
						if (he[a] == he[b])
						{
							kill = level(id, lel) * 2;
							ALLkill += kill;
							cout << "ttt "共鸣"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
							ofile << "ttt "共鸣"     " << he[a] << "+" << he[b] << "        伤害值 " << setprecision(4) << kill << "n";
						}
					}
				}
				cout << "ttt总伤害值:" << ALLkill << endl;
				ofile << "ttt总伤害值:" << ALLkill << "n";
				ofile << endl;
				ofile.close();

				cout << "ttt您已选满四个英雄,请按任意键返回上一级";  system("pause");

			loopag1:
				SystemControl::my();
				goto loopag1;
			
		}
		else {
			cout << "ttt还剩 " << 4 - n << " 个英雄可选择" << endl;
			system("pause");
			goto SEARCH;
		}
	}
	
}
void SystemControl::old()//历史方案
{
	string id;
	system("cls"); mihayo();
	cout << "ttt请输入您的账号名:";
	cin >> id;
	ifstream file(id + "team.txt");
	string str;
	cout << "ttt已有方案如下:" << endl;
	cout << endl;
	cout << "ttt姓名" << "  t系别" << "  t定位" << endl;
	cout << "ttt======================" << endl;
	while (!file.eof())
	{
		getline(file, str);
		cout << str << endl;
	}
	cout << endl;
	cout << endl;
	system("pause");
}


int main()
{
	//花里胡哨的登陆页面动图
	SetConsoleTitle("原神图鉴");
	Controller c;
	c.full_screen();
	c.SetFont();
	system("color 0B");
	c.loading();
	system("cls"); mihayo();


	//system("pause");//任意键继续
	//system("cls");//清屏

	

	User user;
	int chose = -1;
	system("cls"); mihayo();
	cout << endl;
	cout << "ttt┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓n";
	cout << "ttt┃       1.注    册     2.登    录      ┃tn";
	cout << "ttt┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛n";
	cout << "ttt请输入你的选择:";
	cin >> chose;
	if (chose > 2 || chose < -1)
	{
		cout << "ttt输入格式错误,请重新输入:";
		cin >> chose;
	}
	switch (chose)
	{
	case 1:user.Registers(); break;
	case 2:user.Login(); break;
	}

	//
	SystemControl command;
	command.RunControl();



}

最后

以上就是机灵高跟鞋为你收集整理的【C++】原神角色管理系统——基于vs的系统开发的全部内容,希望文章能够帮你解决【C++】原神角色管理系统——基于vs的系统开发所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部