Lab: Input, output, calculations
Chapter 2

Requirements

Create a C++ program that meets the following requirements:

  1. Place documentation comments at the beginning of the source code. These comments should include the course, your name, the date, and the assignment (Lab 1). Check the style guide for this course for details.
  2. Write a single statement (not three) using cout that will display the following three lines on the screen:
        Your name
        Programming Lab 1
        The current date
  3. Use cout to output a blank line to the screen.
  4. Define two variables of data type int. You may name them anything you want. Initialize them with the literal values 7 and -14
  5. Output the two integer variables and their product using the following format:
    7 * -14 = -98
    The result must be calculated by the program and you must be outputting the values of variables or expressions - NOT hard-coded values. Note that you will be outputting a combination of variables and literals (such as " * " to display the multiplication symbol). If your statement has any numeric literals in it (such as 7, -14, or -98), then it is incorrect.
  6. Define two variables of a floating point type (float or double). You may name them anything you want. Initialize them with the literal values 78.25 and 34.3
  7. Define a third variable of a floating point type (float or double). You may name it anything you want.
  8. Divide the first float variable by the second float variable and store the result in the third float variable.
  9. Output the floating point variables using the following format:
    78.25 / 34.3 = 2.2813
    The result must be calculated by the program and you must be outputting the values of variables - NOT hard-coded values. Note that you will be outputting a combination of variables and literals (such as " / " to display the division symbol). If your statement has any numeric literals in it (such as 78.25, 34.3, or 2.2813), then it is incorrect.

Points (10 points total)

Example run of program

Dave Klick
Programming Lab 1
2017-01-28

7 * -14 = -98
78.25 / 34.3 = 2.2813