C语言初学者,求助啊!!请各位大佬指出错误并改正!!!
#include"stdio.h"#include"windows.h"#include"math.h"intmain(){doubler1,r2,r3,r4,r5,n,...
#include "stdio.h"
#include "windows.h"
#include "math.h"
int main()
{
double r1,r2,r3,r4,r5,n,p1,p2,p3,p4,p5,a,b;
scanf("%lf",&n);
r1=0.0414;r2=0.0468;r3=0.054,r4=0.0585,r5=0.0072;
p1=1000*(1+n*r4);
a=1000*(1+n*r2);
b=a*(1+n*r3);
p2=a+b;
a=1000*(1+n*r3);
b=a*(1+n*r2);
p3=a+b;
p4=1000*pow(1+r1,n);
p5=1000*pow(1+r5/4,4n);
printf("%lf\n%lf\n%lf\n%lf\n",p1,p2,p3,p4);
system("pause");
return 0;
}
G:\C\zz\P82.2\jj.cpp(17) : error C2059: syntax error : 'bad suffix on number'
G:\C\zz\P82.2\jj.cpp(17) : error C2146: syntax error : missing ')' before identifier 'n'
G:\C\zz\P82.2\jj.cpp(17) : error C2059: syntax error : ')' 展开
#include "windows.h"
#include "math.h"
int main()
{
double r1,r2,r3,r4,r5,n,p1,p2,p3,p4,p5,a,b;
scanf("%lf",&n);
r1=0.0414;r2=0.0468;r3=0.054,r4=0.0585,r5=0.0072;
p1=1000*(1+n*r4);
a=1000*(1+n*r2);
b=a*(1+n*r3);
p2=a+b;
a=1000*(1+n*r3);
b=a*(1+n*r2);
p3=a+b;
p4=1000*pow(1+r1,n);
p5=1000*pow(1+r5/4,4n);
printf("%lf\n%lf\n%lf\n%lf\n",p1,p2,p3,p4);
system("pause");
return 0;
}
G:\C\zz\P82.2\jj.cpp(17) : error C2059: syntax error : 'bad suffix on number'
G:\C\zz\P82.2\jj.cpp(17) : error C2146: syntax error : missing ')' before identifier 'n'
G:\C\zz\P82.2\jj.cpp(17) : error C2059: syntax error : ')' 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询