C语言出现 error C2143: syntax error : missing ';' before 'constant' 怎么解决??

程序出现
C:\Program Files\Microsoft Visual Studio\MyProjects\11\11.cpp(8) : error C2143: syntax error : missing ';' before 'constant'
C:\Program Files\Microsoft Visual Studio\MyProjects\11\11.cpp(9) : error C2143: syntax error : missing ';' before 'constant'
C:\Program Files\Microsoft Visual Studio\MyProjects\11\11.cpp(10) : error C2143: syntax error : missing ';' before 'constant'
C:\Program Files\Microsoft Visual Studio\MyProjects\11\11.cpp(12) : error C2143: syntax error : missing ';' before 'constant'
执行 cl.exe 时出错.#include <stdio.h>

下面是程序,请问我哪里错了?找了好久没找到啊
int main()
{
int i;
double a,b,c,d,e,f,cash;
a=0.1*i;
b=100000*0.1+(i-100000)0.075;
c=100000*0.1+100000*0.075+(i-200000)0.05;
d=100000*0.1+100000*0.075+200000*0.05+(i-400000)0.03;
e=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(i-600000)*0.015;
f=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.01+(i-1000000)0.01;
printf("请输入本月利润:/n");
scanf("%d",&i);
if(i<=100000)
cash=a;
else if(i<=200000)
cash=b;
else if(i<=400000)
cash=c;
else if(i<=600000)
cash=d;
else if(i<=1000000)
cash=e;
else if(1000000<i)
cash=f;
printf("本月奖金应发:%10.2f",cash);
return 0;
}

    错误比较多,你看下边的注释吧,如果还不对请追问,可行望采纳:

#include <stdio.h>//忘了加头文件

int main()

{

    int i;

    double a,b,c,d,e,f,cash;


    //这2行给你写前面了,具体原因往下看

    printf("请输入本月利润:\n");//反斜杠打错了吧?

    scanf("%d",&i);//你不先给 i 赋值,就直接使用 i ?

    a=0.1*i;


    //下边这几行有几个乘号忘了写啦

    b=100000*0.1+(i-100000)*0.075;

    c=100000*0.1+100000*0.075+(i-200000)*0.05;

    d=100000*0.1+100000*0.075+200000*0.05+(i-400000)*0.03;

    e=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(i-600000)*0.015;

    f=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.01+(i-1000000)*0.01;


    if(i<=100000)

        cash=a;

    else if(i<=200000)

        cash=b;

    else if(i<=400000)

        cash=c;

    else if(i<=600000)

        cash=d;

    else if(i<=1000000)

        cash=e;

    else if(1000000<i)

        cash=f;


    //你声明的是double类型,请使用"%lf",而不是"%f",还有最好加个回车

    printf("本月奖金应发:%10.2lf\n",cash);

    return 0;

 }


温馨提示:答案为网友推荐,仅供参考
相似回答