freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

簡易股票投資管理系統(tǒng)說明-資料下載頁

2025-04-09 05:21本頁面
  

【正文】 列印交易記錄結果 break。 default: printf(無效的選項\n)。 break。 } break。 case 39。q39。: /*********儲存投資組合結果**********/ save_portfolio(my_pfo,index)。 /*********儲存交易記錄結果**********/ save_trade(trade,index)。 /*************結束程式**************/ exit(1)。 default: printf(無效的選項\n)。 break。 } }}void load_stock(struct STOCKINFO stock[],FILE *fp) //讀入個股資訊{ int i。 for(i=1 。 i=STOCK_NUM 。i++ ) { fscanf(fp,%d,amp。stock[i].code)。 //個股代碼 fscanf(fp,%s,amp。stock[i].name)。 //個股名稱 fscanf(fp,%f,amp。stock[i].price)。 //個股現(xiàn)價 fscanf(fp,%f,amp。stock[i].equity)。 //股本(億) fscanf(fp,%f,amp。stock[i].EPS)。 //EPS stock[i].ratio = stock[i].price/stock[i].EPS。 //本益比=現(xiàn)價247。EPS fscanf(fp,%s,amp。stock[i].netvalue)。 //個股淨值 }}void load_club(struct CLUB clubs[],FILE *fp){ int i。 for(i=1 。 i=CLUB_NUM 。i++ ) { fscanf(fp,%d,amp。clubs[i].id)。 //讀入會員ID fscanf(fp,%s,amp。clubs[i].name)。 //讀入會員名稱 fscanf(fp,%d,amp。clubs[i].pwd)。 //讀入會員密碼 }}int load_pfo(struct PORTFOLIO my_pfo[],FILE *fp){ int i,j。 int num。 fscanf(fp,%d,amp。num)。 //讀入投資組合種類個數(shù) for(i=1 。 i=num 。i++ ) { fscanf(fp,%d,amp。my_pfo[i].code)。 fscanf(fp,%s,amp。my_pfo[i].name)。 fscanf(fp,%d,amp。my_pfo[i].mount)。 fscanf(fp,%f,amp。my_pfo[i].price_avg)。 //讀入個股買進歷史平均價 fscanf(fp,%f,amp。my_pfo[i].price_now)。 //讀入個股現(xiàn)價 for(j=1。j=my_pfo[i].mount。j++) { fscanf(fp,%f,amp。my_pfo[i].price_buy[j])。 //讀入個股之買進價格 } } fscanf(fp,%d,amp。profit_real)。 //讀入『已實現(xiàn)損益』 return num。 //傳回『投資組合種類個數(shù)』}int load_trade(struct REPORT trade[],FILE *fp){ int i。 int num。 fscanf(fp,%d,amp。num)。 //讀入『交易記錄個數(shù)』 for(i=1 。 i=num 。i++ ) { fscanf(fp,%d,amp。trade[i].code)。 fscanf(fp,%s,amp。trade[i].name)。 fscanf(fp,%d,amp。trade[i].mount_buy)。 fscanf(fp,%f,amp。trade[i].price_buy)。 fscanf(fp,%d,amp。trade[i].mount_sell)。 fscanf(fp,%f,amp。trade[i].price_sell)。 } return num。 //傳回『交易記錄個數(shù)』}int search_stock(struct STOCKINFO stock[],int choice){ int i。 for(i=1 。i=STOCK_NUM 。i++ ) { if(stock[i].code==choice) { return i。 //搜尋正確,則傳回該輸入代碼之pointer } } return 1。 //搜尋不到該代碼,傳回1}int search_club(struct CLUB clubs[],int choice){ int i。 for(i=1 。i=CLUB_NUM 。i++ ) { if(clubs[i].id==choice) { return i。 //搜尋正確,則傳回該輸入代碼之pointer } } return 1。 //搜尋不到該代碼,傳回1}int search_pfo(struct PORTFOLIO my_pfo[],int choice){ int i。 for(i=1 。i=rec_pfo 。i++ ) { if(my_pfo[i].code==choice) { return i。 //搜尋正確,則傳回該輸入代碼之pointer } } return 1。 //搜尋不到該代碼,傳回1}void trade_buy(struct STOCKINFO stock[],struct PORTFOLIO my_pfo[],struct REPORT trade[]){ int i。 int code。 //輸入用_股票代號 int result1,result2。 //結果值_儲存Search傳回值 float price_buy。 //輸入用_買進價格 int m。 //輸入用_張數(shù) int temp。 //temp用 float temp_sum=0。 //temp用_加總 printf(請輸入股票代碼)。 scanf(%d,amp。code)。 printf(請輸入購買價格)。 scanf(%f,amp。price_buy)。 printf(請輸入購買張數(shù)(若不購買請輸入1))。 scanf(%d,amp。m)。 printf(\n)。 result1=search_pfo(my_pfo,code)。 //搜尋投資組合中是否有該代碼 if(result1==1) { result2=search_stock(stock,code)。 //搜尋股票資料中是否有該代碼 if(result2==1) { printf(無此代碼,請從新選擇\n)。 } else { if(m0 amp。amp。 price_buy0) //價格,張數(shù)是否合理 { /***************在投資組合中記錄買進動作**********/ rec_pfo=rec_pfo+1。 //投資組合種類+1 my_pfo[rec_pfo].code=stock[result2].code。 strcpy(my_pfo[rec_pfo].name,stock[result2].name)。 my_pfo[rec_pfo].mount=m。 //記錄買進張數(shù)my_pfo[rec_pfo].price_now=stock[result2].price。 /*記錄買進個股現(xiàn)價:計算未實現(xiàn)損益用*/ for(i=1。i=m。i++) { my_pfo[rec_pfo].price_buy[i]=price_buy。 //記錄買進價格 } my_pfo[rec_pfo].price_avg=price_buy。 //記錄買進歷史平均價 /***************在交易記錄檔中記錄買進動作**********/ rec_trade=rec_trade+1。 //交易記錄+1 trade[rec_trade].code=stock[result2].code。 strcpy(trade[rec_trade].name,stock[result2].name)。 trade[rec_trade].mount_buy=m。 trade[rec_trade].price_buy=price_buy。 printf(紀錄順利,請繼續(xù)使用\n)。 } else { printf(請重新選擇\n)。 } } } else { if(m0 amp。amp。 price_buy0) //價格,張數(shù)是否合理 { /***************在投資組合中記錄買進動作**********/ temp=my_pfo[result1].mount+1。 my_pfo[result1].mount=my_pfo[result1].mount+m。 //修改買進張數(shù) for(i=temp。i=my_pfo[result1].mount。i++) { my_pfo[result1].price_buy[i]=price_buy。 //記錄買進價格 } for (i=1。i=my_pfo[result1].mount。i++) //計算買進歷史平均價 { temp_sum=temp_sum+my_pfo[result1].price_buy[i]。 } my_pfo[result1].price_avg=temp_sum/my_pfo[result1].mount。/*記錄買進歷史平均價*/ /***************在交易記錄檔中記錄買進動作**********/ rec_trade=rec_trade+1。 trade[rec_trade].code=my_pfo[result1].code。 strcpy(trade[rec_trade].name,my_pfo[result1].name)。 trade[rec_trade].mount_buy=m。 trade[rec_trade].price_buy=price_buy。 printf(紀錄順利,請繼續(xù)使用\n)。 } else { printf(請重新選擇\n)。 } }}void trade_sell(struct STOCKINFO stock[],struct PORTFOLIO my_pfo[],struct REPORT trade[]){ int i。 int code。 //輸入用_股票代碼 int result。 //結果值_儲存Search傳回值 float price_sell。 //輸入用_賣出價格 int m。 //輸入用_張數(shù) int temp。 //temp用_紀錄位置 int temp_cal。 //temp用_計算實際交易價差 printf(請輸入股票代碼)。 scanf(%d,amp。code)。 printf(請輸入賣出價格)。 scanf(%f,amp。price_sell)。 printf(請輸入賣出張數(shù)(若不賣出請輸入1))。 scanf(%d,amp。m)。 printf(\n)。 result=search_pfo(my_pfo,code)。 //檢查輸入代碼是否在投資組合中 if (result==1) { printf(無該股票庫存記錄\n)。 } else { if(m0amp。amp。price_sell0) { if((my_pfo[result].mountm)0) // CASE1:庫存張數(shù)賣出張數(shù) { /*****在投資組合中修改張數(shù),平均價並計算已實現(xiàn)損益******/ my_pfo[result].mount=my_pfo[result].mountm。 temp_cal=(price_sellmy_pfo[result].price_avg)*m*1000。 printf(此次交易實現(xiàn)損益=%d\n,tem
點擊復制文檔內容
公司管理相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1