0
thier is sth wrong in this code
 double groceries;   double vegetables;   double beverage; cout<<" Enter the price of groceries:  \n"; cin>>groceries; cout<<" Enter the price of vegetable:  \n"; cin>>vegetables; cout<<" Enter the price of beverage:  \n"; cin>>beverage; double amount_without_discount= groceries + vegetables + beverage ; double amount_with_discount = amount_without_discount â (amount_without_discount * 0.1); cout<<"Amount without discount = \n "<<amount_without_discount; cout<<"Amount with discount = \n"<<amount_with_discount;
2 Answers
+ 3
You have invalid characters in that code, which prevents the code from being compiled.
And you should replace the 'â' character with a hyphen '-' in the line where you calculate the discounted amount.
* Replace this line
double amount_with_discount = amount_without_discount â (amount_without_discount * 0.1);
* With this đ
double amount_with_discount = amount_without_discount - (amount_without_discount * 0.1);
Notice the use of hyphen on second example.
* You can also opt to do this instead.
double amount_with_discount = amount_without_discount * 0.9;
0
You can actually make your code easier to read by doing this:
double groceries, vegetables, beverage;