C++控制台模拟网上购物商城

C++控制台界面购物程序(长期更新;2021/7/5停止更新)

最近又看了一些C++相关的书籍,重新完善一下以前写的程序测试自己的学习情况。

提示:本程序使用了ICUF_HEAD_04.h作为头文件。
可以参考:ICUF_HEAD_04.h.


开发环境:Visual Studio 2019

使用方法

大标题的头文件配合任何一个子标题的源文件使用,在使用时需要手动添加项目。

运行截图

查询订单效果(1.60)
在这里插入图片描述

TANXL_CONSOLE_LIST.H(ICUF_HEAD_07.H)

//TANXL_CONSOLE_LIST.H(ICUF_HEAD_07.H)

#ifndef TANXL_CONSOLE_LIST
#define TANXL_CONSOLE_LIST
#ifndef TANXL_LIST//检查是否使用了其他版本的TANXL_CONSOLE_LIST
#define TANXL_LIST 1
#define LIST 1
#else
#define LIST 0
#endif
#endif
#if LIST
#ifndef IOSTREAM//检查是否已经包含IOSTREAM
#define IOSTREAM
#include <iostream>
#endif
#ifndef STRING//检查是否已经包含STRING
#define STRING
#include <string>
#endif
#ifndef CONIO_H//检查是否已经包含CONIO_H
#define CONIO_H
#include <conio.h>
#endif
#ifndef IOMANIP//检查是否已经包含IOMANIP
#define IOMANIP
#include <iomanip>
#endif
namespace CONSOLE_LIST
{
	const char* HeadFile = "HeadFile.txt";
	inline void Col(int ColN)//设置自定义行的背景颜色
	{
		if (ColN == 0)std::cout << "\033[0m";//清除颜色
		else
		{
			std::cout << "\033[4;1;7m";
			if (ColN == 1)std::cout << "\033[31m";//背景红色
			else if (ColN == 2)std::cout << "\033[32m";//背景绿色
			else if (ColN == 3)std::cout << "\033[33m";//背景黄色
			else if (ColN == 4)std::cout << "\033[34m";//背景蓝色
			else if (ColN == 5)std::cout << "\033[35m";//背景紫色
			else if (ColN == 6)std::cout << "\033[36m";//背景淡蓝
			else if (ColN == 7)std::cout << "\033[37m";//背景白色
			else if (ColN == 8)Col((rand() % 6) + 1);//随机颜色(1-7)
			else if (ColN == 10)std::cout << "\033[40m";//字体黑色
			else if (ColN == 11)std::cout << "\033[41m";//字体红色
			else if (ColN == 12)std::cout << "\033[42m";//字体绿色
			else if (ColN == 13)std::cout << "\033[43m";//字体黄色
			else if (ColN == 14)std::cout << "\033[44m";//字体蓝色
			else if (ColN == 15)std::cout << "\033[45m";//字体紫色
			else if (ColN == 16)std::cout << "\033[46m";//字体淡蓝
			else if (ColN == 17)std::cout << "\033[47m";//字体白色
			else if (ColN == 18)Col((rand() % 6) + 11);//随机颜色(11-17)
		}
	}
	typedef enum class Status
	{
		eMainList,
		eSonList
	}Status;
	typedef class MainList
	{
	public:
		void SetCol(int ColS, int ColU, int ColD = 7, int SonC = 6);//列表的背景颜色设置功能
		void SetFont(int ColS, int ColU, int ColD, int SonC);//列表的字体颜色设置功能
		void RecoverTimes();//复原被转移的Times值
		void ResetTimes();//将Times的值转移到TempTimes
		void InitList(int Start = 0);//列表初始化函数,默认初始化第一个选项为选定状态
		void Append(std::string FunctionName, int Times = 1);//List数组添加String成员
		void RemoveAll();//用于移除List数组中的所有String成员
		void SetLimit(int Max);//设置每页的最大显示数量,超出范围则默认为9
		void DisplayList(MainList List);//能够访问私有变量的子列表输出器
		void SetListName(std::string Name);//设置列表的名称
		void ShowTitle();//展示标题,标题背景色采用DefaultCol
		void SetTitle(std::string Temp);//设置标题内容
		void SetStatus(Status Sta);//设置页面级别
		void SetSpace(int Left = 23, int Right = 17, int Title = 33);//设置空格数
		int InsertAction();//输入控制(针对WASD、ZXC、↑↓←→以及数字1到9作出反应)
		int DisplayList(int LStart = 0, int LEnd = 9, int Switch = 0, int Return = 0);//显示列表,两个默认参数表示显示的开始行和结束行
		int DisplayListS(int LStart = 0, int LEnd = 9, int Return = 0);//子列表输出函数
		int CheckCurrent();//找到当前指向的选项  当找不到时返回-1
		int GetLimit();//获取每页的最大显示数量
		int GetPages();//获取总页面数
		int GetSonLists();//获取子页面选项数量
		int GetTimes();//获取页面执行次数的值
		int GetTimeS();//获取页面执行次数的值并在获取后加一
		int GetTempTimes();//获取页面执行次数的临时值
		Status GetStatus();//获取页面级别
		std::string GetListName();//获取列表的名称
	private:
		void MoveUp();//选项上移
		void MoveDown();//选项下移
		int Times{};//用于计算某一函数的执行次数,同时用于限定某些代码只执行一次
		int TempTimes{};//临时存放Times的值
		int Page{ 1 };//当前指向的页面
		int Pages{ 1 };//总页面数量
		int LimitEachPage{ 9 };//页面选项上限
		int SonLists{ 0 };//表示类中含有的字符串数量
		int ListStatus[50]{ -1 };//存放选项状态
		int SonCol{ 6 };//子列表背景颜色
		int SelectedCol{ 7 };//选中的背景颜色
		int UnSelectedCol{ 1 };//未选中的背景颜色
		int DefaultCol{ 1 };//标题背景颜色
		int SonFont{ 10 };//子列表字体颜色
		int SelectedFont{ 10 };//选中的字体颜色
		int UnSelectedFont{ 10 };//未选中的字体颜色
		int DefaultFont{ 10 };//标题字体颜色
		int WidthL{ 23 }, WidthR{ 17 }, WidthT{ 33 };//选项和标题的空格数
		Status Stat{ Status::eSonList };//页面级别
		std::string ListName;//列表的名称
		std::string List[50]{};//存放选项名称
		std::string Title{ "欢迎使用TANXL_CONSOLE_LIST  WiChG_Trade" };//默认标题字符
	}MainList;
	inline void Free(MainList* Fun)//释放指针
	{
		delete Fun;
		Fun = NULL;
	}
	void MainList::SetCol(int ColS, int ColU, int ColD, int SonC)//列表的背景颜色设置功能
	{
		this->SelectedCol = ColS;//选中物品栏的颜色
		this->UnSelectedCol = ColU;//未选中的其他物品颜色
		this->DefaultCol = ColD;//默认主题颜色
		this->SonCol = SonC;//默认子列表颜色
	}
	void MainList::SetFont(int ColS, int ColU, int ColD, int SonC)//列表的字体颜色设置功能
	{
		this->SelectedFont = ColS;//选中物品栏的颜色
		this->UnSelectedFont = ColU;//未选中的其他物品颜色
		this->DefaultFont = ColD;//默认主题颜色
		this->SonFont = SonC;//默认子列表颜色
	}
	void MainList::RecoverTimes()//复原被转移的Times值
	{
		this->Times += ++this->TempTimes;
		this->TempTimes = 0;
	}
	void MainList::ResetTimes()//将Times的值转移到TempTimes
	{
		this->TempTimes += ++this->Times;
		this->Times = 0;
	}
	void MainList::InitList(int Start)//列表初始化函数,默认初始化第一个选项为选定状态
	{
		for (int i = 0; i < SonLists; i++)
		{
			ListStatus[i] = 0;
		}
		for (int i = SonLists; i < 50; i++)
		{
			ListStatus[i] = -1;
		}
		ListStatus[Start] = 1;
	}
	void MainList::DisplayList(MainList TempList)
	{
		int Start = (TempList.Page - 1) * TempList.LimitEachPage;
		int End = Start + TempList.LimitEachPage;
		int UnSeCol = TempList.SonCol;
		int UnSeFont = TempList.SonFont;
		for (int i = Start; i < End + (9 - TempList.LimitEachPage); i++)
		{
			if (TempList.ListStatus[i] != -1)
			{
				if (TempList.ListStatus[i] == 1)
				{
					Col(TempList.SelectedCol);
					Col(TempList.SelectedFont);
				}
				else
				{
					Col(UnSeCol);
					Col(UnSeFont);
				}
				std::cout << std::setw(WidthL) << TempList.List[i] << std::setw(WidthR) << " " << std::endl;
				Col(0);
			}
		}
		std::cout << std::endl;
	}
	int MainList::DisplayList(int LStart, int LEnd, int Switch, int Return)//显示列表 ICUF_H_06中添加两个默认参数,可用于显示指定行
	{
		int Start = (Page - 1) * LimitEachPage;
		int End = Start + LimitEachPage;
		int UnSeCol = UnSelectedCol;
		int UnSeFont = UnSelectedFont;
		int ReturnS{};
		if (Switch == 1)//Switch值为1时 显示此页面的各种基本信息
			std::cout << "FunId: " << CheckCurrent() << "  Limit: " << LimitEachPage << "  Page: " << Page << "  Start: " << Start << "  End: " << End << std::endl << std::endl;
		if (Switch == 2)//Switch值为2时 输出子页面的列表 且使用子页面的颜色
		{
			UnSeCol = SonCol;
			UnSeFont = SonFont;
		}
		for (int i = Start + LStart; i < End + (LEnd - LimitEachPage); i++)
		{
			if (ListStatus[i] != -1)
			{
				if (ListStatus[i] == 1)
				{
					Col(SelectedCol);
					Col(SelectedFont);
				}
				else
				{
					Col(UnSeCol);
					Col(UnSeFont);
				}
				std::cout << std::setw(WidthL) << List[i] << std::setw(WidthR) << " " << std::endl;
				if (Switch != 2)
					std::cout << std::endl;
				Col(0);
			}
		}
		if (Switch == 2)
			std::cout << std::endl;
		if (Return != 0)
			ReturnS = InsertAction();
		else
			return 0;
		return ReturnS;
	}
	int MainList::InsertAction()//输入控制
	{
		char Key;
		int Temp;
		Key = _getch();
		if (Key == 'c' || Key == 'C')//如果输入了大小写的C则返回上一级
			return 3;
		if (SonLists == 0)
			return 0;
		if ((int)(Key - 48) > 0 && (int)(Key - 48) <= 9)//判断是否是从零到九的数字
		{
			if ((int)(Key - 48) > SonLists)//如果是,且小于等于选项总数则直接指定这个选项
				InitList(SonLists - 1);
			else
				InitList((int)(Key - 48) - 1);//如果超出了最大值,则指向最大值
			return 4;
		}
		else if (Key == 'w' || Key == 'W' || Key == 72)//如果输入了大小写的W或者上箭头,则执行MoveUp函数
		{
			MoveUp();
			return 0;
		}
		else if (Key == 's' || Key == 'S' || Key == 80)//如果输入了大小写的S或者下箭头,则执行MoveDown函数
		{
			MoveDown();
			return 0;
		}
		else if (Key == 'a' || Key == 'A' || Key == 75)//如果输入了大小写的A或者左箭头,则执行向上翻页函数
		{
			if (Page == GetPages() && GetPages() == 1)
			{
				Temp = CheckCurrent();
				ListStatus[Temp] = 0;
				ListStatus[0] = 1;
			}
			else if (Page != 1)
			{
				Page--;
				Temp = CheckCurrent();
				ListStatus[Temp] = 0;
				ListStatus[Temp - LimitEachPage] = 1;
			}
			else
			{
				Page = GetPages();
				Temp = CheckCurrent();
				ListStatus[Temp] = 0;
				ListStatus[(Page - 1) * LimitEachPage] = 1;
			}
			return 0;
		}
		else if (Key == 'd' || Key == 'D' || Key == 77)//如果输入了大小写的D或者右箭头,则执行向下翻页函数
		{
			if (Page == GetPages() && GetPages() == 1)
			{
				Temp = CheckCurrent();
				ListStatus[Temp] = 0;
				ListStatus[SonLists - 1] = 1;
			}
			else if (Page != GetPages())
			{
				Page++;
				Temp = CheckCurrent();
				ListStatus[Temp] = 0;
				if (Temp + LimitEachPage >= SonLists - 1)
					ListStatus[SonLists - 1] = 1;
				else
					ListStatus[Temp + LimitEachPage] = 1;
			}
			else
			{
				Page = 1;
				Temp = CheckCurrent();
				ListStatus[Temp] = 0;
				ListStatus[Temp % LimitEachPage] = 1;
			}
			return 0;
		}
		else if (Key == 'z' || Key == 'Z')//保留原功能的情况下,预留两个用户自定义返回值
		{
			return 1;
		}
		else if (Key == 'x' || Key == 'X')
		{
			return 2;
		}
		else if (Key == '\r')//回车确认
			return 4;
		return 0;
	}
	int MainList::CheckCurrent()//找到当前指向的选项  当找不到时返回-1
	{
		for (int j = 0; j < SonLists; j++)
		{
			if (ListStatus[j] == 1)
				return j;
		}
		return -1;
	}
	void MainList::Append(std::string FunctionName, int Times)//List数组添加String成员
	{
		if (Times != 0)
			return;
		List[SonLists] = FunctionName;

		SonLists += 1;//成员计数器
	}
	void MainList::RemoveAll()//用于移除List数组中的所有String成员
	{
		for (int i = 0; i < 10; i++)
		{
			List[i] = {};
			SonLists = 0;
		}
	}
	void MainList::SetLimit(int Max)//设置每页的最大显示数量,超出范围则默认为9
	{
		LimitEachPage = (Max > 9 || Max <= 0) ? 9 : Max;
	}
	int MainList::GetPages()//获取总页面数
	{
		if (SonLists % LimitEachPage != 0)
			Pages = SonLists / LimitEachPage + 1;
		else
			Pages = SonLists / LimitEachPage;
		return Pages;
	}
	int MainList::GetLimit()//获取每页的最大显示数量
	{
		return LimitEachPage;
	}
	void MainList::MoveUp()//选项上移
	{
		int i = CheckCurrent();//找到当前指向的选项
		if (i == 0 && SonLists == 1)//如果只有一个选项则不变
			ListStatus[i] = 1;
		else if (i == 0 && SonLists != 1)//如果指向第一个且不止包含一个选项,则改为指向最下方的选项
		{
			ListStatus[i] = 0;
			Page = GetPages();
			ListStatus[SonLists - 1] = 1;
		}
		else if ((i + 1) % LimitEachPage == 1)//如果指向某一页面的第一项则翻页,并指向前一页的最后一项
		{
			if (Page != 1)
			{
				Page--;
				ListStatus[i] = 0;
				ListStatus[i - 1] = 1;
			}
			else
			{
				Page = GetPages();
				ListStatus[i] = 0;
				ListStatus[SonLists - 1] = 1;
			}
		}
		else//正常情况
		{
			ListStatus[i] = 0;
			ListStatus[i - 1] = 1;
		}
	}
	void MainList::MoveDown()//选项下移
	{
		int i = CheckCurrent();//找到当前指向的选项
		if (i == 0 && SonLists == 1)//如果只有一个选项则不变
			ListStatus[i] = 1;
		else if (i != 0 && i == SonLists - 1)//如果指向最后一个且不止包含一个选项,则改为指向最上方的选项
		{
			ListStatus[SonLists - 1] = 0;
			Page = 1;
			ListStatus[0] = 1;
		}
		else if ((i + 1) % LimitEachPage == 0)//如果指向某一页面的最后一项则翻页,并指向下一页的第一项
		{
			if (Page != GetPages())
			{
				Page++;
				ListStatus[i] = 0;
				ListStatus[i + 1] = 1;
			}
			else
			{
				Page = 1;
				ListStatus[i] = 0;
				ListStatus[0] = 1;
			}
		}
		else//正常情况
		{
			ListStatus[i] = 0;
			ListStatus[i + 1] = 1;
		}
	}
	void MainList::SetListName(std::string Name)
	{
		this->ListName = Name;
	}
	std::string MainList::GetListName()
	{
		return this->ListName;
	}
	void MainList::SetTitle(std::string Temp)
	{
		Title = Temp;
	}
	void MainList::ShowTitle()
	{
		Col(DefaultCol); Col(DefaultFont);
		std::cout << std::endl << std::endl << std::endl << std::endl;
		std::cout << std::setw(WidthL) << " " << std::setw(WidthT) << Title << std::setw(WidthR) << " " << std::endl << std::endl; Col(0);
	}
	int MainList::DisplayListS(int LStart, int LEnd, int Return)//显示列表 ICUF_H_06中添加两个默认参数,可用于显示指定行
	{
		int Start = (Page - 1) * LimitEachPage;
		int End = Start + LimitEachPage;
		int ReturnS{};
		for (int i = Start + LStart; i < End + (LEnd - LimitEachPage); i++)
		{
			if (ListStatus[i] != -1)
			{
				if (ListStatus[i] == 1)
				{
					Col(SelectedCol);
					Col(SelectedFont);
				}
				else
				{
					Col(SonCol);
					Col(SonFont);
				}
				std::cout << std::setw(WidthL) << List[i] << std::setw(WidthR) << " " << std::endl;
				Col(0);
			}
		}
		std::cout << std::endl;
		if (Return != 0)
			ReturnS = InsertAction();
		else
			return 0;
		return ReturnS;
	}
	int MainList::GetSonLists()
	{
		return SonLists;
	}
	int MainList::GetTimes()
	{
		return Times;
	}
	int MainList::GetTimeS()
	{
		return Times++;
	}
	int MainList::GetTempTimes()
	{
		return TempTimes;
	}
	void MainList::SetStatus(Status Sta)
	{
		Stat = Sta;
	}
	Status MainList::GetStatus()
	{
		return Stat;
	}
	void MainList::SetSpace(int Left, int Right, int Title)
	{
		WidthL = Left;
		WidthR = Right;
		WidthT = Title;
	}
}
#endif

ICUF2 0.00.01.66

// ICUF 2.0 - 0.00.01.66  2021/10/3 17:47
// 修复购买物品的一个返回值错误
// 加入购物车功能

