Write the code and trace for the following:
1. Design an algorithm that will receive input of two integers and display to the screen their sum, difference, product, and quotient. Do not allow division by zero to occur.

2. Design an algorithm that will read two numbers and an integer code from the screen (print a menu of the choices first). If the code is 1, compute the sum of the two numbers. If the code is 2, compute the difference of the first number minus the second. If the code is 3, compute the product. If the code is 4 and the second number is not 0, compute the quotient (divide the first number by the second). If the code is not 1,2,3, or 4, display an error message. Finally, display the two numbers, the code, and the result (echo the input).

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <cstdlib>
#include <iostream>
using namespace std;

int main(int argc, char** argv) {
    int integer1;
    int integer2 = 0;
    cout<<"Enter the first integers: ";
    while (integer2 == 0) {
       cout<<"Enter the second integers: ";
$1.25 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats