计算机C语言编程问题,望高手相助!!

来源:百度知道 编辑:UC知道 时间:2024/06/05 22:14:38
开放式基金是一种委托投资理财产品。用户可以向基金管理机构购买/赎回基金,基金管理机构负责将基金投资于股票等金融产品获取收益,并收取一定的管理费用。假设某基金在成立时每份面值为1元,申购费率为1.5%,赎回费率为0.5%。则有如下规则:
1.每个用户购买时的金额必须大于等于1000,并且是1000的整数倍;
2.基金份额 = 购买金额×(1-申购费率)/份额面值;
3.基金运作后每天公布当日每份基金净值,如0.9871或者1.0121,则:
用户当前净值=基金份额×当日每份基金净值;
4.每日净值增长率=(当日每份基金净值-昨日每份基金净值)/昨日每份基金净值×100%;
5.浮动盈亏=用户当前净值×(1-赎回费率)-购买金额;
6.周平均净值 = 一周每日净值的和/工作日;
编写一个程序,要求用户输入在基金成立时的购买金额和基金运作第一周的每日份额净值,统计一周来用户的收益情况。例如,一次程序运行的情况如下:
Please input your money(>1000, and multiple): 1500
1500 is not multiple of 1000.
Please input your money(>=1000, and multiple): 10000
Please input everyday net value in this week:
0.9872 0.9935 1.0102 0.9905 1.0235
Quotient Net Value Increase Rate Current Value Current Payoff
9850 0.9872 -1.28% 9724 -325
9850 0.9935 0.64% 9786 -263
9850 1.0102 1.68% 9950 -99
9850 0.9905 -1.95% 9756 -292
9850 1.0235 3.33% 10081 31
Average Net Value in this week = 1.00098

#include "iostream.h"
void main()
{
int gmje;//购买金额
int day=5;//工作日数
double sgfl,shfl,femz,jjfe,dqjz[7],rjzl[7],fdyk[7],zjjz;
double rjz[7];//日每份净值
/* sgfl,收购费率,shfl,赎回费率
femz,份额面值
jjfe,基金份额
rjzl,每日净值增长率
dqjz,用户当前净值
fdyk,浮动盈亏
zjjz,周平均净值
*/
femz=1;
sgfl=0.015;
shfl=0.005;
cout<<"Please input your money(>1000, and multiple): ";
cin>>gmje;
if(gmje%1000!=0)
{
cout<<gmje<< "is not multiple of 1000. "<<endl;
cout<<"Please input your money(>1000, and multiple): ";
cin>>gmje;
}
cout<<"Please input everyday net value in this week:"<<endl;
for(int i=0;i<day;i++)
cin>>rjz[i];
jjfe=gmje*(1-sgfl)/femz;
double s=0;
for(i=0;i<day;i++)
{
dqjz[i]=jjfe*rjz[i];
fdyk[i]=dqjz[i]