#ifndef TIME_H
#include <time.h>
#endif
#ifndef TANXL_CONSOLE_LIST
#include "TANXL_CONSOLE_LIST.h"
#endif
#ifndef FSTREAM
#include <fstream>
#endif
using namespace std;
ofstream fout;
ifstream fin;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
int LengthOfData{};
void BuyingCargo(int Id);
void SearchDealShow();
void SearchDealById();
void Init();
void ChangeSingle();
void AddNewData();
void DefaultData();
void RemoveData();
void ShoppingCart();
CONSOLE_LIST::MainList MainPage, BuyingPage, BuyPage, ChangeDPage, SearchDPage, SetPage, CartPage;
enum ICUF_Type_Status
{
	UnknownType = 0,
	WeaponType,
	StickerType,
	CasesType,
	AgentType
};
class ICUF_Type
{
	virtual void SetCargoType(int i = 0) = 0;
	virtual string GetCargoType() = 0;
};
class ICUF_Skin :ICUF_Type
{
public:void SetCargoType(int i = 0)
{
	switch (i)
	{
	case 0:Type = UnknownType; break;
	case 1:Type = WeaponType; break;
	case 2:Type = StickerType; break;
	case 3:Type = CasesType; break;
	case 4:Type = AgentType; break;
	default:Type = UnknownType;
	}
}
public:string GetCargoType()
{
	return Type;
}
public:
	int ICUF_Id{ 0 };
	string ICUF_Name{};
	string ICUF_Float{};
	double ICUF_Price{};
private:
	string Type{};
};
string ShopC{};
ICUF_Skin ISD[30];
class ICUF_Data//用于对本地数据进行获取修改的类
{
public:
	void SaveSkinData()
	{
		fout.open(SDL);
		for (int i = 0; i < 30; i++)
		{
			if (ISD[i].ICUF_Id == 0)
			{
				LengthOfData = i;
				break;
			}
			fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
		}
		fout.close();
	}
	void GetSkinData()
	{
		fin.open(SDL);
		for (int i = 0; i < 30; i++)
		{
			fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
		}
		fin.close();
	}
	int GetLength()
	{
		return LengthOfData;
	}
	void RemoveData()
	{
		remove(SDL);
		remove(Deals);
	}
private:
	int LengthOfData{};
};
ICUF_Data Data;
int main()
{
	Init();
	MainPage.Append("购买商品", MainPage.GetTimes());
	MainPage.Append("查询订单", MainPage.GetTimes());
	MainPage.Append("系统管理", MainPage.GetTimes());
	MainPage.Append(" 购物车 ", MainPage.GetTimes());
	MainPage.Append("退出系统", MainPage.GetTimeS());
	CONSOLE_LIST::MainList* F = &MainPage;
	CONSOLE_LIST::MainList* T = NULL;
	MainPage.InitList();
	int Temp = MainPage.GetSonLists();
	CONSOLE_LIST::Col(0);
	while (1)
	{
		system("cls");
		MainPage.SetTitle("欢迎来到ICUF购物平台  WiChG_Trade");
		MainPage.ShowTitle();
		MainPage.DisplayList(0, Temp, 1);
		if (T != NULL)
		{
			T->DisplayListS();
		}
		MainPage.DisplayList(Temp, MainPage.GetSonLists());
		int i = F->InsertAction();
		if (i == 3)
		{
			T = NULL;
			F = &MainPage;
		}
		else if (i == 4)
		{
			int i = F->CheckCurrent();
			if (i == 0 && F == &MainPage)
			{
				Temp = i + 1;
				T = &BuyPage;
				F = &BuyPage;
			}
			else if (i == 1 && F == &MainPage)
			{
				Temp = i + 1;
				T = &SearchDPage;
				F = &SearchDPage;
			}
			else if (i == 2 && F == &MainPage)
			{
				Temp = i + 1;
				T = &ChangeDPage;
				F = &ChangeDPage;
			}
			else if (i == 3 && F == &MainPage)
			{
				Temp = i + 1;
				T = &CartPage;
				F = &CartPage;
			}
			else if (i == 4 && F == &MainPage)
				exit(1);
			else if (F == &BuyPage)
			{
				BuyingCargo(i);
			}
			else if (F == &SearchDPage)
			{
				if (i == 0)
					SearchDealShow();
				else if (i == 1)
					SearchDealById();
			}
			else if (F == &ChangeDPage)
			{
				if (i == 0)//更改单一数据功能
					ChangeSingle();
				else if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
					AddNewData();
				else if (i == 2)//系统初始数据
					DefaultData();
				else if (i == 3)//删除所有本地数据
					RemoveData();
			}
			else if (F == &CartPage)
			{
				if (i == 0)
					ShoppingCart();
				else if (i == 1)
					ShopC = {};
			}
		}
	}
}
void BuyingCargo(int Id)
{
	BuyingPage.Append("确认", BuyingPage.GetTimes());
	BuyingPage.Append("返回", BuyingPage.GetTimes());
	BuyingPage.Append("添加到购物车", BuyingPage.GetTimeS());
	BuyingPage.InitList();
	while (1)
	{
		system("cls");
		CONSOLE_LIST::Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << "是否确认购买?" << endl << endl; CONSOLE_LIST::Col(0);
		int i = BuyingPage.DisplayList(0, 9, 0, 1);
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyingPage.CheckCurrent();
			if (i == 1)
				main();
			else
			{
				cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
				int Number;
				cin >> Number;
				if (i == 0)
				{
					srand(time(NULL));
					int List = ((rand() % 9) + 1) * 100000 + ((rand() % 9) + 1) * 10000 + ((rand() % 9) + 1) * 1000 + ((rand() % 9) + 1) * 100 + ((rand() % 9) + 1) * 10 + ((rand() % 9) + 1);
					fout.close();
					fout.open(Deals, ios::app);
					fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
					fout.close();
					cout << "购买成功  你的购买订单号为 " << List << endl;
					cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
					system("pause");
					main();
				}
				else
				{
					ShopC +="@Name"+ ISD[Id].ICUF_Name+"@Number"+ to_string(Number);
					cout << "成功添加到购物车 !" << endl;
					system("pause");
					main();
				}
			}
		}
	}
}
void SearchDealById()
{
	int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	CONSOLE_LIST::Col(8); cout << "请输入要查询的订单号 : ";
	cin >> list; CONSOLE_LIST::Col(0);
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

	}
	fout.close();
	int flag{};
	CONSOLE_LIST::Col(8);
	for (int j = 0; j < DataLength; j++)
	{
		if (List[j] == list)
		{
			cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; CONSOLE_LIST::Col(0);
			flag = 1;
		}
		if (flag == 0 && j == DataLength - 1)
			cout << "不存在此订单!"; CONSOLE_LIST::Col(0);
	}
	if (DataLength == 0)
		cout << "当前不存在任何已储存订单" << endl; CONSOLE_LIST::Col(0);
	system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
	int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
		CONSOLE_LIST::Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; CONSOLE_LIST::Col(0);
	}
	fout.close();
	system("pause");
}
void Init()//用于判断执行次数并进行更新
{
	Data.GetSkinData();//读取本地文件数据
	Data.SaveSkinData();
	if (BuyPage.GetTempTimes() != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < Data.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.GetTimes());
	BuyPage.GetTimeS();
	BuyPage.RecoverTimes();
	BuyPage.InitList();
	SearchDPage.Append("1.查询所有", SearchDPage.GetTimes());
	SearchDPage.Append("2.按ID查询", SearchDPage.GetTimeS());
	SearchDPage.InitList();
	ChangeDPage.Append("1.更改数据", ChangeDPage.GetTimes());
	ChangeDPage.Append("2.添加数据", ChangeDPage.GetTimes());
	ChangeDPage.Append("3.默认数据", ChangeDPage.GetTimes());
	ChangeDPage.Append("4.清理数据", ChangeDPage.GetTimeS());
	ChangeDPage.InitList();
	CartPage.Append("查看购物车", CartPage.GetTimes());
	CartPage.Append("清空购物车", CartPage.GetTimeS());
	CartPage.InitList();
	MainPage.SetListName("Main");
	BuyPage.SetListName("Buy");
	BuyingPage.SetListName("Buying");
	ChangeDPage.SetListName("Change");
	SearchDPage.SetListName("Search");
	SetPage.SetListName("Set");
	CartPage.SetListName("Cart");
}
void ChangeSingle()//更改单一数据功能
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	int ISD_Id, ISD_Fun;
	CONSOLE_LIST::Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
	cin >> ISD_Id; CONSOLE_LIST::Col(0);
	SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.GetTimes());
	SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.GetTimes());
	SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.GetTimes());
	SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.GetTimeS());
	SetPage.InitList();
	while (1)
	{
		system("cls");
		SetPage.SetTitle("更改单一数据  WiChG_Trade");
		SetPage.ShowTitle();
		int i = SetPage.DisplayList(0, 9, 0, 1);
		if (i == 3)
		{
			main();
		}
		else if (i == 4)
		{
			int i = SetPage.CheckCurrent();
			ISD_Fun = i + 1;
			break;
		}
	}
	CONSOLE_LIST::Col(1); cout << "请输入修改后的内容 :  ";
	switch (ISD_Fun)
	{
	case 1:
		/*cin >> ISD[ISD_Id].ICUF_Id;*/
		CONSOLE_LIST::Col(1); cout << "暂时不提供修改序号的功能 !" << endl; CONSOLE_LIST::Col(0);
		break;
	case 2:
		cin >> ISD[ISD_Id - 1].ICUF_Name;
		break;
	case 3:
		cin >> ISD[ISD_Id - 1].ICUF_Float;
		break;
	case 4:
		cin >> ISD[ISD_Id - 1].ICUF_Price;
		break;
	}
	CONSOLE_LIST::Col(0);
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void AddNewData()//从头开始修改数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	int breakword{};
	system("cls");
	for (int i = BuyPage.GetSonLists(); i < 30; i++)
	{
		CONSOLE_LIST::Col(8); cout << "ICUF_Id  :" << i + 1 << endl; CONSOLE_LIST::Col(0);
		ISD[i].ICUF_Id = i + 1;
		CONSOLE_LIST::Col(8); cout << "请输入 ICUF_Name (string) :";
		cin >> ISD[i].ICUF_Name; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << "请输入 ICUF_Float (string) :";
		cin >> ISD[i].ICUF_Float; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << "请输入 ICUF_Price (double) :";
		cin >> ISD[i].ICUF_Price; CONSOLE_LIST::Col(0);
		SetPage.Append("1.继续", SetPage.GetTimes());
		SetPage.Append("2.退出", SetPage.GetTimeS());
		SetPage.InitList();
		while (1)
		{
			system("cls");
			for (int j = 0; j <= i; j++)
			{
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; CONSOLE_LIST::Col(0);
				ISD[j].ICUF_Id = j + 1;
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; CONSOLE_LIST::Col(0);
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; CONSOLE_LIST::Col(0);
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; CONSOLE_LIST::Col(0);
			}
			int i = SetPage.DisplayList(0, 9, 0, 1);
			if (i == 3)
			{
				main();
			}
			else if (i == 4)
			{
				int i = SetPage.CheckCurrent();
				if (i == 0)
				{
					breakword = 0;
					break;
				}
				else if (i == 1)
				{
					LengthOfData = i;
					breakword = 1;
					break;
				}
			}
		}
		if (breakword == 1)
			break;
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void DefaultData()//系统初始数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	Data.RemoveData();
	for (int i = 0; i < 30; i++)
	{
		if (i == 0)
		{
			ISD[0].ICUF_Id = 1;
			ISD[0].ICUF_Name = "地下水";
			ISD[0].ICUF_Float = "久经沙场";
			ISD[0].ICUF_Price = 0.2;
		}
		else if (i == 1)
		{
			ISD[1].ICUF_Id = 2;
			ISD[1].ICUF_Name = "地下水";
			ISD[1].ICUF_Float = "略有磨损";
			ISD[1].ICUF_Price = 0.3;
		}
		else if (i == 2)
		{
			ISD[2].ICUF_Id = 3;
			ISD[2].ICUF_Name = "地下水";
			ISD[2].ICUF_Float = "崭新出厂";
			ISD[2].ICUF_Price = 0.4;
		}
		else if (i == 3)
		{
			ISD[3].ICUF_Id = 4;
			ISD[3].ICUF_Name = "狩猎网格";
			ISD[3].ICUF_Float = "久经沙场";
			ISD[3].ICUF_Price = 0.5;
		}
		else
		{
			ISD[i].ICUF_Id = NULL;
			ISD[i].ICUF_Name = "";
			ISD[i].ICUF_Float = "";
			ISD[i].ICUF_Price = NULL;
		}
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void RemoveData()//删除所有本地数据
{
	Data.RemoveData();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		ISD[i].ICUF_Id = NULL;
		ISD[i].ICUF_Name = "";
		ISD[i].ICUF_Float = "";
		ISD[i].ICUF_Price = NULL;
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void ShoppingCart()
{
	if (ShopC.length() != 0)
	{
		cout << ShopC;
	}
}

ICUF2 0.00.01.65

// ICUF 2.0 - 0.00.01.65  2021/7/28 22:50

#ifndef TIME_H
#include <time.h>
#endif
#ifndef TANXL_CONSOLE_LIST
#include "TANXL_CONSOLE_LIST.h"
#endif
#ifndef FSTREAM
#include <fstream>
#endif
using namespace std;
ofstream fout;
ifstream fin;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
int LengthOfData{};
void BuyingCargo(int Id);
void SearchDealShow();
void SearchDealById();
void Init();
void ChangeSingle();
void AddNewData();
void DefaultData();
void RemoveData();
CONSOLE_LIST::MainList MainPage, BuyingPage, BuyPage, ChangeDPage, SearchDPage, SetPage;
enum ICUF_Type_Status
{
	UnknownType = 0,
	WeaponType,
	StickerType,
	CasesType,
	AgentType
};
class ICUF_Type
{
	virtual void SetCargoType(int i = 0) = 0;
	virtual string GetCargoType() = 0;
};
class ICUF_Skin :ICUF_Type
{
public:void SetCargoType(int i = 0)
{
	switch (i)
	{
	case 0:Type = UnknownType; break;
	case 1:Type = WeaponType; break;
	case 2:Type = StickerType; break;
	case 3:Type = CasesType; break;
	case 4:Type = AgentType; break;
	default:Type = UnknownType;
	}
}
public:string GetCargoType()
{
	return Type;
}
public:
	int ICUF_Id{ 0 };
	string ICUF_Name{};
	string ICUF_Float{};
	double ICUF_Price{};
private:
	string Type{};
};
ICUF_Skin ISD[30];
class ICUF_Data//用于对本地数据进行获取修改的类
{
public:
	void SaveSkinData()
	{
		fout.open(SDL);
		for (int i = 0; i < 30; i++)
		{
			if (ISD[i].ICUF_Id == 0)
			{
				LengthOfData = i;
				break;
			}
			fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
		}
		fout.close();
	}
	void GetSkinData()
	{
		fin.open(SDL);
		for (int i = 0; i < 30; i++)
		{
			fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
		}
		fin.close();
	}
	int GetLength()
	{
		return LengthOfData;
	}
	void RemoveData()
	{
		remove(SDL);
		remove(Deals);
	}
private:
	int LengthOfData{};
};
ICUF_Data Data;
int main()
{
	Init();
	MainPage.Append("购买商品", MainPage.GetTimes());
	MainPage.Append("查询订单", MainPage.GetTimes());
	MainPage.Append("系统管理", MainPage.GetTimes());
	MainPage.Append("退出系统", MainPage.GetTimeS());
	CONSOLE_LIST::MainList* F = &MainPage;
	CONSOLE_LIST::MainList* T = NULL;
	MainPage.InitList();
	int Temp = MainPage.GetSonLists();
	CONSOLE_LIST::Col(0);
	while (1)
	{
		system("cls");
		MainPage.SetTitle("欢迎来到ICUF购物平台  WiChG_Trade");
		MainPage.ShowTitle();
		MainPage.DisplayList(0, Temp, 1);
		if (T != NULL)
		{
			T->DisplayListS();
		}
		MainPage.DisplayList(Temp, MainPage.GetSonLists());
		int i = F->InsertAction();
		if (i == 3)
		{
			T = NULL;
			F = &MainPage;
		}
		else if (i == 4)
		{
			int i = F->CheckCurrent();
			if (i == 0 && F == &MainPage)
			{
				Temp = i + 1;
				T = &BuyPage;
				F = &BuyPage;
			}
			else if (i == 1 && F == &MainPage)
			{
				Temp = i + 1;
				T = &SearchDPage;
				F = &SearchDPage;
			}
			else if (i == 2 && F == &MainPage)
			{
				Temp = i + 1;
				T = &ChangeDPage;
				F = &ChangeDPage;
			}
			else if (i == 3 && F == &MainPage)
				exit(1);
			else if (F == &BuyPage)
			{
				BuyingCargo(i);
			}
			else if (F == &SearchDPage)
			{
				if (i == 0)
					SearchDealShow();
				else if (i == 1)
					SearchDealById();
			}
			else if (F == &ChangeDPage)
			{
				if (i == 0)//更改单一数据功能
					ChangeSingle();
				else if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
					AddNewData();
				else if (i == 2)//系统初始数据
					DefaultData();
				else if (i == 3)//删除所有本地数据
					RemoveData();
			}
		}
	}
}
void BuyingCargo(int Id)
{
	BuyingPage.Append("继续", BuyingPage.GetTimes());
	BuyingPage.Append("返回", BuyingPage.GetTimeS());
	BuyingPage.InitList();
	while (1)
	{
		system("cls");
		CONSOLE_LIST::Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << "是否继续购买?" << endl << endl; CONSOLE_LIST::Col(0);
		int i = BuyingPage.DisplayList();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyingPage.CheckCurrent();
			if (i == 1)
				main();
			else
			{
				cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
				int Number;
				cin >> Number;
				srand(time(NULL));
				int List = ((rand() % 9) + 1) * 100000 + ((rand() % 9) + 1) * 10000 + ((rand() % 9) + 1) * 1000 + ((rand() % 9) + 1) * 100 + ((rand() % 9) + 1) * 10 + ((rand() % 9) + 1);
				fout.close();
				fout.open(Deals, ios::app);
				fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
				fout.close();
				cout << "购买成功  你的购买订单号为 " << List << endl;
				cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
				system("pause");
				main();
			}
		}
	}
}
void SearchDealById()
{
	int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	CONSOLE_LIST::Col(8); cout << "请输入要查询的订单号 : ";
	cin >> list; CONSOLE_LIST::Col(0);
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

	}
	fout.close();
	int flag{};
	CONSOLE_LIST::Col(8);
	for (int j = 0; j < DataLength; j++)
	{
		if (List[j] == list)
		{
			cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; CONSOLE_LIST::Col(0);
			flag = 1;
		}
		if (flag == 0 && j == DataLength - 1)
			cout << "不存在此订单!"; CONSOLE_LIST::Col(0);
	}
	if (DataLength == 0)
		cout << "当前不存在任何已储存订单" << endl; CONSOLE_LIST::Col(0);
	system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
	int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
		CONSOLE_LIST::Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; CONSOLE_LIST::Col(0);
	}
	fout.close();
	system("pause");
}
void Init()//用于判断执行次数并进行更新
{
	Data.GetSkinData();//读取本地文件数据
	Data.SaveSkinData();
	if (BuyPage.GetTempTimes() != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < Data.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.GetTimes());
	BuyPage.GetTimeS();
	BuyPage.RecoverTimes();
	BuyPage.InitList();
	SearchDPage.Append("1.查询所有", SearchDPage.GetTimes());
	SearchDPage.Append("2.按ID查询", SearchDPage.GetTimeS());
	SearchDPage.InitList();
	ChangeDPage.Append("1.更改数据", ChangeDPage.GetTimes());
	ChangeDPage.Append("2.添加数据", ChangeDPage.GetTimes());
	ChangeDPage.Append("3.默认数据", ChangeDPage.GetTimes());
	ChangeDPage.Append("4.清理数据", ChangeDPage.GetTimeS());
	ChangeDPage.InitList();
	MainPage.SetListName("Main");
	BuyPage.SetListName("Buy");
	BuyingPage.SetListName("Buying");
	ChangeDPage.SetListName("Change");
	SearchDPage.SetListName("Search");
	SetPage.SetListName("Set");
}
void ChangeSingle()//更改单一数据功能
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	int ISD_Id, ISD_Fun;
	CONSOLE_LIST::Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
	cin >> ISD_Id; CONSOLE_LIST::Col(0);
	SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.GetTimes());
	SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.GetTimes());
	SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.GetTimes());
	SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.GetTimeS());
	SetPage.InitList();
	while (1)
	{
		system("cls");
		SetPage.SetTitle("更改单一数据  WiChG_Trade");
		SetPage.ShowTitle();
		int i = SetPage.DisplayList();
		if (i == 3)
		{
			main();
		}
		else if (i == 4)
		{
			int i = SetPage.CheckCurrent();
			ISD_Fun = i + 1;
			break;
		}
	}
	CONSOLE_LIST::Col(1); cout << "请输入修改后的内容 :  ";
	switch (ISD_Fun)
	{
	case 1:
		/*cin >> ISD[ISD_Id].ICUF_Id;*/
		CONSOLE_LIST::Col(1); cout << "暂时不提供修改序号的功能 !" << endl; CONSOLE_LIST::Col(0);
		break;
	case 2:
		cin >> ISD[ISD_Id - 1].ICUF_Name;
		break;
	case 3:
		cin >> ISD[ISD_Id - 1].ICUF_Float;
		break;
	case 4:
		cin >> ISD[ISD_Id - 1].ICUF_Price;
		break;
	}
	CONSOLE_LIST::Col(0);
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void AddNewData()//从头开始修改数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	int breakword{};
	system("cls");
	for (int i = BuyPage.GetSonLists(); i < 30; i++)
	{
		CONSOLE_LIST::Col(8); cout << "ICUF_Id  :" << i + 1 << endl; CONSOLE_LIST::Col(0);
		ISD[i].ICUF_Id = i + 1;
		CONSOLE_LIST::Col(8); cout << "请输入 ICUF_Name (string) :";
		cin >> ISD[i].ICUF_Name; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << "请输入 ICUF_Float (string) :";
		cin >> ISD[i].ICUF_Float; CONSOLE_LIST::Col(0);
		CONSOLE_LIST::Col(8); cout << "请输入 ICUF_Price (double) :";
		cin >> ISD[i].ICUF_Price; CONSOLE_LIST::Col(0);
		SetPage.Append("1.继续", SetPage.GetTimes());
		SetPage.Append("2.退出", SetPage.GetTimeS());
		SetPage.InitList();
		while (1)
		{
			system("cls");
			for (int j = 0; j <= i; j++)
			{
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; CONSOLE_LIST::Col(0);
				ISD[j].ICUF_Id = j + 1;
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; CONSOLE_LIST::Col(0);
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; CONSOLE_LIST::Col(0);
				CONSOLE_LIST::Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; CONSOLE_LIST::Col(0);
			}
			int i = SetPage.DisplayList();
			if (i == 3)
			{
				main();
			}
			else if (i == 4)
			{
				int i = SetPage.CheckCurrent();
				if (i == 0)
				{
					breakword = 0;
					break;
				}
				else if (i == 1)
				{
					LengthOfData = i;
					breakword = 1;
					break;
				}
			}
		}
		if (breakword == 1)
			break;
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void DefaultData()//系统初始数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	Data.RemoveData();
	for (int i = 0; i < 30; i++)
	{
		if (i == 0)
		{
			ISD[0].ICUF_Id = 1;
			ISD[0].ICUF_Name = "地下水";
			ISD[0].ICUF_Float = "久经沙场";
			ISD[0].ICUF_Price = 0.2;
		}
		else if (i == 1)
		{
			ISD[1].ICUF_Id = 2;
			ISD[1].ICUF_Name = "地下水";
			ISD[1].ICUF_Float = "略有磨损";
			ISD[1].ICUF_Price = 0.3;
		}
		else if (i == 2)
		{
			ISD[2].ICUF_Id = 3;
			ISD[2].ICUF_Name = "地下水";
			ISD[2].ICUF_Float = "崭新出厂";
			ISD[2].ICUF_Price = 0.4;
		}
		else if (i == 3)
		{
			ISD[3].ICUF_Id = 4;
			ISD[3].ICUF_Name = "狩猎网格";
			ISD[3].ICUF_Float = "久经沙场";
			ISD[3].ICUF_Price = 0.5;
		}
		else
		{
			ISD[i].ICUF_Id = NULL;
			ISD[i].ICUF_Name = "";
			ISD[i].ICUF_Float = "";
			ISD[i].ICUF_Price = NULL;
		}
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void RemoveData()//删除所有本地数据
{
	Data.RemoveData();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		ISD[i].ICUF_Id = NULL;
		ISD[i].ICUF_Name = "";
		ISD[i].ICUF_Float = "";
		ISD[i].ICUF_Price = NULL;
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}

ICUF_HEAD_06.h

//ICUF_HEAD_06.H

#ifndef ICUF_HEAD_06
#define ICUF_HEAD_06
#include <iostream>
#include <string>
#include <fstream>
#include <conio.h>
#include <iomanip>
using namespace std;
ofstream fout;
ifstream fin;
const char* HeadFile = "HeadFile.txt";
inline void Col(int ColN)//设置自定义行的背景颜色
{
	if (ColN == 0)cout << "\033[0m";//清除颜色
	else
	{
		cout << "\033[4;1;7m";
		if (ColN == 1)cout << "\033[31m";//背景红色
		else if (ColN == 2)cout << "\033[32m";//背景绿色
		else if (ColN == 3)cout << "\033[33m";//背景黄色
		else if (ColN == 4)cout << "\033[34m";//背景蓝色
		else if (ColN == 5)cout << "\033[35m";//背景紫色
		else if (ColN == 6)cout << "\033[36m";//背景淡蓝
		else if (ColN == 7)cout << "\033[37m";//背景白色
		else if (ColN == 8)Col((rand() % 6) + 1);//随机颜色(1-7)
		else if (ColN == 11)cout << "\033[41m";//字体红色
		else if (ColN == 12)cout << "\033[42m";//字体绿色
		else if (ColN == 13)cout << "\033[43m";//字体黄色
		else if (ColN == 14)cout << "\033[44m";//字体蓝色
		else if (ColN == 15)cout << "\033[45m";//字体紫色
		else if (ColN == 16)cout << "\033[46m";//字体淡蓝
		else if (ColN == 17)cout << "\033[47m";//字体白色
		else if (ColN == 18)Col((rand() % 6) + 11);//随机颜色(11-17)
	}
}
class FunctionList
{
public:int Page{ 1 };
public:int Times{};//用于计算某一函数的执行次数,同时用于限定某些代码只执行一次
public:int TempTimes{};
public:int FunctionNumbers = 0;//表示类中含有的字符串数量
public:virtual void SetCol(int ColS, int ColU, int ColD = 7)
{
	this->SelectedCol = ColS;
	this->UnSelectedCol = ColU;
	this->DefaultCol = ColD;
}
public:void RecoverTimes()//复原被转移的Times值
{
	this->Times += ++this->TempTimes;
	this->TempTimes = 0;
}
public:void ResetTimes()//将Times的值转移到TempTimes
{
	this->TempTimes += ++this->Times;
	this->Times = 0;
}
public:void InitList(int Start = 0)//列表初始化函数,默认初始化第一个选项为选定状态
{
	for (int i = 0; i < FunctionNumbers; i++)
	{
		ListStatus[i] = 0;
	}
	for (int i = FunctionNumbers; i < 50; i++)
	{
		ListStatus[i] = -1;
	}
	ListStatus[Start] = 1;
}
public:virtual void DisplayList(int LStart = 0, int LEnd = 9, int Switch = 0)//显示列表 ICUF_H_06中添加两个默认参数,可用于显示指定行
{
	int Start = (Page - 1) * LimitListEachPage;
	int End = Start + LimitListEachPage;
	int UnSeCol = UnSelectedCol;
	if (Switch == 1)//Switch值为1时 显示此页面的各种基本信息
		cout << "FunId: " << CheckCurrent() << "  Limit: " << LimitListEachPage << "  Page: " << Page << "  Start: " << Start << "  End: " << End << endl << endl;
	if (Switch == 2)//Switch值为2时 输出子页面的列表 且使用子页面的颜色
		UnSeCol = TempCol;
	for (int i = Start + LStart; i < End + (LEnd - LimitListEachPage); i++)
	{
		if (ListStatus[i] != -1)
		{
			if (ListStatus[i] == 1)
				Col(SelectedCol);
			else
				Col(UnSeCol);
			cout << setw(23) << List[i] << setw(16) << " " << endl;
			if (Switch != 2)
				cout << endl;
			Col(0);
		}
	}
	if (Switch == 2)
		cout << endl;
}
public:int InsertAction()//输入控制
{
	char Key;
	int Temp;
	Key = _getch();
	if (Key == 'c' || Key == 'C')//如果输入了大小写的C则返回上一级
		return 3;
	if (FunctionNumbers == 0)
		return 0;
	if ((int)(Key - 48) > 0 && (int)(Key - 48) <= 9)//判断是否是从零到九的数字
	{
		if ((int)(Key - 48) > FunctionNumbers)//如果是,且小于等于选项总数则直接指定这个选项
			InitList(FunctionNumbers - 1);
		else
			InitList((int)(Key - 48) - 1);//如果超出了最大值,则指向最大值
		return 4;
	}
	else if (Key == 'w' || Key == 'W' || Key == 72)//如果输入了大小写的W或者上箭头,则执行MoveUp函数
	{
		MoveUp();
		return 0;
	}
	else if (Key == 's' || Key == 'S' || Key == 80)//如果输入了大小写的S或者下箭头,则执行MoveDown函数
	{
		MoveDown();
		return 0;
	}
	else if (Key == 'a' || Key == 'A' || Key == 75)//如果输入了大小写的A或者左箭头,则执行向上翻页函数
	{
		if (Page == GetPages() && GetPages() == 1)
		{
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[0] = 1;
		}
		else if (Page != 1)
		{
			Page--;
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[Temp - LimitListEachPage] = 1;
		}
		else
		{
			Page = GetPages();
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[(Page - 1) * LimitListEachPage] = 1;
		}
		return 0;
	}
	else if (Key == 'd' || Key == 'D' || Key == 77)//如果输入了大小写的D或者右箭头,则执行向下翻页函数
	{
		if (Page == GetPages() && GetPages() == 1)
		{
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[FunctionNumbers - 1] = 1;
		}
		else if (Page != GetPages())
		{
			Page++;
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			if (Temp + LimitListEachPage >= FunctionNumbers - 1)
				ListStatus[FunctionNumbers - 1] = 1;
			else
				ListStatus[Temp + LimitListEachPage] = 1;
		}
		else
		{
			Page = 1;
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[Temp % LimitListEachPage] = 1;
		}
		return 0;
	}
	else if (Key == 'z' || Key == 'Z')//保留原功能的情况下,预留两个用户自定义返回值
	{
		return 1;
	}
	else if (Key == 'x' || Key == 'X')
	{
		return 2;
	}
	else if (Key == '\r')//回车确认
		return 4;
	return 0;
}
public:void MoveUp()//选项上移
{
	int i = CheckCurrent();//找到当前指向的选项
	if (i == 0 && FunctionNumbers == 1)//如果只有一个选项则不变
		ListStatus[i] = 1;
	else if (i == 0 && FunctionNumbers != 1)//如果指向第一个且不止包含一个选项,则改为指向最下方的选项
	{
		ListStatus[i] = 0;
		Page = GetPages();
		ListStatus[FunctionNumbers - 1] = 1;
	}
	else if ((i + 1) % LimitListEachPage == 1)//如果指向某一页面的第一项则翻页,并指向前一页的最后一项
	{
		if (Page != 1)
		{
			Page--;
			ListStatus[i] = 0;
			ListStatus[i - 1] = 1;
		}
		else
		{
			Page = GetPages();
			ListStatus[i] = 0;
			ListStatus[FunctionNumbers - 1] = 1;
		}
	}
	else//正常情况
	{
		ListStatus[i] = 0;
		ListStatus[i - 1] = 1;
	}
}
public:void MoveDown()//选项下移
{
	int i = CheckCurrent();//找到当前指向的选项
	if (i == 0 && FunctionNumbers == 1)//如果只有一个选项则不变
		ListStatus[i] = 1;
	else if (i != 0 && i == FunctionNumbers - 1)//如果指向最后一个且不止包含一个选项,则改为指向最上方的选项
	{
		ListStatus[FunctionNumbers - 1] = 0;
		Page = 1;
		ListStatus[0] = 1;
	}
	else if ((i + 1) % LimitListEachPage == 0)//如果指向某一页面的最后一项则翻页,并指向下一页的第一项
	{
		if (Page != GetPages())
		{
			Page++;
			ListStatus[i] = 0;
			ListStatus[i + 1] = 1;
		}
		else
		{
			Page = 1;
			ListStatus[i] = 0;
			ListStatus[0] = 1;
		}
	}
	else//正常情况
	{
		ListStatus[i] = 0;
		ListStatus[i + 1] = 1;
	}
}
public:int CheckCurrent()//找到当前指向的选项  当找不到时返回-1
{
	for (int j = 0; j < FunctionNumbers; j++)
	{
		if (ListStatus[j] == 1)
			return j;
	}
	return -1;
}
public:void Append(string FunctionName, int Times = 1)//List数组添加String成员
{
	if (Times != 0)
		return;
	List[FunctionNumbers] = FunctionName;
	FunctionNumbers += 1;//成员计数器
}
public:void SetMaxList(int List)
{
	LimitListEachPage = List;
}
public:void RemoveAll()//移除所有成员(在04.h版本中为重要功能,05.h中被Times计数器取代)
{
	for (int i = 0; i < 10; i++)
	{
		List[i] = {};
		FunctionNumbers = 0;
	}
}
public:int GetPages()//获取总页面数
{
	if (FunctionNumbers % LimitListEachPage != 0)
		Pages = FunctionNumbers / LimitListEachPage + 1;
	else
		Pages = FunctionNumbers / LimitListEachPage;
	return Pages;
}
public:int GetLimitList()
{
	return LimitListEachPage;
}
private:int Pages{ 1 };
private:int LimitListEachPage{ 9 };
private:string List[50]{};//存放选项名称
private:int ListStatus[50]{ -1 };//存放选项状态
private:int TempCol{ 6 };
private:int SelectedCol{ 7 };
private:int UnSelectedCol{ 1 };
public:int DefaultCol{ 1 };
};
inline void Free(FunctionList* Fun)//释放指针
{
	delete Fun;
	Fun = NULL;
}
struct ICUF_Function//函数指针
{
	FunctionList Fun_Name;
	void (*Fun)();
};
#endif

ICUF2 0.00.01.64

// ICUF 2.0 - 0.00.01.64  2021/7/26 17:45  8818 字数 483 行数
// 新增物品的种类属性并引入枚举类型作为状态值
// 在功能完善后会将所有类定义分离到单独的头文件中

#include <time.h>
#include "ICUF_HEAD_06+.h"
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
int LengthOfData{};
void BuyingCargo(int Id);
void SearchDealShow();
void SearchDealById();
void Init();
void ChangeSingle();
void AddNewData();
void DefaultData();
void RemoveData();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
enum ICUF_Type_Status
{
	UnknownType = 0,
	WeaponType,
	StickerType,
	CasesType,
	AgentType
};
class ICUF_Type
{
	virtual void SetCargoType(int i = 0) = 0;
	virtual string GetCargoType() = 0;
};
class ICUF_Skin :ICUF_Type
{
public:void SetCargoType(int i = 0)
{
	switch (i)
	{
	case 0:Type = UnknownType; break;
	case 1:Type = WeaponType; break;
	case 2:Type = StickerType; break;
	case 3:Type = CasesType; break;
	case 4:Type = AgentType; break;
	default:Type = UnknownType;
	}
}
public:string GetCargoType()
{
	return Type;
}
public:
	int ICUF_Id{ 0 };
	string ICUF_Name{};
	string ICUF_Float{};
	double ICUF_Price{};
private:
	string Type{};
};
ICUF_Skin ISD[30];
class ICUF_Data
{
public:
	void SaveSkinData()
	{
		fout.open(SDL);
		for (int i = 0; i < 30; i++)
		{
			if (ISD[i].ICUF_Id == 0)
			{
				LengthOfData = i;
				break;
			}
			fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
		}
		fout.close();
	}
	void GetSkinData()
	{
		fin.open(SDL);
		for (int i = 0; i < 30; i++)
		{
			fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
		}
		fin.close();
	}
	int GetLength()
	{
		return LengthOfData;
	}
	void RemoveData()
	{
		remove(SDL);
		remove(Deals);
	}
private:
	int LengthOfData{};
};
ICUF_Data Data;
int main()
{
	Init();
	MainPage.Append("购买商品", MainPage.Times);
	MainPage.Append("查询订单", MainPage.Times);
	MainPage.Append("系统管理", MainPage.Times);
	MainPage.Append("退出系统", MainPage.Times++);
	FunctionList* F = &MainPage;
	FunctionList* T = NULL;
	MainPage.InitList();
	int Temp = MainPage.FunctionNumbers;
	while (1)
	{
		system("cls");
		Col(MainPage.DefaultCol); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
		MainPage.DisplayList(0, Temp, 1);
		if (T != NULL)
		{
			T->DisplayList(0, 9, 2);
		}
		MainPage.DisplayList(Temp, MainPage.FunctionNumbers);
		int i = F->InsertAction();
		if (i == 3)
		{
			T = NULL;
			F = &MainPage;
		}
		else if (i == 4)
		{
			int i = F->CheckCurrent();
			if (i == 0 && F == &MainPage)
			{
				Data.GetSkinData();//读取本地文件数据
				Data.SaveSkinData();
				if (BuyPage.TempTimes != 0)
					BuyPage.RemoveAll();
				for (int i = 0; i < Data.GetLength(); i++)//使用头文件方法给列表添加物品
					BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
				BuyPage.Times++;
				BuyPage.RecoverTimes();
				BuyPage.InitList();
				Temp = i + 1;
				T = &BuyPage;
				F = &BuyPage;
			}
			else if (i == 1 && F == &MainPage)
			{
				SearchDPage.Append("1.查询所有", SearchDPage.Times);
				SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
				SearchDPage.InitList();
				Temp = i + 1;
				T = &SearchDPage;
				F = &SearchDPage;
			}
			else if (i == 2 && F == &MainPage)
			{
				ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
				ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
				ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
				ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
				ChangeDPage.InitList();
				Temp = i + 1;
				T = &ChangeDPage;
				F = &ChangeDPage;
			}
			else if (i == 3 && F == &MainPage)
				exit(1);
			else if (F == &BuyPage)
			{
				BuyingCargo(i);
			}
			else if (F == &SearchDPage)
			{
				if (i == 0)
					SearchDealShow();
				else if (i == 1)
					SearchDealById();
			}
			else if (F == &ChangeDPage)
			{
				if (i == 0)//更改单一数据功能
					ChangeSingle();
				else if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
					AddNewData();
				else if (i == 2)//系统初始数据
					DefaultData();
				else if (i == 3)//删除所有本地数据
					RemoveData();
			}
		}
	}
	Free(F);
}
void BuyingCargo(int Id)
{
	BuyingPage.Append("继续", BuyingPage.Times);
	BuyingPage.Append("返回", BuyingPage.Times++);
	BuyingPage.InitList();
	while (1)
	{
		system("cls");
		Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
		Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
		Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
		Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
		Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
		BuyingPage.DisplayList();
		int i = BuyingPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyingPage.CheckCurrent();
			if (i == 1)
				main();
			else
			{
				cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
				int Number;
				cin >> Number;
				srand(time(NULL));
				int List = ((rand() % 9) + 1) * 100000 + ((rand() % 9) + 1) * 10000 + ((rand() % 9) + 1) * 1000 + ((rand() % 9) + 1) * 100 + ((rand() % 9) + 1) * 10 + ((rand() % 9) + 1);
				fout.close();
				fout.open(Deals, ios::app);
				fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
				fout.close();
				cout << "购买成功  你的购买订单号为 " << List << endl;
				cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
				system("pause");
				main();
			}
		}
	}
}
void SearchDealById()
{
	int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	Col(8); cout << "请输入要查询的订单号 : ";
	cin >> list; Col(0);
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

	}
	fout.close();
	int flag{};
	Col(8);
	for (int j = 0; j < DataLength; j++)
	{
		if (List[j] == list)
		{
			cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
			flag = 1;
		}
		if (flag == 0 && j == DataLength - 1)
			cout << "不存在此订单!"; Col(0);
	}
	if (DataLength == 0)
		cout << "当前不存在任何已储存订单" << endl; Col(0);
	system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
	int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
		Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
	}
	fout.close();
	system("pause");
}
void Init()//用于判断执行次数并进行更新
{
	Data.GetSkinData();//读取本地文件数据
	Data.SaveSkinData();
	if (BuyPage.TempTimes != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < Data.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
	BuyPage.Times++;
	BuyPage.ResetTimes();
}
void ChangeSingle()//更改单一数据功能
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	int ISD_Id, ISD_Fun;
	Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
	cin >> ISD_Id; Col(0);
	SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
	SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
	SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
	SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
	SetPage.InitList();
	while (1)
	{
		system("cls");
		Col(SetPage.DefaultCol); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
		SetPage.DisplayList();
		int i = SetPage.InsertAction();
		if (i == 3)
		{
			main();
		}
		else if (i == 4)
		{
			int i = SetPage.CheckCurrent();
			ISD_Fun = i + 1;
			break;
		}
	}
	Col(1); cout << "请输入修改后的内容 :  ";
	switch (ISD_Fun)
	{
	case 1:
		/*cin >> ISD[ISD_Id].ICUF_Id;*/
		Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
		break;
	case 2:
		cin >> ISD[ISD_Id - 1].ICUF_Name;
		break;
	case 3:
		cin >> ISD[ISD_Id - 1].ICUF_Float;
		break;
	case 4:
		cin >> ISD[ISD_Id - 1].ICUF_Price;
		break;
	}
	Col(0);
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void AddNewData()//从头开始修改数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	int breakword{};
	system("cls");
	for (int i = BuyPage.FunctionNumbers; i < 30; i++)
	{
		Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
		ISD[i].ICUF_Id = i + 1;
		Col(8); cout << "请输入 ICUF_Name (string) :";
		cin >> ISD[i].ICUF_Name; Col(0);
		Col(8); cout << "请输入 ICUF_Float (string) :";
		cin >> ISD[i].ICUF_Float; Col(0);
		Col(8); cout << "请输入 ICUF_Price (double) :";
		cin >> ISD[i].ICUF_Price; Col(0);
		SetPage.Append("1.继续", SetPage.Times);
		SetPage.Append("2.退出", SetPage.Times++);
		SetPage.InitList();
		while (1)
		{
			system("cls");
			for (int j = 0; j <= i; j++)
			{
				Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
				ISD[j].ICUF_Id = j + 1;
				Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
				Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
				Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
			}
			SetPage.DisplayList();
			int i = SetPage.InsertAction();
			if (i == 3)
			{
				main();
			}
			else if (i == 4)
			{
				int i = SetPage.CheckCurrent();
				if (i == 0)
				{
					breakword = 0;
					break;
				}
				else if (i == 1)
				{
					LengthOfData = i;
					breakword = 1;
					break;
				}
			}
		}
		if (breakword == 1)
			break;
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void DefaultData()//系统初始数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	Data.RemoveData();
	for (int i = 0; i < 30; i++)
	{
		if (i == 0)
		{
			ISD[0].ICUF_Id = 1;
			ISD[0].ICUF_Name = "地下水";
			ISD[0].ICUF_Float = "久经沙场";
			ISD[0].ICUF_Price = 0.2;
		}
		else if (i == 1)
		{
			ISD[1].ICUF_Id = 2;
			ISD[1].ICUF_Name = "地下水";
			ISD[1].ICUF_Float = "略有磨损";
			ISD[1].ICUF_Price = 0.3;
		}
		else if (i == 2)
		{
			ISD[2].ICUF_Id = 3;
			ISD[2].ICUF_Name = "地下水";
			ISD[2].ICUF_Float = "崭新出厂";
			ISD[2].ICUF_Price = 0.4;
		}
		else if (i == 3)
		{
			ISD[3].ICUF_Id = 4;
			ISD[3].ICUF_Name = "狩猎网格";
			ISD[3].ICUF_Float = "久经沙场";
			ISD[3].ICUF_Price = 0.5;
		}
		else
		{
			ISD[i].ICUF_Id = NULL;
			ISD[i].ICUF_Name = "";
			ISD[i].ICUF_Float = "";
			ISD[i].ICUF_Price = NULL;
		}
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}
void RemoveData()//删除所有本地数据
{
	Data.RemoveData();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		ISD[i].ICUF_Id = NULL;
		ISD[i].ICUF_Name = "";
		ISD[i].ICUF_Float = "";
		ISD[i].ICUF_Price = NULL;
	}
	Data.SaveSkinData();
	BuyPage.ResetTimes();
}

ICUF2 0.00.01.63

// ICUF 2.0 - 0.00.01.63  2021/7/21 20:26  8437 字数 450 行数
// 完成所有二级索引都在主页显示

#include <time.h>
#include "ICUF_HEAD_06.h"
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
int LengthOfData{};
void BuyingCargo(int Id);
void SearchDealShow();
void SearchDealById();
void Init();
void ChangeSingle();
void AddNewData();
void DefaultData();
void RemoveData();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
struct ICUF_SkinData
{
	int ICUF_Id{ 0 };
	string ICUF_Name{};
	string ICUF_Float{};
	double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage2, SetPage4;
public: void SaveSkinData()
{
	fout.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	fout.close();
}
public: void GetSkinData()
{
	fin.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
	}
	fin.close();
}
public:int GetLength()
{
	return LengthOfData;
}
public: void RemoveData()
{
	remove(SDL);
	remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
	Init();
	MainPage.Append("购买商品", MainPage.Times);
	MainPage.Append("查询订单", MainPage.Times);
	MainPage.Append("系统管理", MainPage.Times);
	MainPage.Append("退出系统", MainPage.Times++);
	FunctionList* F = &MainPage;
	FunctionList* T = NULL;
	MainPage.InitList();
	int Temp = MainPage.FunctionNumbers;
	while (1)
	{
		system("cls");
		Col(MainPage.DefaultCol); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
		MainPage.DisplayList(0, Temp, 1);
		if (T != NULL)
		{
			T->DisplayList(0, 9, 2);
		}
		MainPage.DisplayList(Temp, MainPage.FunctionNumbers);
		int i = F->InsertAction();
		if (i == 3)
		{
			T = NULL;
			F = &MainPage;
		}
		else if (i == 4)
		{
			int i = F->CheckCurrent();
			if (i == 0 && F == &MainPage)
			{
				skin.GetSkinData();//读取本地文件数据
				skin.SaveSkinData();
				if (BuyPage.TempTimes != 0)
					BuyPage.RemoveAll();
				for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
					BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
				BuyPage.Times++;
				BuyPage.RecoverTimes();
				BuyPage.InitList();
				Temp = i + 1;
				T = &BuyPage;
				F = &BuyPage;
			}
			else if (i == 1 && F == &MainPage)
			{
				SearchDPage.Append("1.查询所有", SearchDPage.Times);
				SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
				SearchDPage.InitList();
				Temp = i + 1;
				T = &SearchDPage;
				F = &SearchDPage;
			}
			else if (i == 2 && F == &MainPage)
			{
				ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
				ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
				ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
				ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
				ChangeDPage.InitList();
				Temp = i + 1;
				T = &ChangeDPage;
				F = &ChangeDPage;
			}
			else if (i == 3 && F == &MainPage)
				exit(1);
			else if (F == &BuyPage)
			{
				BuyingCargo(i);
			}
			else if (F == &SearchDPage)
			{
				if (i == 0)
					SearchDealShow();
				else if (i == 1)
					SearchDealById();
			}
			else if (F == &ChangeDPage)
			{
				if (i == 0)//更改单一数据功能
					ChangeSingle();
				else if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
					AddNewData();
				else if (i == 2)//系统初始数据
					DefaultData();
				else if (i == 3)//删除所有本地数据
					RemoveData();
			}
		}
	}
	Free(F);
}
void BuyingCargo(int Id)
{
	BuyingPage.Append("继续", BuyingPage.Times);
	BuyingPage.Append("返回", BuyingPage.Times++);
	BuyingPage.InitList();
	while (1)
	{
		system("cls");
		Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
		Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
		Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
		Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
		Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
		BuyingPage.DisplayList();
		int i = BuyingPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyingPage.CheckCurrent();
			if (i == 1)
				main();
			else
			{
				cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
				int Number;
				cin >> Number;
				srand(time(NULL));
				int List = ((rand() % 9) + 1) * 100000 + ((rand() % 9) + 1) * 10000 + ((rand() % 9) + 1) * 1000 + ((rand() % 9) + 1) * 100 + ((rand() % 9) + 1) * 10 + ((rand() % 9) + 1);
				fout.close();
				fout.open(Deals, ios::app);
				fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
				fout.close();
				cout << "购买成功  你的购买订单号为 " << List << endl;
				cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
				system("pause");
				main();
			}
		}
	}
}
void SearchDealById()
{
	int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	Col(8); cout << "请输入要查询的订单号 : ";
	cin >> list; Col(0);
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

	}
	fout.close();
	int flag{};
	Col(8);
	for (int j = 0; j < DataLength; j++)
	{
		if (List[j] == list)
		{
			cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
			flag = 1;
		}
		if (flag == 0 && j == DataLength - 1)
			cout << "不存在此订单!"; Col(0);
	}
	if (DataLength == 0)
		cout << "当前不存在任何已储存订单" << endl; Col(0);
	system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
	int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
		Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
	}
	fout.close();
	system("pause");
}
void Init()//用于判断执行次数并进行更新
{
	skin.GetSkinData();//读取本地文件数据
	skin.SaveSkinData();
	if (BuyPage.TempTimes != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
	BuyPage.Times++;
	BuyPage.ResetTimes();
}
void ChangeSingle()//更改单一数据功能
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	int ISD_Id, ISD_Fun;
	Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
	cin >> ISD_Id; Col(0);
	SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
	SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
	SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
	SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
	SetPage.InitList();
	while (1)
	{
		system("cls");
		Col(SetPage.DefaultCol); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
		SetPage.DisplayList();
		int i = SetPage.InsertAction();
		if (i == 3)
		{
			main();
		}
		else if (i == 4)
		{
			int i = SetPage.CheckCurrent();
			ISD_Fun = i + 1;
			break;
		}
	}
	Col(1); cout << "请输入修改后的内容 :  ";
	switch (ISD_Fun)
	{
	case 1:
		/*cin >> ISD[ISD_Id].ICUF_Id;*/
		Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
		break;
	case 2:
		cin >> ISD[ISD_Id - 1].ICUF_Name;
		break;
	case 3:
		cin >> ISD[ISD_Id - 1].ICUF_Float;
		break;
	case 4:
		cin >> ISD[ISD_Id - 1].ICUF_Price;
		break;
	}
	Col(0);
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}
void AddNewData()//从头开始修改数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	int breakword{};
	system("cls");
	for (int i = BuyPage.FunctionNumbers; i < 30; i++)
	{
		Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
		ISD[i].ICUF_Id = i + 1;
		Col(8); cout << "请输入 ICUF_Name (string) :";
		cin >> ISD[i].ICUF_Name; Col(0);
		Col(8); cout << "请输入 ICUF_Float (string) :";
		cin >> ISD[i].ICUF_Float; Col(0);
		Col(8); cout << "请输入 ICUF_Price (double) :";
		cin >> ISD[i].ICUF_Price; Col(0);
		SetPage.Append("1.继续", SetPage.Times);
		SetPage.Append("2.退出", SetPage.Times++);
		SetPage.InitList();
		while (1)
		{
			system("cls");
			for (int j = 0; j <= i; j++)
			{
				Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
				ISD[j].ICUF_Id = j + 1;
				Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
				Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
				Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
			}
			SetPage.DisplayList();
			int i = SetPage.InsertAction();
			if (i == 3)
			{
				main();
			}
			else if (i == 4)
			{
				int i = SetPage.CheckCurrent();
				if (i == 0)
				{
					breakword = 0;
					break;
				}
				else if (i == 1)
				{
					LengthOfData = i;
					breakword = 1;
					break;
				}
			}
		}
		if (breakword == 1)
			break;
	}
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}
void DefaultData()//系统初始数据
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	skin.RemoveData();
	for (int i = 0; i < 30; i++)
	{
		if (i == 0)
		{
			ISD[0].ICUF_Id = 1;
			ISD[0].ICUF_Name = "地下水";
			ISD[0].ICUF_Float = "久经沙场";
			ISD[0].ICUF_Price = 0.2;
		}
		else if (i == 1)
		{
			ISD[1].ICUF_Id = 2;
			ISD[1].ICUF_Name = "地下水";
			ISD[1].ICUF_Float = "略有磨损";
			ISD[1].ICUF_Price = 0.3;
		}
		else if (i == 2)
		{
			ISD[2].ICUF_Id = 3;
			ISD[2].ICUF_Name = "地下水";
			ISD[2].ICUF_Float = "崭新出厂";
			ISD[2].ICUF_Price = 0.4;
		}
		else if (i == 3)
		{
			ISD[3].ICUF_Id = 4;
			ISD[3].ICUF_Name = "狩猎网格";
			ISD[3].ICUF_Float = "久经沙场";
			ISD[3].ICUF_Price = 0.5;
		}
		else
		{
			ISD[i].ICUF_Id = NULL;
			ISD[i].ICUF_Name = "";
			ISD[i].ICUF_Float = "";
			ISD[i].ICUF_Price = NULL;
		}
	}
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}
void RemoveData()//删除所有本地数据
{
	skin.RemoveData();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		ISD[i].ICUF_Id = NULL;
		ISD[i].ICUF_Name = "";
		ISD[i].ICUF_Float = "";
		ISD[i].ICUF_Price = NULL;
	}
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}

