注册 登录
编程论坛 C++教室

新手,求解答此问题,同事望给点学习c++的建议,感觉自己尽力了但是学不好

xjbmcx 发布于 2013-09-22 12:51, 574 次点击
#include<iostream>
using namespace std;
double tax(int net_income);
int main()
{
    int net_income;
    double tax_bill;
    double five_percent_tax,ten_percent_tax;
    cout<<"enter net income(rounded to whole dollars) $";
    cin>>net_income;
    if(net_income<=15000)
        tax_bill=0;
    else if((net_income>15000)&&(net_income<=25000))
        tax_bill=(0.05*(net_income-15000));
    else
    {
        five_percent_tax=0.05*10000;
        ten_percent_tax=0.10*(net_income-25000);
        tax_bill=(five_percent_tax+ten_percent_tax);
    }
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(2);
    cout<<"net income =$"<<net_income<<endl
        <<"tax bill=$"<<tax_bill<<endl;
    return 0;
}
这个程序里面cout<<"net income =$"<<net_income<<endl
        <<"tax bill=$"<<tax_bill<<endl;中<<"tax bill=$"为什不能写成<<"tax_bill=$"
5 回复
#2
peach54602013-09-22 14:05
好奇,我觉得可以写咧...
#3
3037709572013-09-22 17:42
为什么不能写?你的编译器是不是出了问题了吧?
#4
xjbmcx2013-09-22 18:13
回复 2楼 peach5460
我试过了,确实不可以。
#5
xjbmcx2013-09-22 18:15
亲们,谢谢了,确实是编译器出了问题,已经解决了。谢谢
#6
pauljames2013-09-23 08:25
可以写的
1