问答详情
源自:-

这个程序哪里错了???

#include<stdio.h>

#include<stdlib.h>

#include<math.h>

main()

{

    double deposit,capital,rate;

    int year;

    printf("Please enter year,capital:");

    scanf("%d,%lf",&year,&capital);

    switch(year)

    {

        case 1:rate=0.0225;break;

         case 2:rate=0.0243;break;

          case 3:rate=0.0270;break;

           case 5:rate=0.0288;break;

            case 8:rate=0.0300;break;

            defalut:printf("error rate!\n");

            exit(0);


    }

    deposit=capital*pow(1+rate,year);

    printf("rate=%f,deposit=%f\n",rate,deposit);

    return 0;

}


提问者:慕移动9341187 2015-11-26 15:19

个回答

  • 攻城没有狮
    2015-11-26 23:21:29
    已采纳

    scanf("%d,%lf",&year,&capital);
    scanf("%d,%lf",&year,&capital);逗号错了