ICUF2 0.00.01.62

// ICUF 2.0 - 0.00.01.62  2021/7/18 22:21  8694 字数 465 行数 
//已收集到部分信息用于改进ICUF2
//将查询订单的显示列表的函数整合到主函数
//将系统管理的功能从函数中拆分

#include <iostream>
#include <fstream>
#include <string>
#include <time.h>
#include "ICUF_HEAD_06.h"
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
int LengthOfData{};
void BuyingCargo(int Id);
void ChangeData();
void SearchDealShow();
void SearchDealById();
void Init();
void ChangeSingle();
void AddNewData();
void DefaultData();
void RemoveData();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
struct ICUF_SkinData
{
	int ICUF_Id{ 0 };
	string ICUF_Name{};
	string ICUF_Float{};
	double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage2, SetPage4;
public: void SaveSkinData()
{
	fout.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	fout.close();
}
public: void GetSkinData()
{
	fin.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
	}
	fin.close();
}
public:int GetLength()
{
	return LengthOfData;
}
public: void RemoveData()
{
	remove(SDL);
	remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
	Init();
	MainPage.Append("购买商品", MainPage.Times);
	MainPage.Append("查询订单", MainPage.Times);
	MainPage.Append("系统管理", MainPage.Times);
	MainPage.Append("退出系统", MainPage.Times++);
	FunctionList* F = &MainPage;
	FunctionList* T = NULL;
	MainPage.InitList();
	int Temp = MainPage.FunctionNumbers;
	while (1)
	{
		system("cls");
		Col(MainPage.DefaultCol); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
		MainPage.DisplayList(0, Temp, 1);
		if (T != NULL)
		{
			T->DisplayList(0, 9, 2);
		}
		MainPage.DisplayList(Temp, MainPage.FunctionNumbers);
		int i = F->InsertAction();
		if (i == 3)
		{
			T = NULL;
			F = &MainPage;
		}
		else if (i == 4)
		{
			int i = F->CheckCurrent();
			if (i == 0 && F == &MainPage)
			{
				skin.GetSkinData();//读取本地文件数据
				skin.SaveSkinData();
				if (BuyPage.TempTimes != 0)
					BuyPage.RemoveAll();
				for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
					BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
				BuyPage.Times++;
				BuyPage.RecoverTimes();
				BuyPage.InitList();
				Temp = i + 1;
				T = &BuyPage;
				F = &BuyPage;
			}
			else if (i == 1 && F == &MainPage)
			{
				SearchDPage.Append("1.查询所有", SearchDPage.Times);
				SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
				SearchDPage.InitList();
				Temp = i + 1;
				T = &SearchDPage;
				F = &SearchDPage;
			}
			else if (i == 2 && F == &MainPage)
				ChangeData();
			else if (i == 3 && F == &MainPage)
				exit(1);
			else if (F == &BuyPage)
			{
				BuyingCargo(i);
			}
			else if (F == &SearchDPage)
			{
				if (i == 0)
					SearchDealShow();
				else if (i == 1)
					SearchDealById();
			}
		}
	}
	Free(F);
}
void BuyingCargo(int Id)
{
	BuyingPage.Append("继续", BuyingPage.Times);
	BuyingPage.Append("返回", BuyingPage.Times++);
	BuyingPage.InitList();
	while (1)
	{
		system("cls");
		Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
		Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
		Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
		Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
		Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
		BuyingPage.DisplayList();
		int i = BuyingPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyingPage.CheckCurrent();
			if (i == 1)
				main();
			else
			{
				cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
				int Number;
				cin >> Number;
				srand(time(NULL));
				int List = ((rand() % 9) + 1) * 100000 + ((rand() % 9) + 1) * 10000 + ((rand() % 9) + 1) * 1000 + ((rand() % 9) + 1) * 100 + ((rand() % 9) + 1) * 10 + ((rand() % 9) + 1);
				fout.close();
				fout.open(Deals, ios::app);
				fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
				fout.close();
				cout << "购买成功  你的购买订单号为 " << List << endl;
				cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
				system("pause");
				main();
			}
		}
	}
}
void ChangeData()
{
	ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
	ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
	ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
	ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
	ChangeDPage.InitList();
	while (1)
	{
		system("cls");
		Col(ChangeDPage.DefaultCol); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
		ChangeDPage.DisplayList();
		int i = ChangeDPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = ChangeDPage.CheckCurrent();
			skin.GetSkinData();
			if (i == 0)//更改单一数据功能
				ChangeSingle();
			if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
				AddNewData();
			if (i == 2)//系统初始数据
				DefaultData();
			if (i == 3)//删除所有本地数据
				RemoveData();
		}
	}
}
void SearchDealById()
{
	int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	Col(8); cout << "请输入要查询的订单号 : ";
	cin >> list; Col(0);
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

	}
	fout.close();
	int flag{};
	Col(8);
	for (int j = 0; j < DataLength; j++)
	{
		if (List[j] == list)
		{
			cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
			flag = 1;
		}
		if (flag == 0 && j == DataLength - 1)
			cout << "不存在此订单!"; Col(0);
	}
	if (DataLength == 0)
		cout << "当前不存在任何已储存订单" << endl; Col(0);
	system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
	int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
		Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
	}
	fout.close();
	system("pause");
}
void Init()//用于判断执行次数并进行更新
{
	skin.GetSkinData();//读取本地文件数据
	skin.SaveSkinData();
	if (BuyPage.TempTimes != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
	BuyPage.Times++;
	BuyPage.ResetTimes();
}
void ChangeSingle()
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	int ISD_Id, ISD_Fun;
	Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
	cin >> ISD_Id; Col(0);
	SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
	SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
	SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
	SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
	SetPage.InitList();
	while (1)
	{
		system("cls");
		Col(SetPage.DefaultCol); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
		SetPage.DisplayList();
		int i = SetPage.InsertAction();
		if (i == 3)
		{
			ChangeData();
		}
		else if (i == 4)
		{
			int i = SetPage.CheckCurrent();
			ISD_Fun = i + 1;
			break;
		}
	}
	Col(1); cout << "请输入修改后的内容 :  ";
	switch (ISD_Fun)
	{
	case 1:
		/*cin >> ISD[ISD_Id].ICUF_Id;*/
		Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
		break;
	case 2:
		cin >> ISD[ISD_Id - 1].ICUF_Name;
		break;
	case 3:
		cin >> ISD[ISD_Id - 1].ICUF_Float;
		break;
	case 4:
		cin >> ISD[ISD_Id - 1].ICUF_Price;
		break;
	}
	Col(0);
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}
void AddNewData()
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	int breakword{};
	system("cls");
	for (int i = BuyPage.FunctionNumbers; i < 30; i++)
	{
		Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
		ISD[i].ICUF_Id = i + 1;
		Col(8); cout << "请输入 ICUF_Name (string) :";
		cin >> ISD[i].ICUF_Name; Col(0);
		Col(8); cout << "请输入 ICUF_Float (string) :";
		cin >> ISD[i].ICUF_Float; Col(0);
		Col(8); cout << "请输入 ICUF_Price (double) :";
		cin >> ISD[i].ICUF_Price; Col(0);
		SetPage.Append("1.继续", SetPage.Times);
		SetPage.Append("2.退出", SetPage.Times++);
		SetPage.InitList();
		while (1)
		{
			system("cls");
			for (int j = 0; j <= i; j++)
			{
				Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
				ISD[j].ICUF_Id = j + 1;
				Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
				Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
				Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
			}
			SetPage.DisplayList();
			int i = SetPage.InsertAction();
			if (i == 3)
			{
				ChangeData();
			}
			else if (i == 4)
			{
				int i = SetPage.CheckCurrent();
				if (i == 0)
				{
					breakword = 0;
					break;
				}
				else if (i == 1)
				{
					LengthOfData = i;
					breakword = 1;
					break;
				}
			}
		}
		if (breakword == 1)
			break;
	}
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}
void DefaultData()
{
	SetPage.RemoveAll();
	SetPage.ResetTimes();
	skin.RemoveData();
	for (int i = 0; i < 30; i++)
	{
		if (i == 0)
		{
			ISD[0].ICUF_Id = 1;
			ISD[0].ICUF_Name = "地下水";
			ISD[0].ICUF_Float = "久经沙场";
			ISD[0].ICUF_Price = 0.2;
		}
		else if (i == 1)
		{
			ISD[1].ICUF_Id = 2;
			ISD[1].ICUF_Name = "地下水";
			ISD[1].ICUF_Float = "略有磨损";
			ISD[1].ICUF_Price = 0.3;
		}
		else if (i == 2)
		{
			ISD[2].ICUF_Id = 3;
			ISD[2].ICUF_Name = "地下水";
			ISD[2].ICUF_Float = "崭新出厂";
			ISD[2].ICUF_Price = 0.4;
		}
		else if (i == 3)
		{
			ISD[3].ICUF_Id = 4;
			ISD[3].ICUF_Name = "狩猎网格";
			ISD[3].ICUF_Float = "久经沙场";
			ISD[3].ICUF_Price = 0.5;
		}
		else
		{
			ISD[i].ICUF_Id = NULL;
			ISD[i].ICUF_Name = "";
			ISD[i].ICUF_Float = "";
			ISD[i].ICUF_Price = NULL;
		}
	}
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}
void RemoveData()
{
	skin.RemoveData();
	SetPage.ResetTimes();
	for (int i = 0; i < 30; i++)
	{
		ISD[i].ICUF_Id = NULL;
		ISD[i].ICUF_Name = "";
		ISD[i].ICUF_Float = "";
		ISD[i].ICUF_Price = NULL;
	}
	skin.SaveSkinData();
	BuyPage.ResetTimes();
}

