Your horse has to have 1 ounce of probiotic supplement a day. You can buy it per
pound, as a 10 lb pail at a 10% discount, or as a 20 lb pail at a 15% discount. Your
goal is to produce formatted output showing the daily cost for each buying
option. You should ask the user to enter the price per lb.
#include<iostream>
using namespace std;
int main()
{
int A,option;
float P;
cout<<"Enter the price of the supplement: ";
cin>>A;
cout<<"\nEnter the buying option \n1. 10 lb pail\n2. 20 lb pail"<<endl;
cin>>option;
if(option==1)
{
P=A-(0.1*A);
cout<<"The daily cost is: "<<P<<" pounds";
}
else if(option==2)
{
P=A-(0.15*A);
cout<<"The daily cost is: "<<P<<" pounds";
}
else
{
cout<<"Invalid option!";
}
}
Comments
Leave a comment