⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stock.cpp

📁 课程设计做的个人股票管理系统
💻 CPP
字号:
#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"



Stock::Stock(long stkCode1, char stkName1[], long stkIss1,
			 double stkOriPrice1, double stkPrice1)
{
	stkCode = stkCode1;
	strcpy(stkName, stkName1);
	stkIss = stkIss1;
	stkOriPrice = stkOriPrice1;
	stkPrice = stkPrice1;
	stkRange = 0;
	stkRank = 0;
}

//从文件中提取数据给对象赋值,尝试()的重载。  -->成功
Stock Stock::operator ()(char fileName[])
{
	ifstream fin(fileName);
	if (!fin)
	{
		cout<<"cannot open"<<endl;
		//exit(0);
	}
	//fin.open((const char *)this, sizeof(Stock));
	fin.seekg(-sizeof(Stock), ios::end);				//“-”似有隐患
	fin.read((unsigned char *)this, sizeof(Stock));
	fin.close();
	return *this;
}

⌨️ 快捷键说明

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