ICUF2 0.00.01.61

利用指针很简单的就达到了1.44花费大量代码才能写出的效果。
在这里插入图片描述

// ICUF 2.0 - 0.00.01.61  2021/6/23 21:35  9296 字数 496 行数
// 购买商品功能现在能够直接在主页上显示列表
// 在主页的控制函数应用了指针操作的方式

#include <iostream>
#include <fstream>
#include <string>
#include <time.h>
#include "ICUF_HEAD_06.h"
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
void BuyCargo(int Id = 0);
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal();
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
struct ICUF_SkinData
{
	int ICUF_Id{ 0 };
	string ICUF_Name{};
	string ICUF_Float{};
	double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage2, SetPage4;
public: void SaveSkinData()
{
	fout.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	fout.close();
}
public: void GetSkinData()
{
	fin.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
	}
	fin.close();
}
public:int GetLength()
{
	return LengthOfData;
}
public: void RemoveData()
{
	remove(SDL);
	remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
	Init();
	MainPage.Append("购买商品", MainPage.Times);
	MainPage.Append("查询订单", MainPage.Times);
	MainPage.Append("系统管理", MainPage.Times);
	MainPage.Append("退出系统", MainPage.Times++);
	FunctionList* F = &MainPage;
	FunctionList* T = NULL;
	MainPage.InitList();
	int Temp = MainPage.FunctionNumbers;
	while (1)
	{
		system("cls");
		Col(MainPage.DefaultCol); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
		MainPage.DisplayList(0, Temp, 1);
		if (T != NULL)
		{
			T->DisplayList(0, T->FunctionNumbers, 2);
		}
		MainPage.DisplayList(Temp, MainPage.FunctionNumbers);
		int i = F->InsertAction();
		if (i == 3)
		{
			T = NULL;
			F = &MainPage;
		}
		else if (i == 4)
		{
			int i = F->CheckCurrent();
			if (i == 0 && F == &MainPage)
			{
				skin.GetSkinData();//读取本地文件数据
				skin.SaveSkinData();
				if (BuyPage.TempTimes != 0)
					BuyPage.RemoveAll();
				for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
					BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
				BuyPage.Times++;
				BuyPage.RecoverTimes();
				BuyPage.InitList();
				Temp = i + 1;
				T = &BuyPage;
				F = &BuyPage;
			}
			else if (i == 1 && F == &MainPage)
				SearchDeal();
			else if (i == 2 && F == &MainPage)
				ChangeData();
			else if (i == 3 && F == &MainPage)
				exit(1);
			else if (F == &BuyPage)
			{
				BuyingCargo(i);
			}
		}
	}
	delete F;
}
void BuyCargo(int Id)//购买商品主页面
{
	skin.GetSkinData();//读取本地文件数据
	skin.SaveSkinData();
	if (BuyPage.TempTimes != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
	BuyPage.Times++;
	BuyPage.RecoverTimes();
	BuyPage.InitList(Id);
	while (1)
	{
		system("cls");
		Col(BuyPage.DefaultCol); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
		BuyPage.DisplayList();
		int i = BuyPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyPage.CheckCurrent();
			BuyingCargo(i);
		}
	}
}
void BuyingCargo(int Id)
{
	BuyingPage.Append("继续", BuyingPage.Times);
	BuyingPage.Append("返回", BuyingPage.Times++);
	BuyingPage.InitList();
	while (1)
	{
		system("cls");
		Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
		Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
		Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
		Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
		Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
		BuyingPage.DisplayList();
		int i = BuyingPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyingPage.CheckCurrent();
			if (i == 1)
				main();
			else
			{
				cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
				int Number;
				cin >> Number;
				srand(time(NULL));
				int List = ((rand() % 9) + 1) * 100000 + ((rand() % 9) + 1) * 10000 + ((rand() % 9) + 1) * 1000 + ((rand() % 9) + 1) * 100 + ((rand() % 9) + 1) * 10 + ((rand() % 9) + 1);
				fout.close();
				fout.open(Deals, ios::app);
				fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
				fout.close();
				cout << "购买成功  你的购买订单号为 " << List << endl;
				cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
				system("pause");
				main();
			}
		}
	}
}
void ChangeData()
{
	int LengthOfData{};
	ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
	ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
	ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
	ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
	ChangeDPage.InitList();
	while (1)
	{
		system("cls");
		Col(ChangeDPage.DefaultCol); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
		ChangeDPage.DisplayList();
		int i = ChangeDPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = ChangeDPage.CheckCurrent();
			skin.GetSkinData();
			if (i == 0)//更改单一数据功能
			{
				SetPage.RemoveAll();
				SetPage.ResetTimes();
				for (int i = 0; i < 30; i++)
				{
					if (ISD[i].ICUF_Id == 0)
					{
						LengthOfData = i;
						break;
					}
					cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
				}
				int ISD_Id, ISD_Fun;
				Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
				cin >> ISD_Id; Col(0);
				SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
				SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
				SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
				SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
				SetPage.InitList();
				while (1)
				{
					system("cls");
					Col(SetPage.DefaultCol); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
					SetPage.DisplayList();
					int i = SetPage.InsertAction();
					if (i == 3)
					{
						ChangeData();
					}
					else if (i == 4)
					{
						int i = SetPage.CheckCurrent();
						ISD_Fun = i + 1;
						break;
					}
				}
				Col(1); cout << "请输入修改后的内容 :  ";
				switch (ISD_Fun)
				{
				case 1:
					/*cin >> ISD[ISD_Id].ICUF_Id;*/
					Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
					break;
				case 2:
					cin >> ISD[ISD_Id - 1].ICUF_Name;
					break;
				case 3:
					cin >> ISD[ISD_Id - 1].ICUF_Float;
					break;
				case 4:
					cin >> ISD[ISD_Id - 1].ICUF_Price;
					break;
				}
				Col(0);
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
			if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
			{
				SetPage.RemoveAll();
				SetPage.ResetTimes();
				int breakword{};
				system("cls");
				for (int i = BuyPage.FunctionNumbers; i < 30; i++)
				{
					Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
					ISD[i].ICUF_Id = i + 1;
					Col(8); cout << "请输入 ICUF_Name (string) :";
					cin >> ISD[i].ICUF_Name; Col(0);
					Col(8); cout << "请输入 ICUF_Float (string) :";
					cin >> ISD[i].ICUF_Float; Col(0);
					Col(8); cout << "请输入 ICUF_Price (double) :";
					cin >> ISD[i].ICUF_Price; Col(0);
					SetPage.Append("1.继续", SetPage.Times);
					SetPage.Append("2.退出", SetPage.Times++);
					SetPage.InitList();
					while (1)
					{
						system("cls");
						for (int j = 0; j <= i; j++)
						{
							Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
							ISD[j].ICUF_Id = j + 1;
							Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
							Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
							Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
						}
						SetPage.DisplayList();
						int i = SetPage.InsertAction();
						if (i == 3)
						{
							ChangeData();
						}
						else if (i == 4)
						{
							int i = SetPage.CheckCurrent();
							if (i == 0)
							{
								breakword = 0;
								break;
							}
							else if (i == 1)
							{
								LengthOfData = i;
								breakword = 1;
								break;
							}
						}
					}
					if (breakword == 1)
						break;
				}
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
			if (i == 2)//系统初始数据
			{
				SetPage.RemoveAll();
				SetPage.ResetTimes();
				skin.RemoveData();
				for (int i = 0; i < 30; i++)
				{
					if (i == 0)
					{
						ISD[0].ICUF_Id = 1;
						ISD[0].ICUF_Name = "地下水";
						ISD[0].ICUF_Float = "久经沙场";
						ISD[0].ICUF_Price = 0.2;
					}
					else if (i == 1)
					{
						ISD[1].ICUF_Id = 2;
						ISD[1].ICUF_Name = "地下水";
						ISD[1].ICUF_Float = "略有磨损";
						ISD[1].ICUF_Price = 0.3;
					}
					else if (i == 2)
					{
						ISD[2].ICUF_Id = 3;
						ISD[2].ICUF_Name = "地下水";
						ISD[2].ICUF_Float = "崭新出厂";
						ISD[2].ICUF_Price = 0.4;
					}
					else if (i == 3)
					{
						ISD[3].ICUF_Id = 4;
						ISD[3].ICUF_Name = "狩猎网格";
						ISD[3].ICUF_Float = "久经沙场";
						ISD[3].ICUF_Price = 0.5;
					}
					else
					{
						ISD[i].ICUF_Id = NULL;
						ISD[i].ICUF_Name = "";
						ISD[i].ICUF_Float = "";
						ISD[i].ICUF_Price = NULL;
					}
				}
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
			if (i == 3)
			{
				skin.RemoveData();
				SetPage.ResetTimes();
				for (int i = 0; i < 30; i++)
				{
					ISD[i].ICUF_Id = NULL;
					ISD[i].ICUF_Name = "";
					ISD[i].ICUF_Float = "";
					ISD[i].ICUF_Price = NULL;
				}
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
		}
	}
}
void SearchDeal()
{
	SearchDPage.Append("1.查询所有", SearchDPage.Times);
	SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
	SearchDPage.InitList();
	while (1)
	{
		system("cls");
		Col(SearchDPage.DefaultCol); cout << "\n\n\n\n                         ICUF购物平台-查询订单功能  WiChG_Trade             \n\n"; Col(0);
		SearchDPage.DisplayList();
		int i = SearchDPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = SearchDPage.CheckCurrent();
			switch (i)
			{
			case 0:
				SearchDealShow();
				break;
			case 1:
				SearchDealById();
				break;
			}
		}
	}
}
void SearchDealById()
{
	int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	Col(8); cout << "请输入要查询的订单号 : ";
	cin >> list; Col(0);
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

	}
	fout.close();
	int flag{};
	Col(8);
	for (int j = 0; j < DataLength; j++)
	{
		if (List[j] == list)
		{
			cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
			flag = 1;
		}
		if (flag == 0 && j == DataLength - 1)
			cout << "不存在此订单!"; Col(0);
	}
	if (DataLength == 0)
		cout << "当前不存在任何已储存订单" << endl; Col(0);
	system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
	int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
		Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
	}
	fout.close();
	system("pause");
}
void Init()//用于判断执行次数并进行更新
{
	skin.GetSkinData();//读取本地文件数据
	skin.SaveSkinData();
	if (BuyPage.TempTimes != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
	BuyPage.Times++;
	BuyPage.ResetTimes();
}

ICUF_HEAD_05.h

//ICUF_HEAD_05.H

#ifndef ICUF_HEAD_05
#define ICUF_HEAD_05
#include<iostream>
#include<string>
#include <fstream>
#include <conio.h>
using namespace std;
inline void Col(int ColN)//设置自定义行的背景颜色
{
	if (ColN == 0)cout << "\033[0m";//清除颜色
	else
	{
		cout << "\033[04m\033[1m\033[7m";
		if (ColN == 1)cout << "\033[31m";//红色
		else if (ColN == 2)cout << "\033[32m";//绿色
		else if (ColN == 3)cout << "\033[33m";//黄色
		else if (ColN == 4)cout << "\033[34m";//蓝色
		else if (ColN == 5)cout << "\033[35m";//紫色
		else if (ColN == 6)cout << "\033[36m";//淡蓝
		else if (ColN == 7)cout << "\033[37m";//白色
		else if (ColN == 8)Col((rand() % 6) + 1);//随机颜色(1-7)
	}
}
class FunctionList
{
public:int Page{ 1 };
public:int Times{};//用于计算某一函数的执行次数,同时用于限定某些代码只执行一次
public:int TempTimes{};
public:int FunctionNumbers = 0;//表示类中含有的字符串数量
public:void RecoverTimes()
{
	this->Times += this->TempTimes;
	this->TempTimes = 0;
}
public:void ResetTimes()
{
	this->TempTimes += this->Times;
	this->Times = 0;
}
public:void InitList(int Start = 0)//列表初始化函数,默认初始化第一个选项为选定状态
{
	for (int i = 0; i < FunctionNumbers; i++)
	{
		ListStatus[i] = 0;
	}
	for (int i = FunctionNumbers; i < 50; i++)
	{
		ListStatus[i] = -1;
	}
	ListStatus[Start] = 1;
}
public:void DisplayList()//显示列表
{
	int Start, End;
	Start = (Page - 1) * LimitListEachPage;
	End = Start + LimitListEachPage;
	cout << "FunId: " << CheckCurrent() << "  Limit: " << LimitListEachPage << "  Page: " << Page << "  Start: " << Start << "  End: " << End << endl << endl;
	for (int i = Start; i < End; i++)
	{
		if (ListStatus[i] != -1)
		{
			if (ListStatus[i] == 1)
				Col(7);
			else
				Col(1);
			cout << "               " << List[i] << "               " << endl << endl;
			Col(0);
		}
	}
}
public:int InsertAction()//输入控制
{
	char Key;
	int Temp;
	Key = _getch();
	if (Key == 'c' || Key == 'C')
		return 3;
	if (FunctionNumbers == 0)
		return 0;
	if ((int)(Key - 48) > 0 && (int)(Key - 48) <= 9)//判断是否是从零到九的数字
	{
		if ((int)(Key - 48) > FunctionNumbers)//如果是,且小于等于选项总数则直接指定这个选项
			InitList(FunctionNumbers - 1);
		else
			InitList((int)(Key - 48) - 1);//如果超出了最大值,则指向最大值
		return 4;
	}
	else if (Key == 'w' || Key == 'W' || Key == 72)//如果输入了大小写的W或者上箭头,则执行MoveUp函数
	{
		MoveUp();
		return 0;
	}
	else if (Key == 's' || Key == 'S' || Key == 80)//如果输入了大小写的S或者下箭头,则执行MoveDown函数
	{
		MoveDown();
		return 0;
	}
	else if (Key == 'z' || Key == 'Z')//对页面切换功能的第二次改进,此版本不需要在主页面对第一个返回值进行判断
	{
		if (Page != 1)
		{
			Page--;
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[Temp - LimitListEachPage] = 1;
		}
		else
		{
			Page = GetPages();
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[(Page - 1) * LimitListEachPage] = 1;
		}
		return 1;
	}
	else if (Key == 'x' || Key == 'X')
	{
		if (Page != GetPages())
		{
			Page++;
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			if (Temp + LimitListEachPage >= FunctionNumbers - 1)
				ListStatus[FunctionNumbers - 1] = 1;
			else
				ListStatus[Temp + LimitListEachPage] = 1;
		}
		else
		{
			Page = 1;
			Temp = CheckCurrent();
			ListStatus[Temp] = 0;
			ListStatus[Temp % LimitListEachPage] = 1;
		}
		return 2;
	}
	else if (Key == '\r')
		return 4;
	return 0;
}
public:void MoveUp()//选项上移
{
	int i = CheckCurrent();//找到当前指向的选项
	if (i == 0 && FunctionNumbers == 1)//如果只有一个选项则不变
		ListStatus[i] = 1;
	else if (i == 0 && FunctionNumbers != 1)//如果指向第一个且不止包含一个选项,则改为指向最下方的选项
	{
		ListStatus[i] = 0;
		Page = GetPages();
		ListStatus[FunctionNumbers - 1] = 1;
	}
	else if ((i + 1) % LimitListEachPage == 1)//如果指向某一页面的第一项则翻页,并指向前一页的最后一项
	{
		if (Page != 1)
		{
			Page--;
			ListStatus[i] = 0;
			ListStatus[i - 1] = 1;
		}
		else
		{
			Page = GetPages();
			ListStatus[i] = 0;
			ListStatus[FunctionNumbers - 1] = 1;
		}
	}
	else//正常情况
	{
		ListStatus[i] = 0;
		ListStatus[i - 1] = 1;
	}
}
public:void MoveDown()//选项下移
{
	int i = CheckCurrent();//找到当前指向的选项
	if (i == 0 && FunctionNumbers == 1)//如果只有一个选项则不变
		ListStatus[i] = 1;
	else if (i != 0 && i == FunctionNumbers - 1)//如果指向最后一个且不止包含一个选项,则改为指向最上方的选项
	{
		ListStatus[FunctionNumbers - 1] = 0;
		Page = 1;
		ListStatus[0] = 1;
	}
	else if ((i + 1) % LimitListEachPage == 0)//如果指向某一页面的最后一项则翻页,并指向下一页的第一项
	{
		if (Page != GetPages())
		{
			Page++;
			ListStatus[i] = 0;
			ListStatus[i + 1] = 1;
		}
		else
		{
			Page = 1;
			ListStatus[i] = 0;
			ListStatus[0] = 1;
		}
	}
	else//正常情况
	{
		ListStatus[i] = 0;
		ListStatus[i + 1] = 1;
	}
}
public:int CheckCurrent()//找到当前指向的选项
{
	for (int j = 0; j < FunctionNumbers; j++)
	{
		if (ListStatus[j] == 1)
			return j;
	}
}
public:void Append(string FunctionName, int Times = 1)//List数组添加String成员
{
	if (Times != 0)
		return;
	List[FunctionNumbers] = FunctionName;
	FunctionNumbers += 1;//成员计数器
}
public:void SetMaxList(int List)
{
	LimitListEachPage = List;
}
public:void RemoveAll()//移除所有成员(在04.h版本中为重要功能,05.h中被Times计数器取代)
{
	for (int i = 0; i < 10; i++)
	{
		List[i] = {};
		FunctionNumbers = 0;
	}
}
public:int GetPages()
{
	if (FunctionNumbers % LimitListEachPage != 0)
		Pages = FunctionNumbers / LimitListEachPage + 1;
	else
		Pages = FunctionNumbers / LimitListEachPage;
	return Pages;
}
private:int Pages{ 1 };
private:int LimitListEachPage{ 9 };
private:string List[50]{};//存放选项名称
private:int ListStatus[50]{ -1 };//存放选项状态
};
#endif

ICUF2 0.00.01.60

// ICUF 2.0 - 0.00.01.60  2021/6/23 17:25
// 随机生成的订单号现在位数稳定到六位 且使用时间为种子的随机
// 修复重新启动程序时没有将物品初始化的问题

#include <iostream>
#include <fstream>
#include <string>
#include <time.h>
#include "ICUF_HEAD_05.h"
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
void BuyCargo(int Id = 0);
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal();
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
struct ICUF_SkinData
{
	int ICUF_Id{ 0 };
	string ICUF_Name{};
	string ICUF_Float{};
	double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage2, SetPage4;
public: void SaveSkinData()
{
	fout.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		if (ISD[i].ICUF_Id == 0)
		{
			LengthOfData = i;
			break;
		}
		fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
	}
	fout.close();
}
public: void GetSkinData()
{
	fin.open(SDL);
	for (int i = 0; i < 30; i++)
	{
		fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
	}
	fin.close();
}
public:int GetLength()
{
	return LengthOfData;
}
public: void RemoveData()
{
	remove(SDL);
	remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
	Init();
	MainPage.Append("购买商品", MainPage.Times);
	MainPage.Append("查询订单", MainPage.Times);
	MainPage.Append("系统管理", MainPage.Times);
	MainPage.Append("退出系统", MainPage.Times++);
	MainPage.InitList();
	while (1)
	{
		system("cls");
		int Temp = MainPage.FunctionNumbers;
		Col(MainPage.DefaultCol); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
		MainPage.DisplayList(0,Temp,1);
		MainPage.DisplayList(Temp, MainPage.FunctionNumbers);
		int i = MainPage.InsertAction();
		if (i == 4)
		{
			int i = MainPage.CheckCurrent();
			if (i == 0)
				BuyCargo();
			else if (i == 1)
				SearchDeal();
			else if (i == 2)
				ChangeData();
			else if (i == 3)
				exit(1);
		}
	}
}
void BuyCargo(int Id)//购买商品主页面
{
	skin.GetSkinData();//读取本地文件数据
	skin.SaveSkinData();
	if (BuyPage.TempTimes != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
	BuyPage.Times++;
	BuyPage.RecoverTimes();
	BuyPage.InitList(Id);
	while (1)
	{
		system("cls");
		Col(BuyPage.DefaultCol); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
		BuyPage.DisplayList();
		int i = BuyPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = BuyPage.CheckCurrent();
			BuyingCargo(i);
		}
	}
}
void BuyingCargo(int Id)
{
	BuyingPage.Append("继续", BuyingPage.Times);
	BuyingPage.Append("返回", BuyingPage.Times++);
	BuyingPage.InitList();
	while (1)
	{
		system("cls");
		Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
		Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
		Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
		Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
		Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
		BuyingPage.DisplayList();
		int i = BuyingPage.InsertAction();
		if (i == 3)
			BuyCargo(Id);
		else if (i == 4)
		{
			int i = BuyingPage.CheckCurrent();
			if (i == 1)
				BuyCargo();
			else
			{
				cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
				int Number;
				cin >> Number;
				srand(time(NULL));
				int List = ((rand() % 9) + 1) * 100000 + ((rand() % 9) + 1) * 10000 + ((rand() % 9) + 1) * 1000 + ((rand() % 9) + 1) * 100 + ((rand() % 9) + 1) * 10 + ((rand() % 9) + 1);
				fout.close();
				fout.open(Deals, ios::app);
				fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
				fout.close();
				cout << "购买成功  你的购买订单号为 " << List << endl;
				cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
				system("pause");
				BuyCargo();
			}
		}
	}
}
void ChangeData()
{
	int LengthOfData{};
	ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
	ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
	ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
	ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
	ChangeDPage.InitList();
	while (1)
	{
		system("cls");
		Col(ChangeDPage.DefaultCol); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
		ChangeDPage.DisplayList();
		int i = ChangeDPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = ChangeDPage.CheckCurrent();
			skin.GetSkinData();
			if (i == 0)//更改单一数据功能
			{
				SetPage.RemoveAll();
				SetPage.ResetTimes();
				for (int i = 0; i < 30; i++)
				{
					if (ISD[i].ICUF_Id == 0)
					{
						LengthOfData = i;
						break;
					}
					cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
				}
				int ISD_Id, ISD_Fun;
				Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
				cin >> ISD_Id; Col(0);
				SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
				SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
				SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
				SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
				SetPage.InitList();
				while (1)
				{
					system("cls");
					Col(SetPage.DefaultCol); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
					SetPage.DisplayList();
					int i = SetPage.InsertAction();
					if (i == 3)
					{
						ChangeData();
					}
					else if (i == 4)
					{
						int i = SetPage.CheckCurrent();
						ISD_Fun = i + 1;
						break;
					}
				}
				Col(1); cout << "请输入修改后的内容 :  ";
				switch (ISD_Fun)
				{
				case 1:
					/*cin >> ISD[ISD_Id].ICUF_Id;*/
					Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
					break;
				case 2:
					cin >> ISD[ISD_Id - 1].ICUF_Name;
					break;
				case 3:
					cin >> ISD[ISD_Id - 1].ICUF_Float;
					break;
				case 4:
					cin >> ISD[ISD_Id - 1].ICUF_Price;
					break;
				}
				Col(0);
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
			if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
			{
				SetPage.RemoveAll();
				SetPage.ResetTimes();
				int breakword{};
				system("cls");
				for (int i = BuyPage.FunctionNumbers; i < 30; i++)
				{
					Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
					ISD[i].ICUF_Id = i + 1;
					Col(8); cout << "请输入 ICUF_Name (string) :";
					cin >> ISD[i].ICUF_Name; Col(0);
					Col(8); cout << "请输入 ICUF_Float (string) :";
					cin >> ISD[i].ICUF_Float; Col(0);
					Col(8); cout << "请输入 ICUF_Price (double) :";
					cin >> ISD[i].ICUF_Price; Col(0);
					SetPage.Append("1.继续", SetPage.Times);
					SetPage.Append("2.退出", SetPage.Times++);
					SetPage.InitList();
					while (1)
					{
						system("cls");
						for (int j = 0; j <= i; j++)
						{
							Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
							ISD[j].ICUF_Id = j + 1;
							Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
							Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
							Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
						}
						SetPage.DisplayList();
						int i = SetPage.InsertAction();
						if (i == 3)
						{
							ChangeData();
						}
						else if (i == 4)
						{
							int i = SetPage.CheckCurrent();
							if (i == 0)
							{
								breakword = 0;
								break;
							}
							else if (i == 1)
							{
								LengthOfData = i;
								breakword = 1;
								break;
							}
						}
					}
					if (breakword == 1)
						break;
				}
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
			if (i == 2)//系统初始数据
			{
				SetPage.RemoveAll();
				SetPage.ResetTimes();
				skin.RemoveData();
				for (int i = 0; i < 30; i++)
				{
					if (i == 0)
					{
						ISD[0].ICUF_Id = 1;
						ISD[0].ICUF_Name = "地下水";
						ISD[0].ICUF_Float = "久经沙场";
						ISD[0].ICUF_Price = 0.2;
					}
					else if (i == 1)
					{
						ISD[1].ICUF_Id = 2;
						ISD[1].ICUF_Name = "地下水";
						ISD[1].ICUF_Float = "略有磨损";
						ISD[1].ICUF_Price = 0.3;
					}
					else if (i == 2)
					{
						ISD[2].ICUF_Id = 3;
						ISD[2].ICUF_Name = "地下水";
						ISD[2].ICUF_Float = "崭新出厂";
						ISD[2].ICUF_Price = 0.4;
					}
					else if (i == 3)
					{
						ISD[3].ICUF_Id = 4;
						ISD[3].ICUF_Name = "狩猎网格";
						ISD[3].ICUF_Float = "久经沙场";
						ISD[3].ICUF_Price = 0.5;
					}
					else
					{
						ISD[i].ICUF_Id = NULL;
						ISD[i].ICUF_Name = "";
						ISD[i].ICUF_Float = "";
						ISD[i].ICUF_Price = NULL;
					}
				}
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
			if (i == 3)
			{
				skin.RemoveData();
				SetPage.ResetTimes();
				for (int i = 0; i < 30; i++)
				{
					ISD[i].ICUF_Id = NULL;
					ISD[i].ICUF_Name = "";
					ISD[i].ICUF_Float = "";
					ISD[i].ICUF_Price = NULL;
				}
				skin.SaveSkinData();
				BuyPage.ResetTimes();
			}
		}
	}
}
void SearchDeal()
{
	SearchDPage.Append("1.查询所有", SearchDPage.Times);
	SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
	SearchDPage.InitList();
	while (1)
	{
		system("cls");
		Col(SearchDPage.DefaultCol); cout << "\n\n\n\n                         ICUF购物平台-查询订单功能  WiChG_Trade             \n\n"; Col(0);
		SearchDPage.DisplayList();
		int i = SearchDPage.InsertAction();
		if (i == 3)
			main();
		else if (i == 4)
		{
			int i = SearchDPage.CheckCurrent();
			switch (i)
			{
			case 0:
				SearchDealShow();
				break;
			case 1:
				SearchDealById();
				break;
			}
		}
	}
}
void SearchDealById()
{
	int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	Col(8); cout << "请输入要查询的订单号 : ";
	cin >> list; Col(0);
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

	}
	fout.close();
	int flag{};
	Col(8);
	for (int j = 0; j < DataLength; j++)
	{
		if (List[j] == list)
		{
			cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
			flag = 1;
		}
		if (flag == 0 && j == DataLength - 1)
			cout << "不存在此订单!"; Col(0);
	}
	if (DataLength == 0)
		cout << "当前不存在任何已储存订单" << endl; Col(0);
	system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
	int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
	double price[30]{};
	fin.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
		if (List[i] == 0)
		{
			DataLength = i;
			break;
		}
	}
	fin.close();
	fout.open(Deals);
	for (int i = 0; i < 30; i++)
	{
		if (List[i] == 0)
			break;
		fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
		Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
	}
	fout.close();
	system("pause");
}
void Init()//用于判断执行次数并进行更新
{
	skin.GetSkinData();//读取本地文件数据
	skin.SaveSkinData();
	if (BuyPage.TempTimes != 0)
		BuyPage.RemoveAll();
	for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
		BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
	BuyPage.Times++;
	BuyPage.ResetTimes();
}

ICUF2 0.00.01.59

下一个版本的头文件的目标是能做出如下图的效果。
在这里插入图片描述
(1.44中为了实现这个效果写了非常长的代码,主要目标是简化代码)

// ICUF 2.0 - 0.00.01.59  2021/6/18 00:00
// 现在修改后的数据在购买页面可以正常显示 同时可以正常计数
// 已收集部分信息用于更新头文件

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_05.h";
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo(int Id = 0);
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal();
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage2, SetPage4;
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
public: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    Init();
    MainPage.Append("购买商品", MainPage.Times);
    MainPage.Append("查询订单", MainPage.Times);
    MainPage.Append("系统管理", MainPage.Times);
    MainPage.Append("退出系统", MainPage.Times++);
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal();
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo(int Id)//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
    BuyPage.InitList(Id);
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.Append("继续", BuyingPage.Times);
    BuyingPage.Append("返回", BuyingPage.Times++);
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 3)
            BuyCargo(Id);
        else if (i == 4)
        {
            int i = BuyingPage.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
                system("pause");
                BuyCargo();
            }
        }
    }
}
void ChangeData()
{
    int LengthOfData{};
    ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
    ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
    ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
    ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
    ChangeDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
        ChangeDPage.DisplayList();
        int i = ChangeDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = ChangeDPage.CheckCurrent();
            skin.GetSkinData();
            if (i == 0)//更改单一数据功能
            {
                SetPage.RemoveAll();
                SetPage.ResetTimes();
                for (int i = 0; i < 30; i++)
                {
                    if (ISD[i].ICUF_Id == 0)
                    {
                        LengthOfData = i;
                        break;
                    }
                    cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
                }
                int ISD_Id, ISD_Fun;
                Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
                cin >> ISD_Id; Col(0);
                SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
                SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
                SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
                SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
                SetPage.InitList();
                while (1)
                {
                    system("cls");
                    Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
                    SetPage.DisplayList();
                    int i = SetPage.InsertAction();
                    if (i == 3)
                    {
                        ChangeData();
                    }
                    else if (i == 4)
                    {
                        int i = SetPage.CheckCurrent();
                        ISD_Fun = i + 1;
                        break;
                    }
                }
                Col(1); cout << "请输入修改后的内容 :  ";
                switch (ISD_Fun)
                {
                case 1:
                    /*cin >> ISD[ISD_Id].ICUF_Id;*/
                    Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
                    break;
                case 2:
                    cin >> ISD[ISD_Id - 1].ICUF_Name;
                    break;
                case 3:
                    cin >> ISD[ISD_Id - 1].ICUF_Float;
                    break;
                case 4:
                    cin >> ISD[ISD_Id - 1].ICUF_Price;
                    break;
                }
                Col(0);
                skin.SaveSkinData();
                BuyPage.ResetTimes();
            }
            if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
            {
                SetPage.RemoveAll();
                SetPage.ResetTimes();
                int breakword{};
                system("cls");
                for (int i = BuyPage.FunctionNumbers; i < 30; i++)
                {
                    Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
                    ISD[i].ICUF_Id = i + 1;
                    Col(8); cout << "请输入 ICUF_Name (string) :";
                    cin >> ISD[i].ICUF_Name; Col(0);
                    Col(8); cout << "请输入 ICUF_Float (string) :";
                    cin >> ISD[i].ICUF_Float; Col(0);
                    Col(8); cout << "请输入 ICUF_Price (double) :";
                    cin >> ISD[i].ICUF_Price; Col(0);
                    SetPage.Append("1.继续", SetPage.Times);
                    SetPage.Append("2.退出", SetPage.Times++);
                    SetPage.InitList();
                    while (1)
                    {
                        system("cls");
                        for (int j = 0; j <= i; j++)
                        {
                            Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                            ISD[j].ICUF_Id = j + 1;
                            Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                            Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
                            Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
                        }
                        SetPage.DisplayList();
                        int i = SetPage.InsertAction();
                        if (i == 3)
                        {
                            ChangeData();
                        }
                        else if (i == 4)
                        {
                            int i = SetPage.CheckCurrent();
                            if (i == 0)
                            {
                                breakword = 0;
                                break;
                            }
                            else if (i == 1)
                            {
                                LengthOfData = i;
                                breakword = 1;
                                break;
                            }
                        }
                    }
                    if (breakword == 1)
                        break;
                }
                skin.SaveSkinData();
                BuyPage.ResetTimes();
            }
            if (i == 2)//系统初始数据
            {
                SetPage.RemoveAll();
                SetPage.ResetTimes();
                skin.RemoveData();
                for (int i = 0; i < 30; i++)
                {
                    if (i == 0)
                    {
                        ISD[0].ICUF_Id = 1;
                        ISD[0].ICUF_Name = "地下水";
                        ISD[0].ICUF_Float = "久经沙场";
                        ISD[0].ICUF_Price = 0.2;
                    }
                    else if (i == 1)
                    {
                        ISD[1].ICUF_Id = 2;
                        ISD[1].ICUF_Name = "地下水";
                        ISD[1].ICUF_Float = "略有磨损";
                        ISD[1].ICUF_Price = 0.3;
                    }
                    else if (i == 2)
                    {
                        ISD[2].ICUF_Id = 3;
                        ISD[2].ICUF_Name = "地下水";
                        ISD[2].ICUF_Float = "崭新出厂";
                        ISD[2].ICUF_Price = 0.4;
                    }
                    else if (i == 3)
                    {
                        ISD[3].ICUF_Id = 4;
                        ISD[3].ICUF_Name = "狩猎网格";
                        ISD[3].ICUF_Float = "久经沙场";
                        ISD[3].ICUF_Price = 0.5;
                    }
                    else
                    {
                        ISD[i].ICUF_Id = NULL;
                        ISD[i].ICUF_Name = "";
                        ISD[i].ICUF_Float = "";
                        ISD[i].ICUF_Price = NULL;
                    }
                }
                skin.SaveSkinData();
                BuyPage.ResetTimes();
            }
            if (i == 3)
            {
                skin.RemoveData();
                SetPage.ResetTimes();
                for (int i = 0; i < 30; i++)
                {
                    ISD[i].ICUF_Id = NULL;
                    ISD[i].ICUF_Name = "";
                    ISD[i].ICUF_Float = "";
                    ISD[i].ICUF_Price = NULL;
                }
                skin.SaveSkinData();
                BuyPage.ResetTimes();
            }
        }
    }
}
void SearchDeal()
{
    SearchDPage.Append("1.查询所有", SearchDPage.Times);
    SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
    SearchDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-查询订单功能  WiChG_Trade             \n\n"; Col(0);
        SearchDPage.DisplayList();
        int i = SearchDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = SearchDPage.CheckCurrent();
            switch (i)
            {
            case 0:
                SearchDealShow();
                break;
            case 1:
                SearchDealById();
                break;
            }
        }
    }
}
void SearchDealById()
{
    int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    Col(8); cout << "请输入要查询的订单号 : ";
    cin >> list; Col(0);
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;

    }
    fout.close();
    int flag{};
    Col(8);
    for (int j = 0; j < DataLength; j++)
    {
        if (List[j] == list)
        {
            cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
            flag = 1;
        }
        if (flag == 0 && j == DataLength - 1)
            cout << "不存在此订单!"; Col(0);
    }
    if (DataLength == 0)
        cout << "当前不存在任何已储存订单" << endl; Col(0);
    system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
    int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
    }
    fout.close();
    system("pause");
}
void Init()//用于判断执行次数并进行更新
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
}

