偏执♛的傲♀ 2022-04-20 23:36 采纳率: 75%
浏览 42
已结题

哪里错了,c语言最后几排有问题

#include<stdio.h>
#include <stdlib.h>
#include<math.h>
double futurelnvestmentValue(double investmentAmount,double monthlyInterestRate,int years);
int main()
{
double investmentAmount,yearlyInterestRate,years,monthlyInterestRate;
scanf("%lf,%lf,%lf",&investmentAmount,&yearlyInterestRate,&years);
for(years=1;years<=6;years++)
{
printf("%d\n",futurelnvestmentValue);

}
return 0;

}
double futurelnvestmentValue(double investmentAmount,double monthlyInterestRate,int years)
{
int yearlyInterestRate;
monthlyInterestRate=yearlyInterestRate/12;
futurelnvestmentValue=investmentAmountpow((1+monthlyInterestRate),(years12));
return futurelnvestmentValue;
}
编码哪里错了
若函数futureInvestmentValue( )用于计算投资的未来投资值,并且它的函数原型如下:double futurelnvestmentValue(double investmentAmount,

double monthlyInterestRate, int years);

●investmentAmount

投资额

monthlyInterestRate

月利率

●year

投资年限

, 未来投资额=投资额x(1 +月利率)年数x12

  • 写回答

1条回答 默认 最新

  • qzjhjxj 2022-04-21 00:30
    关注

    语法错误见注释处,未来投资额=投资额x(1 +月利率)年数x12 公式不全?逻辑错误因题目不全,未修改,供参考:

    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    double futurelnvestmentValue(double investmentAmount,double monthlyInterestRate,int years);
    int main()
    {
        double investmentAmount,yearlyInterestRate,years,monthlyInterestRate;
        scanf("%lf,%lf,%lf",&investmentAmount,&yearlyInterestRate,&years);
        for(years=1;years<=6;years++) //???
        {
             printf("%d\n",futurelnvestmentValue(investmentAmount,yearlyInterestRate,years));
             //printf("%d\n",futurelnvestmentValue);
        }
        system("pause");
        return 0;
    }
    double futurelnvestmentValue(double investmentAmount,double monthlyInterestRate,int years)
    {
        double  yearlyInterestRate;
            //int yearlyInterestRate;
            //monthlyInterestRate = yearlyInterestRate/12;
        yearlyInterestRate = investmentAmount * (1+monthlyInterestRate) * (years) * 12;
         //未来投资额=投资额x(1 +月利率)年数x12  公式不全?
            //futurelnvestmentValue=investmentAmount*pow((1+monthlyInterestRate),(years12));
        return  yearlyInterestRate;
           //return futurelnvestmentValue;
    }
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 4月29日
  • 已采纳回答 4月21日
  • 创建了问题 4月20日

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作