-1

我无法为我想出的写一个“if”“else”语句,但是当我运行程序时它不会执行。

#include <iostream>
using namespace std;
int main()
{
    double  vehicle_price, options_price, new_result, end_solution, sales_tax_region, v8_price, sales_tax;
    double region_0, region_1, region_2;

    // This where the sales person will ask the customer if a v8 is desired.
    cout << "vehicle_price:$"     ;
    cin >>  vehicle_price       ;
    cout <<  "options_price:$"  ;
    cin >> options_price       ;

    // At this time the customer would be asked which region they live in.

    //  enter 6.5 or 7.0 to indicate if region_1 or region_2 is where they live

    cout << "v8_price:$"   ;
    cin >> v8_price     ;
    cout << "sales_tax_region:"      ;
    cin >> sales_tax_region         ;

    // At this point the price of the v8 would be entered if it is required. 

    if (region_1 <= 500.00)
    {
        sales_tax= region_1 *.65; 
    }
    if (region_2 <= 550.0) 
    {
        sales_tax_region= region_2 * .70;
    }
    else
    {   
        if (region_0 <= 0.0);
    }
    sales_tax_region= region_1 * .65;
    {
    }
    new_result= (options_price + vehicle_price+ v8_price)*(sales_tax_region/100) ;
    end_solution = (new_result + options_price + vehicle_price);
    cout << "Total_price_of_the_vehicle:$"  << end_solution << endl ;

    return 0;
}

这是我正在使用的要求使用“if-else”结构来确定要使用的 V8 价格。使用另一个“if-else”结构来确定要根据区域代码选择的销售税值。

我完全迷失在“如果”“其他”部分。

4

1 回答 1

3

改变

else
{   
if (region_0 <= 0.0);
}
sales_tax_region= region_1 * .65;
{
}

else
if (region_0 <= 0.0) {
  sales_tax_region= region_1 * .65;
}
于 2013-06-22T11:10:47.810 回答