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

正文內(nèi)容

簡易股票投資管理系統(tǒng)說明(編輯修改稿)

2025-05-06 05:21 本頁面
 

【文章內(nèi)容簡介】 choice){ int i。 for(i=1 。i=STOCK_NUM 。i++ ) { if(stock[i].code==choice) { return i。 //搜尋正確,則傳回該輸入代碼之pointer } } return 1。 //搜尋不到該代碼,傳回1}Ⅷ 【Print】副程式程式功能說明參數(shù)傳回值view_info()列印個股詳細資料struct STOCKINFO stock[]:儲存資料的陣列無print_stock()列印個股基本資訊struct STOCKINFO stock[]:儲存資料的陣列無print_portfolio( )列印投資組合struct PORTFOLIO my_pfo[]:儲存資料的陣列無print_trade( )列印交易記錄struct REPORT trade[]:儲存資料的陣列無程式碼:在此僅舉print_stock為例,其他程式與其類似void print_stock(struct STOCKINFO stock[]) //列印個股基本資訊{ int i。 printf(代碼\t名稱\t代碼\t名稱\t代碼\t名稱\t代碼\t名稱\n)。 for(i=1 。 i=STOCK_NUM 。i++ ) { printf(%d\t,stock[i].code)。 //列印代碼 printf(%s\t,stock[i].name)。 //列印名稱 if ((i%4)==0) //檢查i247。4的餘數(shù)是否為0 { printf(\n)。 //假如其餘數(shù)為0,則斷行 } } printf(\n)。}流程圖:在此僅舉view_info(),此為查詢的主要功能Ⅸ 【Save】副程式程式功能說明參數(shù)傳回值save_portfolio( )儲存投資組合紀錄struct REPORT trade[]:儲存資料的陣列int index:無save_trade( )儲存交易記錄struct REPORT trade[]:儲存資料的陣列int index:程式碼void save_portfolio(struct PORTFOLIO my_pfo[],int index) //儲存手中持有投資組合{ FILE *pfo_file。 int i,j。 if (index==1) //假如會員id為1 { pfo_file = fopen(, w)。 // } else if (index==2) //假如會員id為2 { pfo_file = fopen(, w)。 // } fprintf(pfo_file,%d\n,rec_pfo)。 //儲存投資組合種類個數(shù) for(i=1 。 i=rec_pfo 。i++ ) { fprintf(pfo_file,%d\t,my_pfo[i].code)。 //儲存代碼 fprintf(pfo_file,%s\t,my_pfo[i].name)。 //儲存名稱 fprintf(pfo_file,%d\t,my_pfo[i].mount)。 //儲存張數(shù) fprintf(pfo_file,%f\t,my_pfo[i].price_avg)。 //儲存買進歷史平均價 fprintf(pfo_file,%.2f\n,my_pfo[i].price_now)。 //儲存現(xiàn)價 for(j=1。j=my_pfo[i].mount。j++) { fprintf(pfo_file,%.2f ,my_pfo[i].price_buy[j])。 //根據(jù)張數(shù),逐一儲存買進價格 } fprintf(pfo_file,\n)。 } fprintf(pfo_file,%d\n,profit_real)。 //儲存已實現(xiàn)損益 fprintf(pfo_file,\n)。 fclose(pfo_file)。 //關(guān)閉檔案}Ⅹ 【其他】int calculate_pfo(struct PORTFOLIO my_pfo[])程式功能:計算未實現(xiàn)損益主要計算公式:Σ(現(xiàn)價歷史平均價)*張數(shù)*1000參數(shù):struct PORTFOLIO my_pfo[]傳回值:temp_sum加總後之值程式碼:int calculate_pfo(struct PORTFOLIO my_pfo[]) //計算未實現(xiàn)投資損益{ int i。 int temp_sum=0。 //temp用_加總 for(i=1 。 i=rec_pfo 。i++ ) { temp_sum=temp_sum+(my_pfo[i].price_nowmy_pfo[i].price_avg)*my_pfo[i].mount*1000。 //(現(xiàn)價平均價)*張數(shù)*1000 } return temp_sum。 //傳回加總後之值}char Pause()。程式功能:按下Enter繼續(xù)程式碼:char Pause(){ char c。 printf(\n按Enter繼續(xù)...)。 scanf(%c,amp。c)。 while(c!=39。\n39。) //若不是按下Enter,而按下其他鍵,則傳回該鍵 { return c。 } //唯有按下Enter,程式繼續(xù)執(zhí)行}完整程式碼include define STOCK_NUM 20 //定義:股票數(shù)量 20define PFO_NUM 20 //定義:投資組合數(shù)量 20define TRADE_NUM 100 //定義:交易記錄數(shù)量 100define CLUB_NUM 5 //定義:會員資料 100struct STOCKINFO { int code。 char name[80]。 float price。 float equity。 float EPS。 int ratio。 char netvalue[10]。 }。struct PORTFOLIO { int code。 char name[80]。 int mount。 float price_avg。 float price_now。 float price_buy[50]。 }。struct REPORT { int code。 char name[80]。 int mount_buy。 float price_buy。 int mount_sell。 float price_sell。 }。 struct CLUB{ int id。 char name[80]。 int pwd。 }。/*******************************定義下列副程式*********************************/void manager_main(struct CLUB clubs[])。int user_exam(struct CLUB clubs[])。void user_main(int index,struct STOCKINFO stock[],struct PORTFOLIO my_pfo[],struct REPORT trade[])。void trade_buy(struct STOCKINFO stock[],struct PORTFOLIO my_pfo[],struct REPORT trade[])。void trade_sell(struct STOCKINFO stock[],struct PORTFOLIO my_pfo[],struct REPORT trade[])。void load_stock(struct STOCKINFO stock[],FILE *fp)。void load_club(struct CLUB clubs[],FILE *fp)。int load_pfo(struct PORTFOLIO my_pfo[],FILE *fp)。int load_trade(struct REPORT trade[],FILE *fp)。int search_stock(struct STOCKINFO stock[],int choice)。int search_club(struct CLUB clubs[],int choice)。int search_pfo(struct PORTFOLIO my_pfo[],int choice)。void view_info(struct STOCKINFO stock[])。void print_stock(struct STOCKINFO stock[])。void print_portfolio(struct PORTFOLIO my_pfo[])。void print_trade(struct REPORT trade[])。void save_club(struct CLUB clubs[])。void save_portfolio(struct PORTFOLIO my_pfo[],int index)。void save_trade(struct REPORT trade[],int index)。char Pause()。int calculate_pfo(struct PORTFOLIO my_pfo[])。/******************************Glbal Variables*****************************/int profit_real。 //記錄已實現(xiàn)損益int rec_pfo。 //紀錄手中持有投資組合的種類int rec_trade。 //紀錄交易記錄的次數(shù)main(){ FILE *stock_file。 FILE *club_file。 struct STOCKINFO stock[STOCK_NUM+1]。 struct PORTFOLIO my_pfo[PFO_NUM+1]。 struct REPORT trade[TRADE_NUM+1]。 struct CLUB clubs[CLUB_NUM+1]。 char choice。 //主選單之選項 int pwd。 //輸入選項用_password int user_id。 //輸入選項用_user_id /*************open stock file****************************/ if(stock_file = fopen(, r)) { load_stock(stock,stock_file)。 //呼叫副程式:讀入股票檔內(nèi)容 } else { printf(無法開啟股票資料檔,程式終結(jié)!\n)。 //無法開啟,程式終結(jié) exit(1)。 //離開程式 } fclose(stock_file)。 //關(guān)閉讀檔 /*************open club file****************************/ if(club_file=fopen(,r)) { load_club(clubs,club_file)。 } else { printf(開檔失敗,程式終結(jié)!\n)。 exit(1)。 } fclose(club_file)。 printf(=========================================================)。 printf(\n)。 printf( 歡迎使用簡易個人股票管理系統(tǒng) )。 printf(\n)。 printf(請選擇登入身分 )。 printf(\n)。 printf(請選擇)。 scanf(%c,amp。choice)。 switch(choice) { ca
點擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1