ICUF2 0.00.01.58

// ICUF 2.0 - 0.00.01.58  2021/6/4 22:21
// 现在更改数据完成后在购买页面会正常显示更改后的数据
// 将所有更改数据功能从类中移除 并添加独立的函数中

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_05.h";
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo(int Id = 0);
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal();
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage2, SetPage4;
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
public: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    Init();
    MainPage.Append("购买商品", MainPage.Times);
    MainPage.Append("查询订单", MainPage.Times);
    MainPage.Append("系统管理", MainPage.Times);
    MainPage.Append("退出系统", MainPage.Times++);
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal();
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo(int Id)//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
    BuyPage.InitList(Id);
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.Append("继续", BuyingPage.Times);
    BuyingPage.Append("返回", BuyingPage.Times++);
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 3)
            BuyCargo(Id);
        else if (i == 4)
        {
            int i = BuyingPage.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
                system("pause");
                BuyCargo();
            }
        }
    }   
}
void ChangeData()
{
    int LengthOfData{};
    ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
    ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
    ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
    ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
    ChangeDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
        ChangeDPage.DisplayList();
        int i = ChangeDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = ChangeDPage.CheckCurrent();
            skin.GetSkinData();
            if (i == 0)//更改单一数据功能
            {
                SetPage.RemoveAll();
                SetPage.ResetTimes();
                for (int i = 0; i < 30; i++)
                {
                    if (ISD[i].ICUF_Id == 0)
                    {
                        LengthOfData = i;
                        break;
                    }
                    cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
                }
                int ISD_Id, ISD_Fun;
                Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
                cin >> ISD_Id; Col(0);
                SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
                SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
                SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
                SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
                SetPage.InitList();
                while (1)
                {
                    system("cls");
                    Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
                    SetPage.DisplayList();
                    int i = SetPage.InsertAction();
                    if (i == 3)
                    {
                        ChangeData();
                    }
                    else if (i == 4)
                    {
                        int i = SetPage.CheckCurrent();
                        ISD_Fun = i + 1;
                        break;
                    }
                }
                Col(1); cout << "请输入修改后的内容 :  ";
                switch (ISD_Fun)
                {
                case 1:
                    /*cin >> ISD[ISD_Id].ICUF_Id;*/
                    Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
                    break;
                case 2:
                    cin >> ISD[ISD_Id - 1].ICUF_Name;
                    break;
                case 3:
                    cin >> ISD[ISD_Id - 1].ICUF_Float;
                    break;
                case 4:
                    cin >> ISD[ISD_Id - 1].ICUF_Price;
                    break;
                }
                Col(0);
                skin.SaveSkinData();
                BuyPage.ResetTimes();
                SetPage.RecoverTimes();
            }
            if (i == 1)//从头开始修改数据(不会删除后面未经修改的数据)
            {
                SetPage.RemoveAll();
                SetPage.ResetTimes();
                int breakword{};
                system("cls");
                for (int i = BuyPage.FunctionNumbers; i < 30; i++)
                {
                    Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
                    ISD[i].ICUF_Id = i + 1;
                    Col(8); cout << "请输入 ICUF_Name (string) :";
                    cin >> ISD[i].ICUF_Name; Col(0);
                    Col(8); cout << "请输入 ICUF_Float (string) :";
                    cin >> ISD[i].ICUF_Float; Col(0);
                    Col(8); cout << "请输入 ICUF_Price (double) :";
                    cin >> ISD[i].ICUF_Price; Col(0);
                    SetPage.Append("1.继续", SetPage.Times);
                    SetPage.Append("2.退出", SetPage.Times++);
                    SetPage.InitList();
                    while (1)
                    {
                        system("cls");
                        for (int j = 0; j <= i; j++)
                        {
                            Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                            ISD[j].ICUF_Id = j + 1;
                            Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                            Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
                            Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
                        }
                        SetPage.DisplayList();
                        int i = SetPage.InsertAction();
                        if (i == 3)
                        {
                            ChangeData();
                        }
                        else if (i == 4)
                        {
                            int i = SetPage.CheckCurrent();
                            if (i == 0)
                            {
                                breakword = 0;
                                break;
                            }
                            else if (i == 1)
                            {
                                LengthOfData = i;
                                breakword = 1;
                                break;
                            }
                        }
                    }
                    if (breakword == 1)
                        break;
                }
                skin.SaveSkinData();
                SetPage.RecoverTimes();
            }
            if (i == 2)//系统初始数据
            {
                SetPage.RemoveAll();
                SetPage.ResetTimes();
                skin.RemoveData();
                for (int i = 0; i < 30; i++)
                {
                    if (i == 0)
                    {
                        ISD[0].ICUF_Id = 1;
                        ISD[0].ICUF_Name = "地下水";
                        ISD[0].ICUF_Float = "久经沙场";
                        ISD[0].ICUF_Price = 0.2;
                    }
                    else if (i == 1)
                    {
                        ISD[1].ICUF_Id = 2;
                        ISD[1].ICUF_Name = "地下水";
                        ISD[1].ICUF_Float = "略有磨损";
                        ISD[1].ICUF_Price = 0.3;
                    }
                    else if (i == 2)
                    {
                        ISD[2].ICUF_Id = 3;
                        ISD[2].ICUF_Name = "地下水";
                        ISD[2].ICUF_Float = "崭新出厂";
                        ISD[2].ICUF_Price = 0.4;
                    }
                    else if (i == 3)
                    {
                        ISD[3].ICUF_Id = 4;
                        ISD[3].ICUF_Name = "狩猎网格";
                        ISD[3].ICUF_Float = "久经沙场";
                        ISD[3].ICUF_Price = 0.5;
                    }
                    else
                    {
                        ISD[i].ICUF_Id = NULL;
                        ISD[i].ICUF_Name = "";
                        ISD[i].ICUF_Float = "";
                        ISD[i].ICUF_Price = NULL;
                    }
                }
                skin.SaveSkinData();
                SetPage.RecoverTimes();
            }
            if (i == 3)
            {
                skin.RemoveData();
                for (int i = 0; i < 30; i++)
                {
                    ISD[i].ICUF_Id = NULL;
                    ISD[i].ICUF_Name = "";
                    ISD[i].ICUF_Float = "";
                    ISD[i].ICUF_Price = NULL;
                }
                skin.SaveSkinData();
            }
        }
    }
}
void SearchDeal()
{
    SearchDPage.Append("1.查询所有", SearchDPage.Times);
    SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
    SearchDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-查询订单功能  WiChG_Trade             \n\n"; Col(0);
        SearchDPage.DisplayList();
        int i = SearchDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = SearchDPage.CheckCurrent();
            switch (i)
            {
            case 0:
                SearchDealShow();
                break;
            case 1:
                SearchDealById();
                break;
            }
        }
    }
}
void SearchDealById()
{
    int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    Col(8); cout << "请输入要查询的订单号 : ";
    cin >> list; Col(0);
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        
    }
    fout.close();
    int flag{};
    Col(8);
    for (int j = 0; j < DataLength; j++)
    {
        if (List[j] == list)
        {
            cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
            flag = 1;
        }
        if (flag == 0 && j == DataLength - 1)
            cout << "不存在此订单!"; Col(0);
    }
    if (DataLength == 0)
        cout << "当前不存在任何已储存订单" << endl; Col(0);
    system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
    int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
    }
    fout.close();
    system("pause");
}
void Init()//用于判断执行次数并进行更新
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
}

