Respuesta :
Answer:
#include <iostream>
using namespace std;
int main()
{
float price_of_pie;
float discounted_price;
cout << "Enter the price of pie: ";
cin >> price_of_pie;
if(price_of_pie >= 10){
discounted_price = price_of_pie - 3.14;
} else{
discounted_price = price_of_pie - 1;
}
cout << "Discounted price = " << discounted_price;
return 0;
}
Explanation:
Above program is written in C++ language which is calculating discounted price in which discounted price is counted through if else decision branch.
Below is the code of required C++ program.
C++ Language
Program code:
//Starting a program
//Header files
#include <iostream>
using namespace std;
//Defining a main function
int main()
{
// Initializing the value
float price_of_pie;
float discounted_price;
cout << "Enter the price of pie: ";
cin >> price_of_pie;
// Creating if-else loop
if(price_of_pie >= 10)
{
discounted_price = price_of_pie - 3.14;
}
else
{
discounted_price = price_of_pie - 1;
}
//Printing the discounted price
cout << "Discounted price = " << discounted_price;
return 0;
}
Explanation:
- Starting a program.
- Header files.
- Defining a main function.
- Initializing the value.
- Creating a loop.
- Printing the discounted price
- Program end.
Output:
Find below the attachment of the code output.
Find out more information about C++ here:
https://brainly.com/question/26081685
