other.cpp

来自「课程设计做的个人股票管理系统」· C++ 代码 · 共 50 行

CPP
50
字号
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#include "Stock.h"
#include "GuestStock.h"
#include "Guest.h"



//把买卖后股票信息实时写入文件中		//注:time has been considered yet
void Update(Stock &stkObj)
{
	ofstream fout;
	//fout.open(stkObj.GetStkName(), ios::out|ios::app);
	fout.open(stkObj.GetStkName(), ios::out);				//这个也暂且改成覆盖
	//	fout.write((const unsigned char *)&time, sizeof(time));
	fout.write((const unsigned char *)&stkObj, sizeof(Stock));
	//fout.put('\n');
	fout.close();
}

//把买卖后用户信息实时写入文件中		//注:time has been considered yet
void Update(Guest &guestObj)
{
	ofstream fout;
	//fout.open(guestObj.GetGuestName(), ios::out|ios::app);		//用于追加历史信息
	fout.open(guestObj.GetGuestName(), ios::out);					//用于覆盖文件,是解决文件过大时无此用户的权宜之计
	//	fout.write((const unsigned char *)&time, sizeof(time));
	fout.write((const unsigned char *)&guestObj, sizeof(Guest));
	//fout.put('\n');
	fout.close();
}



void About()
{
	cout<<"created by chen shujie"<<endl
		<<"press any key to return to main menu"<<endl;
}

void Error()
{
	cout<<"您的输入有误,按任意键返回上一层菜单。"<<endl;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?