ICUF2 0.00.01.57

// ICUF 2.0 - 0.00.01.57  2021/6/4 00:29
// 修复系统管理的选项指引错误的问题
// 修复增加数据会一直覆盖最后一个已存在数据的问题
// 系统管理功能将从类中迁移出来

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_05.h";
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo(int Id = 0);
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal();
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage, SetPage;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage2, SetPage4;
public: void SetSkinData(int Mode)
{
    GetSkinData();
    if (Mode == 1)//从头开始修改数据(不会删除后面未经修改的数据)
    {
        int breakword{};
        system("cls");
        for (int i = BuyPage.FunctionNumbers; i < 30; i++)
        {
            Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(8); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(8); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(8); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage2.Append("1.继续", SetPage2.Times);
            SetPage2.Append("2.退出", SetPage2.Times++);
            SetPage2.InitList();
            while (1)
            {
                system("cls");
                for (int j = 0; j <= i; j++)
                {
                    Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                    ISD[j].ICUF_Id = j + 1;
                    Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
                }
                SetPage2.DisplayList();
                int i = SetPage2.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage2.CheckCurrent();
                    if (i == 0)
                    {
                        breakword = 0;
                        break;
                    }
                    else if (i == 1)
                    {
                        LengthOfData = i;
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 2)//系统初始数据
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            if (i == 0)
            {
                ISD[0].ICUF_Id = 1;
                ISD[0].ICUF_Name = "地下水";
                ISD[0].ICUF_Float = "久经沙场";
                ISD[0].ICUF_Price = 0.2;
            }
            else if (i == 1)
            {
                ISD[1].ICUF_Id = 2;
                ISD[1].ICUF_Name = "地下水";
                ISD[1].ICUF_Float = "略有磨损";
                ISD[1].ICUF_Price = 0.3;
            }
            else if (i == 2)
            {
                ISD[2].ICUF_Id = 3;
                ISD[2].ICUF_Name = "地下水";
                ISD[2].ICUF_Float = "崭新出厂";
                ISD[2].ICUF_Price = 0.4;
            }
            else if (i == 3)
            {
                ISD[3].ICUF_Id = 4;
                ISD[3].ICUF_Name = "狩猎网格";
                ISD[3].ICUF_Float = "久经沙场";
                ISD[3].ICUF_Price = 0.5;
            }
            else
            {
                ISD[i].ICUF_Id = NULL;
                ISD[i].ICUF_Name = "";
                ISD[i].ICUF_Float = "";
                ISD[i].ICUF_Price = NULL;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 3)
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            ISD[i].ICUF_Id = NULL;
            ISD[i].ICUF_Name = "";
            ISD[i].ICUF_Float = "";
            ISD[i].ICUF_Price = NULL;
        }
        SaveSkinData();
    }
    BuyPage.ResetTimes();
}
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
private: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    Init();
    MainPage.Append("购买商品", MainPage.Times);
    MainPage.Append("查询订单", MainPage.Times);
    MainPage.Append("系统管理", MainPage.Times);
    MainPage.Append("退出系统", MainPage.Times++);
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal();
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo(int Id)//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
    BuyPage.InitList(Id);
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.Append("继续", BuyingPage.Times);
    BuyingPage.Append("返回", BuyingPage.Times++);
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 3)
            BuyCargo(Id);
        else if (i == 4)
        {
            int i = BuyingPage.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
                system("pause");
                BuyCargo();
            }
        }
    }   
}
void ChangeData()
{
    int LengthOfData{};
    ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
    ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
    ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
    ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
    ChangeDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
        ChangeDPage.DisplayList();
        int i = ChangeDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = ChangeDPage.CheckCurrent();
            if (i == 0)//更改单一数据功能
            {
                SetPage.RemoveAll();
                SetPage.ResetTimes();
                for (int i = 0; i < 30; i++)
                {
                    if (ISD[i].ICUF_Id == 0)
                    {
                        LengthOfData = i;
                        break;
                    }
                    cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
                }
                int ISD_Id, ISD_Fun;
                Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
                cin >> ISD_Id; Col(0);
                SetPage.Append("1.ISD[i].ICUF_Id    (序号)", SetPage.Times);
                SetPage.Append("2.ISD[i].ICUF_Name  (名称)", SetPage.Times);
                SetPage.Append("3.ISD[i].ICUF_Float (磨损)", SetPage.Times);
                SetPage.Append("4.ISD[i].ICUF_Price (价格)", SetPage.Times++);
                SetPage.InitList();
                while (1)
                {
                    system("cls");
                    Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
                    SetPage.DisplayList();
                    int i = SetPage.InsertAction();
                    if (i == 3)
                    {
                        ChangeData();
                    }
                    else if (i == 4)
                    {
                        int i = SetPage.CheckCurrent();
                        ISD_Fun = i + 1;
                        break;
                    }
                }
                Col(1); cout << "请输入修改后的内容 :  ";
                switch (ISD_Fun)
                {
                case 1:
                    /*cin >> ISD[ISD_Id].ICUF_Id;*/
                    Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
                    break;
                case 2:
                    cin >> ISD[ISD_Id - 1].ICUF_Name;
                    break;
                case 3:
                    cin >> ISD[ISD_Id - 1].ICUF_Float;
                    break;
                case 4:
                    cin >> ISD[ISD_Id - 1].ICUF_Price;
                    break;
                }
                Col(0);
                skin.SaveSkinData();
            }
            else
            {
                SetPage.RecoverTimes();
                skin.SetSkinData(i);
            }
        }
    }
}
void SearchDeal()
{
    SearchDPage.Append("1.查询所有", SearchDPage.Times);
    SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
    SearchDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-查询订单功能  WiChG_Trade             \n\n"; Col(0);
        SearchDPage.DisplayList();
        int i = SearchDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = SearchDPage.CheckCurrent();
            switch (i)
            {
            case 0:
                SearchDealShow();
                break;
            case 1:
                SearchDealById();
                break;
            }
        }
    }
}
void SearchDealById()
{
    int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    Col(8); cout << "请输入要查询的订单号 : ";
    cin >> list; Col(0);
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        
    }
    fout.close();
    int flag{};
    Col(8);
    for (int j = 0; j < DataLength; j++)
    {
        if (List[j] == list)
        {
            cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
            flag = 1;
        }
        if (flag == 0 && j == DataLength - 1)
            cout << "不存在此订单!"; Col(0);
    }
    if (DataLength == 0)
        cout << "当前不存在任何已储存订单" << endl; Col(0);
    system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
    int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
    }
    fout.close();
    system("pause");
}
void Init()//用于判断执行次数并进行更新
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
}

ICUF2 0.00.01.56

// ICUF 2.0 - 0.00.01.56  2021/6/2 14:58
// 此项目已经完成 后续可能因为头文件的更新再次更新
// 查询订单功能现在所有情况都会输出提示
// 展示所有已储存订单的功能开放访问
// 为查询订单功能添加了界面效果

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_05.h";
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo(int Id = 0);
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal();
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage, SearchDPage;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage1, SetPage2, SetPage4;
public: void SetSkinData(int Mode)
{
    GetSkinData();
    if (Mode == 1)//更改单一数据功能
    {
        for (int i = 0; i < 30; i++)
        {
            if (ISD[i].ICUF_Id == 0)
            {
                LengthOfData = i;
                break;
            }
            cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
        }
        int ISD_Id, ISD_Fun;
        Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
        cin >> ISD_Id; Col(0);
        SetPage1.Append("1.ISD[i].ICUF_Id    (序号)", SetPage1.Times);
        SetPage1.Append("2.ISD[i].ICUF_Name  (名称)", SetPage1.Times);
        SetPage1.Append("3.ISD[i].ICUF_Float (磨损)", SetPage1.Times);
        SetPage1.Append("4.ISD[i].ICUF_Price (价格)", SetPage1.Times++);
        SetPage1.InitList();
        while (1)
        {
            system("cls");
            Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
            SetPage1.DisplayList();
            int i = SetPage1.InsertAction();
            if (i == 3)
            {
                ChangeData();
            }
            else if (i == 4)
            {
                int i = SetPage1.CheckCurrent();
                ISD_Fun = i + 1;
                break;
            }
        }
        Col(1); cout << "请输入修改后的内容 :  ";
        switch (ISD_Fun)
        {
        case 1:
            /*cin >> ISD[ISD_Id].ICUF_Id;*/
            Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
            break;
        case 2:
            cin >> ISD[ISD_Id - 1].ICUF_Name;
            break;
        case 3:
            cin >> ISD[ISD_Id - 1].ICUF_Float;
            break;
        case 4:
            cin >> ISD[ISD_Id - 1].ICUF_Price;
            break;
        }
        Col(0);
        SaveSkinData();
    }
    else if (Mode == 2)//从头开始修改数据(不会删除后面未经修改的数据)
    {
        int breakword{};
        system("cls");
        for (int i = (BuyPage.FunctionNumbers - 1); i < 30; i++)
        {
            Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(8); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(8); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(8); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage2.Append("1.继续", SetPage2.Times);
            SetPage2.Append("2.退出", SetPage2.Times++);
            SetPage2.InitList();
            while (1)
            {
                system("cls");
                for (int j = 0; j <= i; j++)
                {
                    Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                    ISD[j].ICUF_Id = j + 1;
                    Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
                }
                SetPage2.DisplayList();
                int i = SetPage2.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage2.CheckCurrent();
                    if (i == 0)
                    {
                        breakword = 0;
                        break;
                    }
                    else if (i == 1)
                    {
                        LengthOfData = i;
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 3)//系统初始数据
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            if (i == 0)
            {
                ISD[0].ICUF_Id = 1;
                ISD[0].ICUF_Name = "地下水";
                ISD[0].ICUF_Float = "久经沙场";
                ISD[0].ICUF_Price = 0.2;
            }
            else if (i == 1)
            {
                ISD[1].ICUF_Id = 2;
                ISD[1].ICUF_Name = "地下水";
                ISD[1].ICUF_Float = "略有磨损";
                ISD[1].ICUF_Price = 0.3;
            }
            else if (i == 2)
            {
                ISD[2].ICUF_Id = 3;
                ISD[2].ICUF_Name = "地下水";
                ISD[2].ICUF_Float = "崭新出厂";
                ISD[2].ICUF_Price = 0.4;
            }
            else if (i == 3)
            {
                ISD[3].ICUF_Id = 4;
                ISD[3].ICUF_Name = "狩猎网格";
                ISD[3].ICUF_Float = "久经沙场";
                ISD[3].ICUF_Price = 0.5;
            }
            else
            {
                ISD[i].ICUF_Id = NULL;
                ISD[i].ICUF_Name = "";
                ISD[i].ICUF_Float = "";
                ISD[i].ICUF_Price = NULL;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 4)
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            ISD[i].ICUF_Id = NULL;
            ISD[i].ICUF_Name = "";
            ISD[i].ICUF_Float = "";
            ISD[i].ICUF_Price = NULL;
        }
        SaveSkinData();
    }
    BuyPage.ResetTimes();
}
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
private: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    Init();
    MainPage.Append("购买商品", MainPage.Times);
    MainPage.Append("查询订单", MainPage.Times);
    MainPage.Append("系统管理", MainPage.Times);
    MainPage.Append("退出系统", MainPage.Times++);
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal();
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo(int Id)//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
    BuyPage.InitList(Id);
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.Append("继续", BuyingPage.Times);
    BuyingPage.Append("返回", BuyingPage.Times++);
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 3)
            BuyCargo(Id);
        else if (i == 4)
        {
            int i = BuyingPage.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number << endl;
                system("pause");
                BuyCargo();
            }
        }
    }   
}
void ChangeData()
{
    ChangeDPage.Append("1.更改数据", ChangeDPage.Times);
    ChangeDPage.Append("2.添加数据", ChangeDPage.Times);
    ChangeDPage.Append("3.默认数据", ChangeDPage.Times);
    ChangeDPage.Append("4.清理数据", ChangeDPage.Times++);
    ChangeDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
        ChangeDPage.DisplayList();
        int i = ChangeDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = ChangeDPage.CheckCurrent();
            skin.SetSkinData(i);
        }
    }
}
void SearchDeal()
{
    SearchDPage.Append("1.查询所有", SearchDPage.Times);
    SearchDPage.Append("2.按ID查询", SearchDPage.Times++);
    SearchDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-查询订单功能  WiChG_Trade             \n\n"; Col(0);
        SearchDPage.DisplayList();
        int i = SearchDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = SearchDPage.CheckCurrent();
            switch (i)
            {
            case 0:
                SearchDealShow();
                break;
            case 1:
                SearchDealById();
                break;
            }
        }
    }
}
void SearchDealById()
{
    int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    Col(8); cout << "请输入要查询的订单号 : ";
    cin >> list; Col(0);
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        
    }
    fout.close();
    int flag{};
    Col(8);
    for (int j = 0; j < DataLength; j++)
    {
        if (List[j] == list)
        {
            cout << "List ID : " << List[j] << "  Cargo ID : " << Id[j] << "  ICUF ID : " << ICUF_Id[j] << "  Number : " << Number[j] << "  Price : " << price[j]; Col(0);
            flag = 1;
        }
        if (flag == 0 && j == DataLength - 1)
            cout << "不存在此订单!"; Col(0);
    }
    if (DataLength == 0)
        cout << "当前不存在任何已储存订单" << endl; Col(0);
    system("pause");
}
void SearchDealShow()//用于展示所有已储存的订单
{
    int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        Col(8); cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl; Col(0);
    }
    fout.close();
    system("pause");
}
void Init()//用于判断执行次数并进行更新
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
}

ICUF2 0.00.01.55

