计算连板价

来源:互联网 发布:乐视max2 root软件 编辑:程序博客网 时间:2024/06/06 06:08
/** * program: * Authors: hao.l * Date: 2016/10/17 * Modify by: * * Desc: 杭州银行2-5个板后的价格(发行价14.39) 当日涨停为10% * 2:17.41 3021 * 3:19.15 4763 * 4:21.07 6678 * 5:23.18 8785 */#include <iostream>#include <string>using namespace std;const double ISSUE_PRICE=14.39;double getPrices(double,int);int main(){   for(int d=2;d<=5;d++){        double price=getPrices(ISSUE_PRICE,d);        cout<<"第"<<d<<"板:"<<price<<"获利:"<<(price-ISSUE_PRICE)*1000<<"\n";   }   cout<<endl;   return 0;}double getPrices(double price,int days){    double total=price;    for(int i=0;i<days;i++){        total*=1.1;    }    return total;}

0 0
原创粉丝点击