① 2到c語言編程題
已私信,請採納。
② C語言做的股票保本價計算工具,為啥算出來的結果和手動用計算器算的不一樣求大神檢查下語句~~
#include <stdio.h>
double buy_price,sell_price;
short n;
int main(void)
{
while(1)
{
printf("\n買入單價: ");
scanf("%lf",&buy_price);
printf("\n買入數量: ");
scanf("%d",&n);
/*傭金為交易金額萬分之三,最低5元;過戶費為股票數量的0.06%,最低0.6元*/
/*印花稅為賣出總金額的0.1%*/
if
(n<=1000 && n*buy_price<=10000)sell_price = (buy_price + 5.6/n) / 0.999;
else if
(n<=1000 && n*buy_price>10000)sell_price = (buy_price + 3/10000*buy_price + 0.6/n) / 0.999;
else if
(n>1000 && n*buy_price<=10000)sell_price = (buy_price + 5/n + 0.6/1000) / 0.999;
else if
(n>1000 && n*buy_price>10000)sell_price = (buy_price + 3/10000*buy_price + 0.6/1000) / 0.999;
else sell_price = 12345 ;
printf("\n保本價 = %lf\n",sell_price);
}
return 0;
}
③ c語言個人股票管理系統,只要運行結果和分析,有嗎親
給個郵箱
發給你
④ C語言做的股票保本價計算器,怎麼都不對
雖然我不知道你的傭金是多少,不過
sell_price = (buy_price + 5.6/quantity)*(1000/999);
這句我覺得有明顯錯誤
buy_price + 5.6 這里你是想先加了之後再除以數量吧,那要給個括弧
((buy_price + 5.6)/quantity)
⑤ C語言(股價預測函數)
#include <stdlib.h>
#include <time.h>
float prediction(float x, int n){//從x隨機行走n步
static float delta=0.01;
static char first=1;//定義靜態局部變數
int i;
if(first){//如果第一次運行
srand(time(NULL));//用系統時間初始化隨機數發生器
first=0;
}
for(i=0;i<n;++i){
x+=rand()/(1.0+RAND_MAX)*2*delta-delta; //x加上一個[-Δ,Δ)之間的隨機小數
}
return x;
}
⑥ C語言程序設計:股票交易系統
課程設計?
⑦ C語言輸出購買總價值和數量。
第一個空,int num = 0, price = 0, num = 0;
第二個空,scanf("%d, %d", &num, &price);
最先面的printf改成printf("total=%d, num=%d\n", total, num);
⑧ C語言:在證券公司可以買賣股票、基金,但是交易成本不同。滬深A股:印花稅0.1%,傭金0.15%,其中滬A另收
傭金票1.5太高的,可以做到萬一的!
看我美麗的簽名!
⑨ 跪求c語言高手幫忙解答一個問題~~!!!期末用的!!
親手給你寫的,汗!
#include <stdio.h>
#include <stdlib.h>
typedef struct
{
char stockname[16];
float coeffi;
float price_per;
float est_price;
} STOCK;
void calc(STOCK stock_arr[],int n)
{
int i;
for(i=0;i<n;i++)
stock_arr[i].est_price=stock_arr[i].coeffi * stock_arr[i].price_per;
}
void InputData(STOCK st)
{
char buff[128];
char *p;
for(int i=0;i<5;i++)
{
puts("請輸入數據");
gets(buff);
p=strtok(buff,"");
memcpy(st[i].stockname,p);
p=strtok(NULL,"");
st[i].coeffi=atof(p);
p=strtok(NULL,"");
st[i].price_per=atof(p);
}
}
OutputResult(STOCK st)
{
puts("Results are as follows:");
puts("=============================");
puts("股票名稱\t股票估格\n");
for(int i=0;i<5,i++)
printf("%s\t%f",st[i].stockname,st[i].est_price);
}
void main()
{
STOCK stoc[5];
InputData(stoc);
calc(stoc,5);
OutputResult(stoc);
}
⑩ 急求一道c語言的股票題
某家公司上市,2000年每股收益1元,相比於1999你那,每股收益的增長率是100%。
往後每年,每股收益增長率以每年10個百分點的速度下降,最後穩定在10%。
某人在2000年以靜態市盈率為20的股價買入這家股票5000股,一直持有到2015年賣出。
假設賣出的股價相當於靜態市盈率為10.計算:總共賺到多少錢?這15年的平均年華收益率是多少?
靜態市盈率:當前股價/之前那年的每股收益。