// ICUF 2.0 - 0.00.01.55  2021/6/1 23:59
// 现在在购买确认页面返回会回到正确的位置
// 修复使用默认数据功能中赋值的对象错误的问题
// 完成了修改数据功能的列表

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_05.h";
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo(int Id = 0);
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal(int i = 0);
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage, ChangeDPage;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage1, SetPage2, SetPage4;
public: void SetSkinData(int Mode)
{
    GetSkinData();
    if (Mode == 1)//更改单一数据功能
    {
        for (int i = 0; i < 30; i++)
        {
            if (ISD[i].ICUF_Id == 0)
            {
                LengthOfData = i;
                break;
            }
            cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
        }
        int ISD_Id, ISD_Fun;
        Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
        cin >> ISD_Id; Col(0);
        SetPage1.Append("1.ISD[i].ICUF_Id    (序号)", SetPage1.Times);
        SetPage1.Append("2.ISD[i].ICUF_Name  (名称)", SetPage1.Times);
        SetPage1.Append("3.ISD[i].ICUF_Float (磨损)", SetPage1.Times);
        SetPage1.Append("4.ISD[i].ICUF_Price (价格)", SetPage1.Times++);
        SetPage1.InitList();
        while (1)
        {
            system("cls");
            Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
            SetPage1.DisplayList();
            int i = SetPage1.InsertAction();
            if (i == 3)
            {
                ChangeData();
            }
            else if (i == 4)
            {
                int i = SetPage1.CheckCurrent();
                ISD_Fun = i + 1;
                break;
            }
        }
        Col(1); cout << "请输入修改后的内容 :  ";
        switch (ISD_Fun)
        {
        case 1:
            /*cin >> ISD[ISD_Id].ICUF_Id;*/
            Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
            break;
        case 2:
            cin >> ISD[ISD_Id - 1].ICUF_Name;
            break;
        case 3:
            cin >> ISD[ISD_Id - 1].ICUF_Float;
            break;
        case 4:
            cin >> ISD[ISD_Id - 1].ICUF_Price;
            break;
        }
        Col(0);
        SaveSkinData();
    }
    else if (Mode == 2)//从头开始修改数据(不会删除后面未经修改的数据)
    {
        int breakword{};
        system("cls");
        for (int i = (BuyPage.FunctionNumbers - 1); i < 30; i++)
        {
            Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(8); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(8); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(8); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage2.Append("1.继续", SetPage2.Times);
            SetPage2.Append("2.退出", SetPage2.Times++);
            SetPage2.InitList();
            while (1)
            {
                system("cls");
                for (int j = 0; j <= i; j++)
                {
                    Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                    ISD[j].ICUF_Id = j + 1;
                    Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
                }
                SetPage2.DisplayList();
                int i = SetPage2.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage2.CheckCurrent();
                    if (i == 0)
                    {
                        breakword = 0;
                        break;
                    }
                    else if (i == 1)
                    {
                        LengthOfData = i;
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 3)//系统初始数据
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            if (i == 0)
            {
                ISD[0].ICUF_Id = 1;
                ISD[0].ICUF_Name = "地下水";
                ISD[0].ICUF_Float = "久经沙场";
                ISD[0].ICUF_Price = 0.2;
            }
            else if (i == 1)
            {
                ISD[1].ICUF_Id = 2;
                ISD[1].ICUF_Name = "地下水";
                ISD[1].ICUF_Float = "略有磨损";
                ISD[1].ICUF_Price = 0.3;
            }
            else if (i == 2)
            {
                ISD[2].ICUF_Id = 3;
                ISD[2].ICUF_Name = "地下水";
                ISD[2].ICUF_Float = "崭新出厂";
                ISD[2].ICUF_Price = 0.4;
            }
            else if (i == 3)
            {
                ISD[3].ICUF_Id = 4;
                ISD[3].ICUF_Name = "狩猎网格";
                ISD[3].ICUF_Float = "久经沙场";
                ISD[3].ICUF_Price = 0.5;
            }
            else
            {
                ISD[i].ICUF_Id = NULL;
                ISD[i].ICUF_Name = "";
                ISD[i].ICUF_Float = "";
                ISD[i].ICUF_Price = NULL;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 4)
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            ISD[i].ICUF_Id = NULL;
            ISD[i].ICUF_Name = "";
            ISD[i].ICUF_Float = "";
            ISD[i].ICUF_Price = NULL;
        }
        SaveSkinData();
    }
    BuyPage.ResetTimes();
}
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
private: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    Init();
    MainPage.Append("购买商品", MainPage.Times);
    MainPage.Append("查询订单", MainPage.Times);
    MainPage.Append("系统管理", MainPage.Times);
    MainPage.Append("退出系统", MainPage.Times++);
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 3)
        {
            cout << "此页面没有前一页" << endl;
            system("pause");
        }
        else if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal(1);
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo(int Id)//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
    BuyPage.InitList(Id);
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.Append("继续", BuyingPage.Times);
    BuyingPage.Append("返回", BuyingPage.Times++);
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 3)
            BuyCargo(Id);
        else if (i == 4)
        {
            int i = BuyingPage.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number;
                system("pause");
                BuyCargo();
            }
        }
    }   
}
void ChangeData()
{
    ChangeDPage.Append("1.更改数据      ", ChangeDPage.Times);
    ChangeDPage.Append("2.添加数据      ", ChangeDPage.Times);
    ChangeDPage.Append("3.默认数据      ", ChangeDPage.Times);
    ChangeDPage.Append("4.清理数据      ", ChangeDPage.Times++);
    ChangeDPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         ICUF购物平台-修改数据功能  WiChG_Trade             \n\n"; Col(0);
        ChangeDPage.DisplayList();
        int i = ChangeDPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = ChangeDPage.CheckCurrent();
            skin.SetSkinData(i);
        }
    }
}
void SearchDeal(int i)
{
    switch (i)
    {
    case 0:
        SearchDealShow();
        break;
    case 1:
        SearchDealById();
        break;
    }
}
void SearchDealById()
{
    int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    cout << "请输入要查询的订单号 : ";
    cin >> list;
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        
    }
    fout.close();
    int flag{};
    for (int i = 0; i < DataLength; i++)
    {
        if (List[i] == list)
        {
            cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i];
            flag = 1;
        }
        if (flag == 0 && i == DataLength)
            cout << "不存在此订单!";
    }
    system("pause");
}
void SearchDealShow()
{
    int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl;
    }
    fout.close();
    system("pause");
}
void Init()//用于判断执行次数并进行更新
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
}

ICUF2 0.00.01.54

// ICUF 2.0 - 0.00.01.54  2021/5/27 23:43
// 完善头文件列表功能页面切换部分
// 移除了系统管理中的完全修改功能(功能重复)
// 新增一个预处理函数提前计算出列表物品数量
// 针对最新的头文件对代码进行修改

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_05.h";
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo();
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal(int i = 0);
void SearchDealShow();
void SearchDealById();
void ChangeData();
void Init();
FunctionList MainPage, BuyPage, BuyingPage;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[30];
class ICUF_Skin
{
public: FunctionList SetPage1, SetPage2, SetPage4;
public: void SetSkinData(int Mode)
{
    GetSkinData();
    if (Mode == 1)//更改单一数据功能
    {
        for (int i = 0; i < 30; i++)
        {
            if (ISD[i].ICUF_Id == 0)
            {
                LengthOfData = i;
                break;
            }
            cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
        }
        int ISD_Id, ISD_Fun;
        Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
        cin >> ISD_Id; Col(0);
        SetPage1.Append("1.ISD[i].ICUF_Id    (序号)", SetPage1.Times);
        SetPage1.Append("2.ISD[i].ICUF_Name  (名称)", SetPage1.Times);
        SetPage1.Append("3.ISD[i].ICUF_Float (磨损)", SetPage1.Times);
        SetPage1.Append("4.ISD[i].ICUF_Price (价格)", SetPage1.Times++);
        SetPage1.InitList();
        while (1)
        {
            system("cls");
            Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
            SetPage1.DisplayList();
            int i = SetPage1.InsertAction();
            if (i == 3)
            {
                ChangeData();
            }
            else if (i == 4)
            {
                int i = SetPage1.CheckCurrent();
                ISD_Fun = i + 1;
                break;
            }
        }
        Col(1); cout << "请输入修改后的内容 :  ";
        switch (ISD_Fun)
        {
        case 1:
            /*cin >> ISD[ISD_Id].ICUF_Id;*/
            Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
            break;
        case 2:
            cin >> ISD[ISD_Id - 1].ICUF_Name;
            break;
        case 3:
            cin >> ISD[ISD_Id - 1].ICUF_Float;
            break;
        case 4:
            cin >> ISD[ISD_Id - 1].ICUF_Price;
            break;
        }
        Col(0);
        SaveSkinData();
    }
    else if (Mode == 2)//从头开始修改数据(不会删除后面未经修改的数据)
    {
        int breakword{};
        system("cls");
        for (int i = (BuyPage.FunctionNumbers - 1); i < 30; i++)
        {
            Col(8); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(8); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(8); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(8); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage2.Append("1.继续", SetPage2.Times);
            SetPage2.Append("2.退出", SetPage2.Times++);
            SetPage2.InitList();
            while (1)
            {
                system("cls");
                for (int j = 0; j <= i; j++)
                {
                    Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                    ISD[j].ICUF_Id = j + 1;
                    Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Float (string) :" << ISD[j].ICUF_Float << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Price (double) :" << ISD[j].ICUF_Price << endl; Col(0);
                }
                SetPage2.DisplayList();
                int i = SetPage2.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage2.CheckCurrent();
                    if (i == 0)
                    {
                        breakword = 0;
                        break;
                    }
                    else if (i == 1)
                    {
                        LengthOfData = i;
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 3)//系统初始数据
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            if (i == 0)
            {
                ISD[0].ICUF_Id = 1;
                ISD[0].ICUF_Name = "地下水";
                ISD[0].ICUF_Float = "久经沙场";
                ISD[0].ICUF_Price = 0.2;
            }
            else if (i == 1)
            {
                ISD[1].ICUF_Id = 2;
                ISD[1].ICUF_Name = "地下水";
                ISD[1].ICUF_Float = "略有磨损";
                ISD[1].ICUF_Price = 0.3;
            }
            else if (i == 2)
            {
                ISD[2].ICUF_Id = 3;
                ISD[2].ICUF_Name = "地下水";
                ISD[2].ICUF_Float = "崭新出厂";
                ISD[2].ICUF_Price = 0.4;
            }
            else if (i == 3)
            {
                ISD[3].ICUF_Id = 4;
                ISD[3].ICUF_Name = "狩猎网格";
                ISD[3].ICUF_Float = "久经沙场";
                ISD[3].ICUF_Price = 0.5;
            }
            else
            {
                ISD[3].ICUF_Id = NULL;
                ISD[3].ICUF_Name = "";
                ISD[3].ICUF_Float = "";
                ISD[3].ICUF_Price = NULL;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 4)
    {
        RemoveData();
        for (int i = 0; i < 30; i++)
        {
            ISD[i].ICUF_Id = NULL;
            ISD[i].ICUF_Name = "";
            ISD[i].ICUF_Float = "";
            ISD[i].ICUF_Price = NULL;
        }
        SaveSkinData();
    }
    BuyPage.ResetTimes();
}
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 30; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
private: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    Init();
    MainPage.Append("购买商品", MainPage.Times);
    MainPage.Append("查询订单", MainPage.Times);
    MainPage.Append("系统管理", MainPage.Times);
    MainPage.Append("退出系统", MainPage.Times++);
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 3)
        {
            cout << "此页面没有前一页" << endl;
            system("pause");
        }
        else if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal(1);
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo()//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
    BuyPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.Append("继续", BuyingPage.Times);
    BuyingPage.Append("返回", BuyingPage.Times++);
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(8); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(8); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(8); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(8); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(8); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 3)
            BuyCargo();
        else if (i == 4)
        {
            int i = BuyingPage.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number;
                system("pause");
                BuyCargo();
            }
        }
    }   
}
void ChangeData()
{
    int CHO;
    cout << "请选择数据更改模式 (1.更改单一数据 2.添加数据 3.使用默认数据 4.清理数据):";
    cin >> CHO;
    skin.SetSkinData(CHO);
}
void SearchDeal(int i)
{
    switch (i)
    {
    case 0:
        SearchDealShow();
        break;
    case 1:
        SearchDealById();
        break;
    }
}
void SearchDealById()
{
    int list, List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    cout << "请输入要查询的订单号 : ";
    cin >> list;
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        
    }
    fout.close();
    int flag{};
    for (int i = 0; i < DataLength; i++)
    {
        if (List[i] == list)
        {
            cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i];
            flag = 1;
        }
        if (flag == 0 && i == DataLength)
            cout << "不存在此订单!";
    }
    system("pause");
}
void SearchDealShow()
{
    int List[30]{}, Number[30]{}, Id[30]{}, ICUF_Id[30]{}, DataLength{ 30 };
    double price[30]{};
    fin.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 30; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl;
    }
    fout.close();
    system("pause");
}
void Init()
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
}

ICUF2 0.00.01.53+

// ICUF 2.0 - 0.00.01.53  2021/5/26 22:25
// 完全从头修改数据功能添加界面效果
// 已应用最新的ICUF_HEAD_05.h
// 修复更改单一数据序号处理错误的问题
// 搜索订单功能扩展加入了展示所有订单功能
// 储存订单中的物品价格类型改为double(原int)

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_05.h";
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo();
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal(int i = 0);
void SearchDealShow();
void SearchDealById();
void ChangeData();
FunctionList MainPage, BuyPage, BuyingPage;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[20];
class ICUF_Skin
{
public: FunctionList SetPage1, SetPage2, SetPage4;
public: void SetSkinData(int Mode)
{
    GetSkinData();
    if (Mode == 1)//更改单一数据功能
    {
        for (int i = 0; i < 20; i++)
        {
            if (ISD[i].ICUF_Id == 0)
            {
                LengthOfData = i;
                break;
            }
            cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
        }
        int ISD_Id, ISD_Fun;
        Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
        cin >> ISD_Id; Col(0);
        SetPage1.Append("1.ISD[i].ICUF_Id    (序号)", SetPage1.Times);
        SetPage1.Append("2.ISD[i].ICUF_Name  (名称)", SetPage1.Times);
        SetPage1.Append("3.ISD[i].ICUF_Float (磨损)", SetPage1.Times);
        SetPage1.Append("4.ISD[i].ICUF_Price (价格)", SetPage1.Times++);
        SetPage1.InitList();
        while (1)
        {
            system("cls");
            Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
            SetPage1.DisplayList();
            int i = SetPage1.InsertAction();
            if (i == 3)
            {
                ChangeData();
            }
            else if (i == 4)
            {
                int i = SetPage1.CheckCurrent();
                ISD_Fun = i + 1;
                break;
            }
        }
        Col(1); cout << "请输入修改后的内容 :  ";
        switch (ISD_Fun)
        {
        case 1:
            /*cin >> ISD[ISD_Id].ICUF_Id;*/
            Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
            break;
        case 2:
            cin >> ISD[ISD_Id - 1].ICUF_Name;
            break;
        case 3:
            cin >> ISD[ISD_Id - 1].ICUF_Float;
            break;
        case 4:
            cin >> ISD[ISD_Id - 1].ICUF_Price;
            break;
        }
        Col(0);
        SaveSkinData();
    }
    else if (Mode == 2)//从头开始修改数据(不会删除后面未经修改的数据)
    {
        int breakword{};
        system("cls");
        for (int i = 0; i < 20; i++)
        {
            Col(rand() % 6 + 1); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage2.Append("1.继续", SetPage2.Times);
            SetPage2.Append("2.退出", SetPage2.Times++);
            SetPage2.InitList();
            while (1)
            {
                system("cls");
                for (int j = 0; j <= i; j++)
                {
                    Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                    ISD[j].ICUF_Id = j + 1;
                    Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Float (string) :"<<ISD[j].ICUF_Float << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Price (double) :"<< ISD[j].ICUF_Price << endl; Col(0);
                }
                SetPage2.DisplayList();
                int i = SetPage2.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage2.CheckCurrent();
                    if (i == 0)
                    {
                        breakword = 0;
                        break;
                    }
                    else if (i == 1)
                    {
                        LengthOfData = i;
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 3)//系统初始数据
    {
        RemoveData();
        for (int i = 0; i < 20; i++)
        {
            if (i == 0)
            {
                ISD[0].ICUF_Id = 1;
                ISD[0].ICUF_Name = "地下水";
                ISD[0].ICUF_Float = "久经沙场";
                ISD[0].ICUF_Price = 0.2;
            }
            else if (i == 1)
            {
                ISD[1].ICUF_Id = 2;
                ISD[1].ICUF_Name = "地下水";
                ISD[1].ICUF_Float = "略有磨损";
                ISD[1].ICUF_Price = 0.3;
            }
            else if (i == 2)
            {
                ISD[2].ICUF_Id = 3;
                ISD[2].ICUF_Name = "地下水";
                ISD[2].ICUF_Float = "崭新出厂";
                ISD[2].ICUF_Price = 0.4;
            }
            else if (i == 3)
            {
                ISD[3].ICUF_Id = 4;
                ISD[3].ICUF_Name = "狩猎网格";
                ISD[3].ICUF_Float = "久经沙场";
                ISD[3].ICUF_Price = 0.5;
            }
            else
            {
                ISD[3].ICUF_Id = NULL;
                ISD[3].ICUF_Name = "";
                ISD[3].ICUF_Float = "";
                ISD[3].ICUF_Price = NULL;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 4)
    {
        int breakword{};
        for (int i = GetLength(); i < 20; i++)
        {
            Col(rand() % 6 + 1); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage4.Append("1.继续", SetPage4.Times);
            SetPage4.Append("2.退出", SetPage4.Times++);
            SetPage4.InitList();
            while (1)
            {
                system("cls");
                SetPage4.DisplayList();
                int i = SetPage4.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage4.CheckCurrent();
                    if (i == 0)
                    {
                        Col(rand() % 6 + 1); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
                        ISD[i].ICUF_Id = i + 1;
                        Col(rand() % 6 + 1); cout << "请输入 ICUF_Name (string) :";
                        cin >> ISD[i].ICUF_Name; Col(0);
                        Col(rand() % 6 + 1); cout << "请输入 ICUF_Float (string) :";
                        cin >> ISD[i].ICUF_Float; Col(0);
                        Col(rand() % 6 + 1); cout << "请输入 ICUF_Price (double) :";
                        cin >> ISD[i].ICUF_Price; Col(0);
                        continue;
                    }
                    else if (i == 1)
                    {
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 5)
    {
        RemoveData();
        for (int i = 0; i < 20; i++)
        {
            ISD[i].ICUF_Id = NULL;
            ISD[i].ICUF_Name = "";
            ISD[i].ICUF_Float = "";
            ISD[i].ICUF_Price = NULL;
        }
        SaveSkinData();
    }
    BuyPage.ResetTimes();
}
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 20; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 20; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
private: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    MainPage.Append("购买商品", MainPage.Times);
    MainPage.Append("查询订单", MainPage.Times);
    MainPage.Append("系统管理", MainPage.Times);
    MainPage.Append("退出系统", MainPage.Times++);
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 1)//页面功能将在ICUF_HEAD_05.h中得到改进
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if (i == 2)
        {
            cout << "此页面没有下一页" << endl;
            system("pause");
        }
        else if (i == 3)
        {
            cout << "此页面没有前一页" << endl;
            system("pause");
        }
        else if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal(1);
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo()//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    if (BuyPage.TempTimes != 0)
        BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")", BuyPage.Times);
    BuyPage.Times++;
    BuyPage.RecoverTimes();
    BuyPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.Append("继续", BuyingPage.Times);
    BuyingPage.Append("返回", BuyingPage.Times++);
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(rand() % 6 + 1); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(rand() % 6 + 1); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 1)//页面功能将在ICUF_HEAD_05.h中得到改进
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if (i == 2)
        {
            cout << "此页面没有下一页" << endl;
            system("pause");
        }
        else if (i == 3)
            BuyCargo();
        else if (i == 4)
        {
            int i = BuyingPage.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number;
                system("pause");
                BuyCargo();
            }
        }
    }   
}
void ChangeData()
{
    int CHO;
    cout << "请选择数据更改模式 (1.更改单一数据 2.完全重新修改数据 3.使用默认数据 4.添加数据 5.清理数据):";
    cin >> CHO;
    skin.SetSkinData(CHO);
}
void SearchDeal(int i)
{
    switch (i)
    {
    case 0:
        SearchDealShow();
        break;
    case 1:
        SearchDealById();
        break;
    }
}
void SearchDealById()
{
    int list, List[20]{}, Number[20]{}, Id[20]{}, ICUF_Id[20]{}, DataLength{ 20 };
    double price[20]{};
    cout << "请输入要查询的订单号 : ";
    cin >> list;
    fin.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        
    }
    fout.close();
    int flag{};
    for (int i = 0; i < DataLength; i++)
    {
        if (List[i] == list)
        {
            cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i];
            flag = 1;
        }
        if (flag == 0 && i == DataLength)
            cout << "不存在此订单!";
    }
    system("pause");
}
void SearchDealShow()
{
    int List[20]{}, Number[20]{}, Id[20]{}, ICUF_Id[20]{}, DataLength{ 20 };
    double price[20]{};
    fin.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl;
    }
    fout.close();
    system("pause");
}

ICUF_HEAD_04.h

//ICUF_HEAD_04.H

#ifndef ICUF_HEAD_04
#define ICUF_HEAD_04
#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
inline void Col(int ColN)//设置自定义行的背景颜色
{
	if (ColN == 0)cout << "\033[0m";//清除颜色
	else
	{
		cout << "\033[04m\033[1m\033[7m";
		if (ColN == 1)cout << "\033[31m";//红色
		else if (ColN == 2)cout << "\033[32m";//绿色
		else if (ColN == 3)cout << "\033[33m";//黄色
		else if (ColN == 4)cout << "\033[34m";//蓝色
		else if (ColN == 5)cout << "\033[35m";//紫色
		else if (ColN == 6)cout << "\033[36m";//淡蓝
		else if (ColN == 7)cout << "\033[37m";//白色
	}
}
class FunctionList
{
public:int FunctionNumbers = 0;//表示类中含有的字符串数量
public:void InitList(int Start = 0)//列表初始化函数,默认初始化第一个选项为选定状态
{
	for (int i = 0; i < FunctionNumbers; i++)
	{
		ListStatus[i] = 0;
	}
	ListStatus[Start] = 1;
}
public:void DisplayList()//显示列表
{
	for (int i = 0; i < FunctionNumbers; i++)
	{
		if (ListStatus[i] == 1)
			Col(7);
		else
			Col(1);
		cout << "               " << List[i] << "               " << endl << endl;
		Col(0);
	}
}
public:int InsertAction()//输入控制
{
	char Key;
	Key = _getch();
	if ((int)(Key - 48) > 0 && (int)(Key - 48) <= 9)//判断是否是从零到九的数字
	{
		if ((int)(Key - 48) > FunctionNumbers)//如果是,且小于等于选项总数则直接指定这个选项
			InitList(FunctionNumbers - 1);
		else
			InitList((int)(Key - 48) - 1);//如果超出了最大值,则指向最大值
		return 4;
	}
	else if (Key == 'w' || Key == 'W' || Key == 72)//如果输入了大小写的W或者上箭头,则执行MoveUp函数
	{
		MoveUp();
		return 0;
	}
	else if (Key == 's' || Key == 'S' || Key == 80)//如果输入了大小写的S或者下箭头,则执行MoveDown函数
	{
		MoveDown();
		return 0;
	}
	else if (Key == 'z' || Key == 'Z')//头文件对Z,X,C,\r的功能只规定了返回值,可以由用户来决定其功能
		return 1;
	else if (Key == 'x' || Key == 'X')
		return 2;
	else if (Key == 'c' || Key == 'C')
		return 3;
	else if (Key == '\r')
		return 4;
}
public:void MoveUp()//选项上移
{
	int i = CheckCurrent();//找到当前指向的选项
	if (i == 0 && FunctionNumbers == 1)//如果只有一个选项则不变
		ListStatus[i] = 1;
	else if (i == 0 && FunctionNumbers != 1)//如果指向第一个且不止包含一个选项,则改为指向最下方的选项
	{
		ListStatus[i] = 0;
		ListStatus[FunctionNumbers - 1] = 1;
	}
	else//正常情况
	{
		ListStatus[i] = 0;
		ListStatus[i - 1] = 1;
	}
}
public:void MoveDown()//选项下移
{
	int i = CheckCurrent();//找到当前指向的选项
	if (i == 0 && FunctionNumbers == 1)//如果只有一个选项则不变
		ListStatus[i] = 1;
	else if (i != 0 && i == FunctionNumbers - 1)//如果指向最后一个且不止包含一个选项,则改为指向最上方的选项
	{
		ListStatus[FunctionNumbers - 1] = 0;
		ListStatus[0] = 1;
	}
	else//正常情况
	{
		ListStatus[i] = 0;
		ListStatus[i + 1] = 1;
	}
}
public:int CheckCurrent()//找到当前指向的选项
{
	for (int j = 0; j < FunctionNumbers; j++)
	{
		if (ListStatus[j] == 1)
			return j;
	}
}
public:void Append(string FunctionName)//List数组添加String成员
{
	List[FunctionNumbers] = FunctionName;
	FunctionNumbers += 1;//成员计数器
}
public:void RemoveAll()//移除所有成员
{
	for (int i = 0; i < 10; i++)
	{
		List[i] = {};
		FunctionNumbers = 0;
	}
}
private:string List[10]{};//存放选项名称
private:int ListStatus[10]{};//存放选项状态
};
#endif

