① 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年的平均年华收益率是多少?
静态市盈率:当前股价/之前那年的每股收益。