欢迎来到天天文库
浏览记录
ID:46886778
大小:63.00 KB
页数:8页
时间:2019-11-28
《股票交易管理》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、股票交易管理程序代码#include#includc#include#include#includeusingnamespacestd;#dcfincMAX5classStockfriendclassCustomer;private:charStockNamc[20];charStockCode[6];charchoice;intNumOfStock;longintStockVolume;longintVolumcAvailablc;public
2、:Stock();voidInterface();voidStockExchangeMarket();voidSwitchChoicc();voidInputForNewStock();};Stocks[MAX],temp;classCustomer{private:charCustomerName[30J;charPassword[10J;charShareHoldingName[3()];charSharcHoldingCodc[5];charAnyChar;longintShareHoldingValue;public:Cust
3、omer();voidLogin(char*,Customcr)const;voidRegister(Customer*);voidStockPortfolio(Customer)const;};Customer::Customer(){strcpy(Customer::CustomerName/rn);strcpy(Customer::ShareHoldingName,uM);strcpy(Customer::ShareHoldingCode/M);SharcHoldingValuc=0;}voidCustomer::Login(c
4、har^password,Customercust)const{ifstreamread_customer(ncustomer.dat");whilc(!rcad_customc匚cof()){read_customer.read((char*)(&cust),sizeof(cust));if(read_customer.fail()){cout«nNorecordatall!";break;}if(strcmp(password,cust.Password)==0)StockPortfolio(cust);}read_custome
5、r.close();}voidCustomer::Register(Customer*cust){systcm(Hclsn);cin.get();cout«Htt欢迎到交易市场开户!H«endl;cout«n—"vvendl;cout«H请输入您的姓名:”;cin.getline(CustomerName,30);cout«H情书您的密码(少于8个字符):”;cin»Password;cin.get();system(nclsH);cout«cndl«cndl;cout«n您的帐户己被建立,可以开始交易……n«endl;cout«
6、"按任意键开始u«endl;cin»AnyChar;}voidCustomcr::StockPortfoIio(Customcrcust)constStockshare[MAX],temp;Customers[MAX];inti;charch,AnyChar,ShareCodeL6J;longintvolume;start:system(nclsH);cout«cndl«cndl;cout«nttt欢迎返回!"«endl;cout«Htt股票交易系统M«endl;tt******«********sr**>**sr**>
7、**sr**>**Sr**>**Sr****Sr**•**Sr**•**Sr*cout«"tt用户:"«cust.CustomcrNamc«cndl«cndl;cout«Htt买股票[b]"«endl;cout«Htt卖股票[s]H«endl;cout«"tt查看用户帐户[vj"«endl;cout«ntt登出[q]H«endl;cout«endl«ntt输入您的选择:”;cin»ch;if((ch!=V)&&(ch!='s')&&(ch!='q'))gotostart;else{switch(ch){case
8、'b':{system("clsH);cout«ntt股票交易系统u«endl;cout«n名称tt交易代码t在册股数t可交易股数'vvendlvvendl;ifstreamdataFile(,,St
此文档下载收益归作者所有