写了一个c++的文件 停车场管理系统,错误很多?

//在存储信息的时候,数组这里总是有问题,写到文件里面的数据只有一个,然后在查找数据的时候还会引发异常,有没有人能帮我看看怎么回事?
//主函数
#include<iostream>
using namespace std;
#include"SIZE.h"
#include"UandM.h"
#include<string>
#include"TIME.h"
#include"INFO.h"
int main()
{
	Size a;
	UanM b;
	int choice;
	while (true)
	{
		a.start();
		a.mainmenu();//开始界面
		cin >> choice;
		switch (choice)
		{
		case 1://用户
		{
			a.usermenu();
			b.user();
		}
			break;
		case 2: //管理员
		{
			cout << "请输入密码:";
			string mm ;
			cin >> mm;
			if(mm=="1234567")
			{ a.managemenu();
			b.manage();}
			else {
				cout << "密码错误,请重新输入!";
					system("pause");
					system("cls");
			}
			 }
			break;
		case 0: {
			cout << "欢迎下次使用!";
			system("pause");
			exit(0);
		}
			break;
		default:
			system("pause"); 
			system("cls");
			break;
		}

	}
	cout << "感谢使用!"<<endl;
	system("pause");
	system("cls");
	return 0;
}
//用户及管理员的头文件和cpp
#pragma once
#include"SIZE.h"
using namespace std;
class UanM :public Size
{
public:
	void user();
	void manage();
};
#include"UandM.h"
#include"SIZE.h"
void UanM::user()
{
	Size c;
	int choice;
	cin >> choice;
	switch (choice)
	{
	case 1:c.add(); break;
	case 2:c.dele(); break;
	case 0:system("pause");//按任意键继续
		system("cls");//清屏
		break;
	default:system("pause");//按任意键继续
		system("cls");//清屏
		break;
	}
}
void UanM::manage()
{
	Size d;
	int choice;
	cin >> choice;
	switch (choice)
	{
	case 1:d.show(); break;//显示
	case 2:d.select(); break;//查找
	case 3:d.change(); break;//修改
	case 4:break;//清空
	default:
		system("pause");//按任意键继续
		system("cls");//清屏
		break;
	}
}
//计算时间类
#pragma once
class classTime
{
public:
	classTime() { P = 0, r = 0, d = 0, h = 0, l = 0, s = 0; };
	classTime(int p, int m, int n, int x, int e, int z) { P = p, r = m, d = n, h = x, l = e, s = z; };
	friend int dTime(classTime& t1, classTime& t2);
	friend int transeTime(classTime& t);
private:
	int P, r, d, h, l, s;
};
#include"Time.h"
int dTime(classTime& t1, classTime& t2)
{
	int delta = transeTime(t2) - transeTime(t1);
	return delta;
}
int transeTime(classTime& t)
{
	return t.r * 365 * 24 * 60 * 60 + t.d * 24 * 60 * 60 + t.h * 60 * 60 + t.l * 60 + t.s;
}
//信息类
#include"INFO.h"
#include<string>
using namespace std;
INFO::INFO()
{
	string no=" ", phone=" ", type=" ";
	int time[6] = { 0 };
}
#include"INFO.h"
#include<string>
using namespace std;
INFO::INFO()
{
	string no=" ", phone=" ", type=" ";
	int time[6] = { 0 };
}
//实现管理系统相关操作的类
#pragma once
#include<iomanip>
#include<fstream>
#include<windows.h>
#include<TIME.h>
#include<iostream>
using namespace std;
#include"INFO.h"
#include"TIME.h"
#define MAX 1000
class Size:public INFO
{
public:
	INFO wm[MAX];
	//Size();
	//~Size();
	int num=0;
	void mainmenu();
	void usermenu();
	void managemenu();
	void add();//添加,可以
	void dele();//删除
	void select();//查找  可以
	void change();//修改信息 可以
	void show();//显示所有信息 可以
	void save();//写到文件里面 可以
	int isexist() 
	{
		string no;
		cout << "请输入车牌号:";
		cin >> no;
		for (int i = 0; i < num; i++)
		{
			if (wm[i].no == no)
				return i;
			else
			{
				cout << "没有查询到该号码,请检查后重新输入。";
				return -1;
			}
		}
	}
	//void output();//将文件中的数据存储到数组中  可以
	void get_size();//记录个数  可以
	int fee(int);//计算费用   可以
	void start();//显示数量
	void zeor();//清空



};
#include<iomanip>
#include<fstream>
#include"SIZE.h"
#include<windows.h>
#include<TIME.h>
#include<iostream>
#include<string>
using namespace std;
#define NAME "停车场管理系统.txt"
//Size::Size()
//{
//
//}
//Size::~Size()
//{
//
//}
void Size::mainmenu()
{
	cout << "****************************************************" << endl;
	cout << "***************   欢迎使用XX车库   *****************" << endl;
	cout << "***************   1 用户           *****************" << endl;
	cout << "***************   2 管理员         *****************" << endl;
	cout << "***************   0 结束           *****************" << endl;
}
void Size::usermenu()
{
	cout << "****************************************************" << endl;
	cout << "***************   1 进入车库       *****************" << endl;
	cout << "***************   2 离开车库       *****************" << endl;
	cout << "***************   0 返回           *****************" << endl;
}
void Size::managemenu()
{
	cout << "****************************************************" << endl;
	cout << "***************   1 显示用户信息   *****************" << endl;
	cout << "***************   2 查找用户       *****************" << endl;
	cout << "***************   3 修改用户信息   *****************" << endl;
	cout << "***************   4 清除所有信息   *****************" << endl;
	cout << "***************   0 返回           *****************" << endl;

}
void Size::add()
{
	SYSTEMTIME st;//定义本地时间变量,该变量为结构体
	GetLocalTime(&st);//获取本地时间函数,参数为时间变量指针
	string n, p, t;
	int m[6] = { 0 };
	cout << "请输入您的车牌号:" << endl;
	cin >>n;
	cout << "请输入您的有效联系方式:" << endl;
	cin >> p;
	cout << "-------------------------------" << endl;
	cout << "--    请选择您停车的方式     --" << endl;
	cout << "-- 1、临时停车 2、长期停车   --" << endl;
	int style_choice = 0;
	cin >> style_choice;
	switch (style_choice)
	{
	case 1:t= "临时"; break;
	case 2:t= "长期"; break;
	default:system("pause");
		system("cls"); break;
	}
	m[0] = st.wYear;
	m[1] = st.wMonth;
	m[2] = st.wDay;
	m[3] = st.wHour;
	m[4] = st.wMinute;
	m[5] = st.wSecond;
   // isFileempty = false;//表示当前停车场不为空
	cout << "登记成功!" << endl;
	get_size();
	wm[num].no = n, wm[num].phone = p, wm[num].type = t, wm[num].time[0] = m[0], wm[num].time[1] = m[1], wm[num].time[2] = m[2], wm[num].time[3] = m[3], wm[num].time[4] = m[4], wm[num].time[5] = m[5];
	this->save();
	//按任意键继续后清屏
	system("pause");
	system("cls");
}
void Size::save()
{
	ofstream ofs;
	ofs.open(NAME, ios::out);
	for (int i = 0; i <=num; i++)
	{
		ofs << this->wm[i].no << " " << this->wm[i].phone << " " << this->wm[i].type << " " << this->wm[i].time[0] << " " << "年" << " " << this->wm[i].time[1] << " " << "月" << " " << this->wm[i].time[2]<< " " << "日"<<" " << this->wm[i].time[3] << " " << "时" << " " << this->wm[i].time[4] << " " << "分" << " " << this->wm[i].time[5] << " " << "秒"<< endl;
	}
	ofs.close();
}
void Size::show()
{
	fstream myfile(NAME, ios::in | ios::out);
	string line;
	if (myfile.fail()) {
		cerr << "打开文件出错!" << endl;
		exit(-1);
	}
	while (getline(myfile, line))
	{
		cout << line << endl;
	}
		
}
//void Size::output()
//{
//	ifstream ifs;
//	ifs.open(NAME, ios::in);
//	string no, call, Type;
//	int Time[6],i=0;
//	while (ifs >> no && ifs >> call && ifs >> Type && ifs >> Time[0] && ifs >> Time[1] && ifs >> Time[2] && ifs >> Time[3] && ifs >> Time[4] && ifs >> Time[5])
//	{
//		wm[i].no = no, wm[i].phone = phone, wm[i].type = Type, wm[i].time[0] = Time[0], wm[i].time[1] = Time[1], wm[i].time[2] = Time[2], wm[i].time[3] = Time[3], wm[i].time[4] = Time[4], wm[i].time[5] = Time[5];
//		i++;
//	}
//}
void Size::get_size()
{
	ifstream ifs;
	ifs.open(NAME, ios::in);
	int n= 0;
	string no, call, Type,t;
	int Time[6];
	while (ifs >> no && ifs >> call && ifs >> Type && ifs >> Time[0]&& ifs >>t && ifs >> Time[1] && ifs >>t && ifs >> Time[2]  && ifs >>t && ifs >> Time[3]  && ifs >>t && ifs >> Time[4] && ifs >>t && ifs >> Time[5] && ifs >> t)
	{
		n++;//一行一行的统计数量
	}
	num = n;
	
}
int Size::fee(int a)
{
	int _time[6] = { 0 };//存放出去时间的数组
	SYSTEMTIME st;//定义本地时间变量,该变量为结构体
	GetLocalTime(&st);//获取本地时间函数,参数为时间变量指针
	_time[0] = st.wYear;
	_time[1] = st.wMonth;
	_time[2] = st.wDay;
	_time[3] = st.wHour;
	_time[4] = st.wMinute;
	_time[5] = st.wSecond;
	classTime t1(wm[a].time[0], wm[a].time[1], wm[a].time[2], wm[a].time[3], wm[a].time[4], wm[a].time[5]);
	classTime t2(_time[0], _time[1], _time[2], _time[3], _time[4], _time[5]);
	return dTime(t1, t2);
}
void Size::dele()
{
	int b = isexist(); 
	get_size();
	double c = -1;//标志停车类型
	if (wm[b].type == "临时")
		c = 1;
	else c = 0.5;
	for (int i = 0; i < num; i++)
		{
			wm[i] = wm[i + 1];
		}
	
	this->num--;//数量减少
	int b1 = fee(b);
	cout << "您的停车时长为:" << b1 << "秒," << "应当缴纳费用为:" << c * b1 << endl;
		this->save();//更新删除后的名单
	system("pause");
	system("cls");
}
void Size::select()
{
	int b = isexist();
	cout << "车牌:" << wm[b].no << "电话:" << wm[b].phone << "类型:" << wm[b].type << "停车时间:" << wm[b].time[0] << "年" << wm[b].time[1] << "月" << wm[b].time[2] << "日" << wm[b].time[3] << "时" << wm[b].time[4] << "分" << wm[b].time[5] << "秒";
}
void Size::change()
{
	cout << "下面请输入要修改的用户车牌:" << endl;
	int b = isexist();
	cout << "1 修改车牌 " << endl;
	cout << "2 修改联系方式" << endl;
	cout << "3 修改类型" << endl;
	cout << "0 返回" << endl;
	int choice;
	cin >> choice;
	switch (choice)
	{
	case 1: {
		string newno;
		cout << "请输入修改后的车牌号:";
		cin >> newno;
		wm[b].no = newno;
		this->save();
	}break;
	case 2:
	{
		string newno;
		cout << "请输入修改后的联系方式:";
		cin >> newno;
		wm[b].phone = newno;
		this->save();
	}break;
	case 3:
	{
		int newno;
		cout << "请选择修改后的类型:";
		cout << "1 临时  2 长期 ";
		cin >> newno;
		if(newno==1)
		wm[b].type ="临时";
		else wm[b].type = "长期";
		this->save(); }break;
	case 0:exit(0); break;
	default:
		system("pause");
		system("cls");
		break;
	}
}
void::Size::start()
{
	ifstream ifs;
	ifs.open(NAME, ios::in);
	if (!ifs.is_open())//当文件不存在
	{
		cout << "停车场系统名单文件不存在!" << endl;
		this->num = 0;
		//this->isFileempty = true;
		ifs.close();
		return;
	}
	char ch;
	ifs >> ch;
	if (ifs.eof())//文件存在,但是里面没有数据
	{
		cout << "停车场系统名单文件为空!" << endl;
		this->num = 0;
		//this->isFileempty = true;
		ifs.close();
		return;
	}
	//文件存在,并且写有数据
	this->get_size();
	cout << "当前停车场停放车辆的数量为:" << num << endl;
}

 

img


这个文件没有?