У меня возникли проблемы с написанием инструкции «if» «else», с которой я столкнулся, но она не будет выполняться при запуске программы.если инструкции 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», чтобы определить значение налога на продажу для выбора на основе регионального кода.
Я полностью потерял часть «если» «еще».
Что вопрос вы столкнулись? –
'if (region_0 <= 0.0);'? Что это такое? Почему пустые блокируют пару строк ниже? Пожалуйста, отформатируйте свой код. – Mat
Ваши скобки неправильны к концу. –