Description
The purpose of this challenge is to use the IF statement to control program flow and to use basic arithmetic expressions. This challenge simulates a rudimentary stock chart.
Requirements
- Take a glance at the Sample Interaction below to get an idea of how the code runs
- Declare a double variable called previous_price
- Declare a double variable called current_price
- Declare a string variable called symbol
- Declare a string variable called company
- Ask the user to enter a value for symbol
- Ask the user to enter a value for company
- Ask the user to enter a value for previous_price
- Ask the user to enter a value for current_price
- If the price of the stock has increased, show a message “It’s a bull market”
- If the price of the stock has decreased, show a message “It’s a bear market”
- if the price of the stock didn’t change, show a message “It’s a flat market”
- Also, as part of the message for steps 10 and 11, indicate the percentage change. (see below)
Formatting your output
- Include the <iomanip> header file. This will allow you to use various options to format your output. Add this line under your main include line. See below.
- It’s good practice to initialize variables to default values that make sense (for example, set fee to 0.00)
- Include the code below before any other cout lines. The setprecision(x) will display your decimal output with x decimal places.
Sample Interaction / Output
RUN IT AGAIN:
RUN IT AGAIN:
LEGEND
PROGRAM OUTPUT
USER ENTRY
FROM INPUT
CATALOG ID: CPP-FLOW0005
Print Requirements