Module 1 Lab - Operator - Challenge Lab

 Objective

In this lab, you will create a C++ program that prompts the user to enter two numbers. The program will perform various operations using these numbers, such as addition, subtraction, multiplication, division, and modulus. It will display the results of these operations to the user.

 Requirements

Task 1: User Input

  • Prompt the user to enter the first number.

  • Prompt the user to enter the second number.

Task 2: Arithmetic Operations

  • Perform the following operations using the entered numbers:

    • Addition (+)

    • Subtraction (-)

    • Multiplication (*)

    • Division (/)

    • Modulus (%)

Task 3: Display Results

  • Display the entered numbers and the results of the arithmetic operations in a well-formatted manner.

Lab Instructions:

  1. Declare the required variables to store the two numbers entered by the user.

  2. Prompt the user to enter the first number using an appropriate input statement.

  3. Prompt the user to enter the second number using another input statement.

  4. Perform the addition operation using the '+' operator and store the result in a variable.

  5. Perform the subtraction operation using the '-' operator and store the result in a variable.

  6. Perform the multiplication operation using the '*' operator and store the result in a variable.

  7. Perform the division operation using the '/' operator and store the result in a variable.

  8. Perform the modulus operation using the '%' operator and store the result in a variable.

  9. Use appropriate output statements to display the entered numbers and the results of the arithmetic operations in a well-formatted manner.

Deliverable

Upload the following:

  1. Full source code (.txt or .cpp)

  2. Screenshot of the Console with the code executing

COSC-1336 / ITSE-1302 Computer Science - Author: Dr. Kevin Roark