using namespace std;
int main()
{
price, sold, profit, final;
//price of the initial investment on your ounce
cout << "How much did you pay for your ounce? ";
cin >> price;
//how many bags ($20) did you sell?
cout << "How many $20 bags did you sell?
cin >> sold;
//this section will calculate the profit from the sold bags
profit = sold * 20
//this section will subtract the amount paid for your ounce by the profit to determine your total profit
final = profit - price;
cout << "Your total net profit is $ << final <<endl;
return 0;
_getch();
}
You will need to declare your variables data type.
For example:
1 2 3 4
int price;
int sold;
int profit;
int final;
And you missed out a few things.
For example: cout << "How many $20 bags did you sell?";
instead of cout << "How many $20 bags did you sell?
I have edited your code, hope this helps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
int main()
{
int price, sold, profit, final;
//price of the initial investment on your ounce
cout << "How much did you pay for your ounce? ";
cin >> price;
//how many bags ($20) did you sell?
cout << "How many $20 bags did you sell?";
cin >> sold;
//this section will calculate the profit from the sold bags
profit = sold * 20;
//this section will subtract the amount paid for your ounce by the profit to determine your total profit
final = profit - price;
cout << "Your total net profit is $ " << final << endl;
system("pause"); //pause the system, so that you can see the output
return 0;
_getch();
}