Can someone figure this one out? I tried many times

Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at one time, is $200 or more, then the shipping and handling is free; otherwise, the shipping and handling is $10 per item. Design an algorithm that prompts Jason to enter the number of items ordered and the price of each item. The algorithm then outputs the total billing amount.

My program:
#include <iostream>
#include <iomanip>
using namespace std;

int main()
string mystr;
double price = 0.00;
int quantity = 0;
int total = 0.00;
double temp_price = 0.00;
cout << setprecision(2) << fixed << showpoint;

cout << "How many items are you purchasing? ";
cin >> quantity;

for (int i = 0; i < quantity; i++)
cout << "Please enter the price of the item. $";
cin >> temp_price;
price += temp_price;
if (price >= 200)
cout << "Your shipping is free" << endl;
total = price;
cout << "Shipping & Handling is: $" << quantity * 10 << endl;
total = price + (quantity * 10);
cout << "Your total fee is: $" << total << endl;

return 0;
it looks pretty good to me. what is the trouble?
Hey, you already have the solution, is there any issues you're getting? What compiler are you using?
The variable total should be a double.

When you post code, wrap it in code tags Add "[ code]" (without the space) before and "[ /code]" after the code you paste in. That will maintain indentation and add line number to make it easier for us to read an comment on your code.

The "<>" Format button does this for you. However, the format button seems to not work sometimes on an initial post. You can, however, go back and edit your post. Highlight the code, and click the format button.
Registered users can post here. Sign in or register to post.