首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

帮小弟我看看这段代码有什么有关问题?总是提示float b[5];出错

2012-04-17 
帮我看看这段代码有什么问题?总是提示float b[5]出错main(){longaprintf( pleaseinputyourmoney( 1000

帮我看看这段代码有什么问题?总是提示float b[5];出错
main()
{
long     a;
printf( "please   input   your   money   (> 1000,   and   multiple): ");
scanf( "%ld ",&a)   ;
while(a%1000)
{
        printf( "%ld   is   not   multiple   of   1000\n ",a);
        printf( "please   input   your   money   (> 1000,   and   multiple): ");
        scanf( "%ld ",&a)   ;
}
printf( "Please   input   everyday   net   value   in   this   week:\n ");
float   b[5];
int   i;
for(i=0;i <5;i++)
{
        scanf( "%f ",&b[i]);
}
printf( "Quotient         Net   Value           Increase   Rate         Current   Value         Current   Payoff\n ");
for(i=0;i <5;i++)
{
        float   c=a*(1-0.015)/1;
        float   d   =   1.0f;
        if(i> 0)
        {
              d=b[i-1];
        }
        float   e;
        e=b[i]       ;
        float   f=e/d-1;
        float   g=c*e;
        float   h=f*(1-0.005)-a;
        printf( "%f       %f       %f     %f       %f   \n ",c,e,f,g,h);
       
       
}
}

[解决办法]
你是C还是C++
C的话变量要在函数的最开始定义

如果是C++没有问题

热点排行