ICUF2 0.00.01.53

// ICUF 2.0 - 0.00.01.53  2021/5/26 12:05  8435 字数
// 完全从头修改数据功能添加界面效果
// 已收集到部分信息用于改进头文件
// 将各种ICUF_HEAD_04.h的类成员整合
// 修复更改单一数据序号处理错误的问题
// 搜索订单功能扩展加入了展示所有订单功能
// 储存订单中的物品价格类型改为double(原int)

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_04.h"
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
void BuyCargo();
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal(int i = 0);
void SearchDealShow();
void SearchDealById();
void ChangeData();
FunctionList Page;
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[20];
class ICUF_Skin
{
public: FunctionList SetPage;
public: void SetSkinData(int Mode)
{
    GetSkinData();
    if (Mode == 1)//更改单一数据功能
    {
        for (int i = 0; i < 20; i++)
        {
            if (ISD[i].ICUF_Id == 0)
            {
                LengthOfData = i;
                break;
            }
            cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
        }
        int ISD_Id, ISD_Fun;
        Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
        cin >> ISD_Id; Col(0);
        SetPage.RemoveAll();
        SetPage.Append("1.ISD[i].ICUF_Id    (序号)");
        SetPage.Append("2.ISD[i].ICUF_Name  (名称)");
        SetPage.Append("3.ISD[i].ICUF_Float (磨损)");
        SetPage.Append("4.ISD[i].ICUF_Price (价格)");
        SetPage.InitList();
        while (1)
        {
            system("cls");
            Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
            SetPage.DisplayList();
            int i = SetPage.InsertAction();
            if (i == 3)
            {
                ChangeData();
            }
            else if (i == 4)
            {
                int i = SetPage.CheckCurrent();
                ISD_Fun = i + 1;
                break;
            }
        }
        Col(1); cout << "请输入修改后的内容 :  ";
        switch (ISD_Fun)
        {
        case 1:
            /*cin >> ISD[ISD_Id].ICUF_Id;*/
            Col(1); cout << "暂时不提供修改序号的功能 !" << endl; Col(0);
            break;
        case 2:
            cin >> ISD[ISD_Id - 1].ICUF_Name;
            break;
        case 3:
            cin >> ISD[ISD_Id - 1].ICUF_Float;
            break;
        case 4:
            cin >> ISD[ISD_Id - 1].ICUF_Price;
            break;
        }
        Col(0);
        SaveSkinData();
    }
    else if (Mode == 2)//从头开始修改数据(不会删除后面未经修改的数据)
    {
        int breakword{};
        system("cls");
        for (int i = 0; i < 20; i++)
        {
            Col(rand() % 6 + 1); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage.RemoveAll();
            SetPage.Append("1.继续");
            SetPage.Append("2.退出");
            SetPage.InitList();
            while (1)
            {
                system("cls");
                for (int j = 0; j <= i; j++)
                {
                    Col(rand() % 6 + 1); cout << "ICUF_Id  :" << j + 1 << endl; Col(0);
                    ISD[j].ICUF_Id = j + 1;
                    Col(rand() % 6 + 1); cout << "ICUF_Name (string) :" << ISD[j].ICUF_Name << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Float (string) :"<<ISD[j].ICUF_Float << endl; Col(0);
                    Col(rand() % 6 + 1); cout << "ICUF_Price (double) :"<< ISD[j].ICUF_Price << endl; Col(0);
                }
                SetPage.DisplayList();
                int i = SetPage.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage.CheckCurrent();
                    if (i == 0)
                    {
                        breakword = 0;
                        break;
                    }
                    else if (i == 1)
                    {
                        LengthOfData = i;
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 3)//系统初始数据
    {
        RemoveData();
        for (int i = 0; i < 20; i++)
        {
            if (i == 0)
            {
                ISD[0].ICUF_Id = 1;
                ISD[0].ICUF_Name = "地下水";
                ISD[0].ICUF_Float = "久经沙场";
                ISD[0].ICUF_Price = 0.2;
            }
            else if (i == 1)
            {
                ISD[1].ICUF_Id = 2;
                ISD[1].ICUF_Name = "地下水";
                ISD[1].ICUF_Float = "略有磨损";
                ISD[1].ICUF_Price = 0.3;
            }
            else if (i == 2)
            {
                ISD[2].ICUF_Id = 3;
                ISD[2].ICUF_Name = "地下水";
                ISD[2].ICUF_Float = "崭新出厂";
                ISD[2].ICUF_Price = 0.4;
            }
            else if (i == 3)
            {
                ISD[3].ICUF_Id = 4;
                ISD[3].ICUF_Name = "狩猎网格";
                ISD[3].ICUF_Float = "久经沙场";
                ISD[3].ICUF_Price = 0.5;
            }
            else
            {
                ISD[3].ICUF_Id = NULL;
                ISD[3].ICUF_Name = "";
                ISD[3].ICUF_Float = "";
                ISD[3].ICUF_Price = NULL;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 4)
    {
        int breakword{};
        for (int i = GetLength(); i < 20; i++)
        {
            Col(rand() % 6 + 1); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
            ISD[i].ICUF_Id = i + 1;
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float; Col(0);
            Col(rand() % 6 + 1); cout << "请输入 ICUF_Price (double) :";
            cin >> ISD[i].ICUF_Price; Col(0);
            SetPage.RemoveAll();
            SetPage.Append("1.继续");
            SetPage.Append("2.退出");
            SetPage.InitList();
            while (1)
            {
                system("cls");
                SetPage.DisplayList();
                int i = SetPage.InsertAction();
                if (i == 3)
                {
                    ChangeData();
                }
                else if (i == 4)
                {
                    int i = SetPage.CheckCurrent();
                    if (i == 0)
                    {
                        Col(rand() % 6 + 1); cout << "ICUF_Id  :" << i + 1 << endl; Col(0);
                        ISD[i].ICUF_Id = i + 1;
                        Col(rand() % 6 + 1); cout << "请输入 ICUF_Name (string) :";
                        cin >> ISD[i].ICUF_Name; Col(0);
                        Col(rand() % 6 + 1); cout << "请输入 ICUF_Float (string) :";
                        cin >> ISD[i].ICUF_Float; Col(0);
                        Col(rand() % 6 + 1); cout << "请输入 ICUF_Price (double) :";
                        cin >> ISD[i].ICUF_Price; Col(0);
                        continue;
                    }
                    else if (i == 1)
                    {
                        breakword = 1;
                        break;
                    }
                }
            }
            if (breakword == 1)
                break;
        }
        SaveSkinData();
    }
    else if (Mode == 5)
    {
        RemoveData();
        for (int i = 0; i < 20; i++)
        {
            ISD[i].ICUF_Id = NULL;
            ISD[i].ICUF_Name = "";
            ISD[i].ICUF_Float = "";
            ISD[i].ICUF_Price = NULL;
        }
        SaveSkinData();
    }
}
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 20; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 20; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
private: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
int main()
{
    Page.RemoveAll();
    Page.Append("购买商品");
    Page.Append("查询订单");
    Page.Append("系统管理");
    Page.Append("退出系统");
    Page.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        Page.DisplayList();
        int i = Page.InsertAction();
        if (i == 1)//页面功能将在ICUF_HEAD_05.h中得到改进
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if (i == 2)
        {
            cout << "此页面没有下一页" << endl;
            system("pause");
        }
        else if (i == 3)
        {
            cout << "此页面没有前一页" << endl;
            system("pause");
        }
        else if (i == 4)
        {
            int i = Page.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal(0);
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo()//购买商品主页面
{
    skin.GetSkinData();//读取本地文件数据
    skin.SaveSkinData();
    Page.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)//使用头文件方法给列表添加物品
        Page.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")");
    Page.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        Page.DisplayList();
        int i = Page.InsertAction();
        if (i == 1)//页面功能将在ICUF_HEAD_05.h中得到改进
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if (i == 2)
        {
            cout << "此页面没有下一页" << endl;
            system("pause");
        }
        else if (i == 3)
            main();
        else if (i == 4)
        {
            int i = Page.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    Page.RemoveAll();
    Page.Append("继续");
    Page.Append("返回");
    Page.InitList();
    while (1)
    {
        system("cls");
        Col(rand() % 6 + 1); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Price (double) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(rand() % 6 + 1); cout << "是否继续购买?" << endl << endl; Col(0);
        Page.DisplayList();
        int i = Page.InsertAction();
        if (i == 1)//页面功能将在ICUF_HEAD_05.h中得到改进
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if (i == 2)
        {
            cout << "此页面没有下一页" << endl;
            system("pause");
        }
        else if (i == 3)
            BuyCargo();
        else if (i == 4)
        {
            int i = Page.CheckCurrent();
            if (i == 1)
                BuyCargo();
            else
            {
                cout << "请输入购买商品的数量(" << ISD[Id].ICUF_Name << ") :";
                int Number;
                cin >> Number;
                int List = (rand() % 10) * 100000 + (rand() % 10) * 10000 + (rand() % 10) * 1000 + (rand() % 10) * 100 + (rand() % 10) * 10 + (rand() % 10);
                fout.close();
                fout.open(Deals, ios::app);
                fout << List << " " << Id << " " << ISD[Id].ICUF_Id << " " << Number << " " << ISD[Id].ICUF_Price * Number << endl;
                fout.close();
                cout << "购买成功  你的购买订单号为 " << List << endl;
                cout << "List ID : " << List << "  Cargo ID : " << Id << "  ICUF ID : " << ISD[Id].ICUF_Id << "  Number : " << Number << "  Price : " << ISD[Id].ICUF_Price * Number;
                system("pause");
                BuyCargo();
            }
        }
    }   
}
void ChangeData()
{
    int CHO;
    cout << "请选择数据更改模式 (1.更改单一数据 2.完全重新修改数据 3.使用默认数据 4.添加数据 5.清理数据):";
    cin >> CHO;
    skin.SetSkinData(CHO);
}
void SearchDeal(int i)
{
    switch (i)
    {
    case 0:
        SearchDealShow();
        break;
    case 1:
        SearchDealById();
        break;
    }
}
void SearchDealById()
{
    int list, List[20]{}, Number[20]{}, Id[20]{}, ICUF_Id[20]{}, DataLength{ 20 };
    double price[20]{};
    cout << "请输入要查询的订单号 : ";
    cin >> list;
    fin.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        
    }
    fout.close();
    int flag{};
    for (int i = 0; i < DataLength; i++)
    {
        if (List[i] == list)
        {
            cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i];
            flag = 1;
        }
        if (flag == 0 && i == DataLength)
            cout << "不存在此订单!";
    }
    system("pause");
}
void SearchDealShow()
{
    int List[20]{}, Number[20]{}, Id[20]{}, ICUF_Id[20]{}, DataLength{ 20 };
    double price[20]{};
    fin.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        fin >> List[i] >> Id[i] >> ICUF_Id[i] >> Number[i] >> price[i];
        if (List[i] == 0)
        {
            DataLength = i;
            break;
        }
    }
    fin.close();
    fout.open(Deals);
    for (int i = 0; i < 20; i++)
    {
        if (List[i] == 0)
            break;
        fout << List[i] << " " << Id[i] << " " << ICUF_Id[i] << " " << Number[i] << " " << price[i] << endl;
        cout << "List ID : " << List[i] << "  Cargo ID : " << Id[i] << "  ICUF ID : " << ICUF_Id[i] << "  Number : " << Number[i] << "  Price : " << price[i] << endl;
    }
    fout.close();
    system("pause");
}

ICUF2 0.00.01.52

// ICUF 2.0 - 0.00.01.52  2021/5/25 23:11  6409 字数
// 对随机颜色和if的效率等细节优化
// 更改单一数据功能增加列表操作功能
// 现在使用系统初始数据会清除原有文件
// 数据更改模式新增清理数据功能

#include <iostream>
#include <fstream>
#include <string>
#include "ICUF_HEAD_04.h"
using namespace std;
const char* SDL = "SkinData_Local.txt";
const char* Deals = "ICUF_Deal_Local.txt";
ofstream fout;
ifstream fin;
FunctionList MainPage, BuyPage, BuyingPage;
void ChangeData();
struct ICUF_SkinData
{
    int ICUF_Id{ 0 };
    string ICUF_Name{};
    string ICUF_Float{};
    double ICUF_Price{};
};
ICUF_SkinData ISD[20];
class ICUF_Skin
{
public: FunctionList SetPageMode1;
public: void SetSkinData(int Mode)
{
    GetSkinData();
    if (Mode == 1)//更改单一数据功能
    {
        for (int i = 0; i < 20; i++)
        {
            if (ISD[i].ICUF_Id == 0)
            {
                LengthOfData = i;
                break;
            }
            cout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
        }
        int ISD_Id, ISD_Fun;
        Col(1); cout << "请输入要修改的物品的ICUF_Id :  ";
        cin >> ISD_Id; Col(0);
        SetPageMode1.RemoveAll();
        SetPageMode1.Append("1.ISD[i].ICUF_Id    (序号)");
        SetPageMode1.Append("2.ISD[i].ICUF_Name  (名称)");
        SetPageMode1.Append("3.ISD[i].ICUF_Float (磨损)");
        SetPageMode1.Append("4.ISD[i].ICUF_Price (价格)");
        SetPageMode1.InitList();
        while (1)
        {
            system("cls");
            Col(1); cout << "\n\n\n\n                         更改单一数据  WiChG_Trade             \n\n"; Col(0);
            SetPageMode1.DisplayList();
            int i = SetPageMode1.InsertAction();
            if (i == 3)
            {
                ChangeData();
            }
            else if (i == 4)
            {
                int i = SetPageMode1.CheckCurrent();
                ISD_Fun = i + 1;
                break;
            }
        }
        Col(1); cout << "请输入修改后的内容 :  ";
        switch (ISD_Fun)
        {
        case 1:
            cin >> ISD[ISD_Id].ICUF_Id;
            break;
        case 2:
            cin >> ISD[ISD_Id].ICUF_Name;
            break;
        case 3:
            cin >> ISD[ISD_Id].ICUF_Float;
            break;
        case 4:
            cin >> ISD[ISD_Id].ICUF_Price;
            break;
        }
        Col(0);
        SaveSkinData();
    }
    else if (Mode == 2)
    {
        int CHO;
        for (int i = 0; i < 20; i++)
        {
            cout << "ICUF_Id  :" << i + 1 << endl;
            ISD[i].ICUF_Id = i + 1;
            cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name;
            cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float;
            cout << "请输入 ICUF_Price (int) :";
            cin >> ISD[i].ICUF_Price;
            cout << "是否继续 ? 1.继续   2.退出 ";
            cin >> CHO;
            if (CHO == 2)
            {
                LengthOfData = i;
                break;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 3)//系统初始数据
    {
        RemoveData();
        for (int i = 0; i < 20; i++)
        {
            if (i == 0)
            {
                ISD[0].ICUF_Id = 1;
                ISD[0].ICUF_Name = "地下水";
                ISD[0].ICUF_Float = "久经沙场";
                ISD[0].ICUF_Price = 0.2;
            }
            else if (i == 1)
            {
                ISD[1].ICUF_Id = 2;
                ISD[1].ICUF_Name = "地下水";
                ISD[1].ICUF_Float = "略有磨损";
                ISD[1].ICUF_Price = 0.3;
            }
            else if (i == 2)
            {
                ISD[2].ICUF_Id = 3;
                ISD[2].ICUF_Name = "地下水";
                ISD[2].ICUF_Float = "崭新出厂";
                ISD[2].ICUF_Price = 0.4;
            }
            else if (i == 3)
            {
                ISD[3].ICUF_Id = 4;
                ISD[3].ICUF_Name = "狩猎网格";
                ISD[3].ICUF_Float = "久经沙场";
                ISD[3].ICUF_Price = 0.5;
            }
            else
            {
                ISD[3].ICUF_Id = NULL;
                ISD[3].ICUF_Name = "";
                ISD[3].ICUF_Float = "";
                ISD[3].ICUF_Price = NULL;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 4)
    {
        int CHO;
        for (int i = GetLength(); i < 20; i++)
        {
            cout << "ICUF_Id  :" << i + 1 << endl;
            ISD[i].ICUF_Id = i + 1;
            cout << "请输入 ICUF_Name (string) :";
            cin >> ISD[i].ICUF_Name;
            cout << "请输入 ICUF_Float (string) :";
            cin >> ISD[i].ICUF_Float;
            cout << "请输入 ICUF_Price (int) :";
            cin >> ISD[i].ICUF_Price;
            cout << "是否继续 ? 1.继续   2.退出 ";
            cin >> CHO;
            if (CHO == 2)
            {
                LengthOfData = i;
                break;
            }
        }
        SaveSkinData();
    }
    else if (Mode == 5)
    {
        RemoveData();
        for (int i = 0; i < 20; i++)
        {
            ISD[i].ICUF_Id = NULL;
            ISD[i].ICUF_Name = "";
            ISD[i].ICUF_Float = "";
            ISD[i].ICUF_Price = NULL;
        }
        SaveSkinData();
    }
}
public: void SaveSkinData()
{
    fout.open(SDL);
    for (int i = 0; i < 20; i++)
    {
        if (ISD[i].ICUF_Id == 0)
        {
            LengthOfData = i;
            break;
        }
        fout << ISD[i].ICUF_Id << " " << ISD[i].ICUF_Name << " " << ISD[i].ICUF_Float << " " << ISD[i].ICUF_Price << endl;
    }
    fout.close();
}
public: void GetSkinData()
{
    fin.open(SDL);
    for (int i = 0; i < 20; i++)
    {
        fin >> ISD[i].ICUF_Id >> ISD[i].ICUF_Name >> ISD[i].ICUF_Float >> ISD[i].ICUF_Price;
    }
    fin.close();
}
public:int GetLength()
{
    return LengthOfData;
}
private: void RemoveData()
{
    remove(SDL);
    remove(Deals);
}
private:int LengthOfData{};
};
ICUF_Skin skin;
void BuyCargo();
void BuyingCargo(int Id);
void ChangeData();
void SearchDeal();
int main()
{
    MainPage.RemoveAll();
    MainPage.Append("购买商品");
    MainPage.Append("查询订单");
    MainPage.Append("系统管理");
    MainPage.Append("退出系统");
    MainPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        MainPage.DisplayList();
        int i = MainPage.InsertAction();
        if (i == 1)
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if (i == 2)
        {
            cout << "此页面没有下一页" << endl;
            system("pause");
        }
        else if (i == 3)
        {
            cout << "此页面没有前一页" << endl;
            system("pause");
        }
        else if (i == 4)
        {
            int i = MainPage.CheckCurrent();
            if (i == 0)
                BuyCargo();
            else if (i == 1)
                SearchDeal();
            else if (i == 2)
                ChangeData();
            else if (i == 3)
                exit(1);
        }
    }
}
void BuyCargo()
{
    skin.GetSkinData();
    skin.SaveSkinData();
    BuyPage.RemoveAll();
    for (int i = 0; i < skin.GetLength(); i++)
        BuyPage.Append(ISD[i].ICUF_Name + "  (" + ISD[i].ICUF_Float + ")");
    BuyPage.InitList();
    while (1)
    {
        system("cls");
        Col(1); cout << "\n\n\n\n                         欢迎来到ICUF购物平台  WiChG_Trade             \n\n"; Col(0);
        BuyPage.DisplayList();
        int i = BuyPage.InsertAction();
        if (i == 1)
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if (i == 2)
        {
            cout << "此页面没有下一页" << endl;
            system("pause");
        }
        else if (i == 3)
            main();
        else if (i == 4)
        {
            int i = BuyPage.CheckCurrent();
            BuyingCargo(i);
        }
    }
}
void BuyingCargo(int Id)
{
    BuyingPage.RemoveAll();
    BuyingPage.Append("继续");
    BuyingPage.Append("返回");
    BuyingPage.InitList();
    while (1)
    {
        system("cls");
        Col(rand() % 6 + 1); cout << " ICUF_Id (int) :" << ISD[Id].ICUF_Id << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Name (string) :" << ISD[Id].ICUF_Name << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Float (string) :" << ISD[Id].ICUF_Float << endl; Col(0);
        Col(rand() % 6 + 1); cout << " ICUF_Price (int) :" << ISD[Id].ICUF_Price << endl; Col(0);
        Col(rand() % 6 + 1); cout << "是否继续购买?" << endl << endl; Col(0);
        BuyingPage.DisplayList();
        int i = BuyingPage.InsertAction();
        if (i == 1)
        {
            cout << "此页面没有上一页" << endl;
            system("pause");
        }
        else if 
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
网上超市购物管理系统,具体功能如下: 1、商品基本信息 1)商品代码,商品名称,商品价格,商品库存。 2)设计约定:可以假定超市有 N 种商品,在系统启动时将这些商品信息加载到商品库中。 2、顾客信息 1)普通顾客属性:ID(顾客代码)(随机生成或流水号) 2)普通会员:ID(会员代码),会员姓名,会员电话,会员积分。 3)高级会员:ID(会员代号),会员姓名,会员电话,会员积分,副卡 ID。 3、购物管理 1)为每一个普通顾客生成临时顾客代码。 2)普通会员购买商品时,可享受 9.8 折,普通顾客在单次购物满 1000 元,添加个人基本信息后,可成为普通会员。 3)高级会员购买商品时,可享受 9.5 折,普通顾客在单次购物满 2000 元,添加个人基本信息后,或普通会员单次购物满 1000 元可成为高级会员。普通会员和高级会员可查询 1 年内的购物详单,会员购物积分按照 1 元 1 分计。 4)每次购物后,输出购物清单。包括顾客代号(会员代码)、商品的名称、代号、单价、折扣、数量、价格以及合计价格、购买时间。 4、店铺管理 1)实现商品信息的添加、修改、删除、查询的功。可查询库存少于一定数量的商品。 2)实现会员资料的查询、修改、删除;实现会员整理的功能,对于 1 年内无购物的会员,进行自动删除。 3)可以按照时间区间统计,包括:销售总额;分类统计商品的销售情况;统计对会员的让利情况。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WiChP

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值