*I have a problem with the output of my code. I'm supposed to input this values:
Acme Software, Inc.
1000
45.50
56.90
*With my current code, the output is this:
Company: Acme Software, Inc.
Shares: 1000
Purchase/share: $45.5
Cost of Stock: $45500
Cost of Commission: $1137.5
Total cost: $46637.5
Sale/Share: $56.9
Income from stock: $56900
Cost of Commission: $1422.5
Total income: $55477.5
Gain or loss: $8840
*But I can't get my output to like the one below with the 0's at the end of the numbers. For example, Purchase/share:$45.5, should be Purchase/share: $45.50, and Gain or loss: $8840, should be Gain or loss: $8840.00.
Company: Acme Software, Inc.
Shares: 1000
Purchase/share: $45.50
Cost of stock: $45500.00
Cost of commission: $1137.50
Total cost: $46637.50
Sale/share: $56.90
Income from stock: $56900.00
Cost of commission: $1422.50
Total income: $55477.50
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.
Use this before your first cout that has a decimal number to print: