"John Doe wants to earn more money by investing in the stock market. In order to play it safe, he employs the diversity investment plan; investing in different things rather than putting all his eggs in one basket. Therefore, he will buy shares from three different stocks each day when the stock market opens. As the stock market closes, he will sell some of his shares. This might not be the best move, but this is John's strategy. He records his transactions in a file using the following format:
Your task is to write a program that will help John analyze his investments. And, your program must perform the following tasks:
1. Prompt John for the name of his input file because he might use a different file for each day to help him keep track of all his transactions (see pg. 300, and other sources)
2. Prompt John for the name of his desired output file because he might use a different file for each day to keep track of his profit (see pg. 300, and other sources)
3. Compute the profit of each stock of the day by producing the following information all in one line for each stock into the output file
a. Stock Name (20 spaces, left justified)
b. Buying Cost (15 spaces, right justified)
c. Buying Commission (15 spaces, right justified)
d. Selling Amount (15 spaces, right justified)
e. Selling Commission (15 spaces, right justified)
f. Profit (15 spaces, right justified)
4. Once all stock data is processed, your system must display (in the output file) the following information (each in a separate line):
"
and this post keeps not posting so I won't waste anymore time typing anything else
Are you sure? When I compiled and ran your program it quite happily output 100, then "This is a test" in response to a pre-prepared file this.txt containing "100".
List the file directory from which you are running the program and check that there is a non-blank file file with this name. Also, check that the file that you thought had "100" in hasn't been corrupted by some previous non-running draft of the program.
You do repeat the import of header <string>, but that wouldn't cause your problems.