Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COSC 1436 Exercise Problems Purpose: To familiarize yourself with variables and arithmetic . Directions: Convert the following problems below to c++ equivalent code. The first

COSC 1436 Exercise Problems Purpose: To familiarize yourself with variables and arithmetic.

Directions: Convert the following problems below to c++ equivalent code. The first one will be done for you by the instructor. Each problem should be done within the same file and all within the same main function. After each step is performed the user should be shown the updated value that was changed. Turn in the finished c++ (.cpp) file for problem 0-6 and the image file for problem 7. Remember to reset or use unique variables for each problem (you cannot declare a variable by the same name twice). In each problem, the user will enter a number(s) on the first step only.

Problem 0:

1. Take as input any number that the user enters (cin >> varname) 2. Multiply the number by 2 3. Add 10 to the number 4. Divide the number by 2 5. Subtract 5 from the number 6. The result should be the original number (if not then we did something wrong)

Problem 1:

Take any number the user enters Add 3 to the number Multiply the number by 2 Subtract 6 from the number Divide by 2 The result should be the original number

Problem 2:

Enter a random number Store the input number for later use (as another variable) Multiply the number by 3 Add 45 to the number Multiply the number by 2 Divide the number by 6 Subtract the original number from your previous answer The result should be 15

Problem 3:

Take any 2 digit number from 31 to 99. (You do not have to check the numbers just assume the user will enter a valid number so long as you tell them to). Store an extra copy of this number for later 3. Add 82 to the number. 4. Remove the hundreds place from your number (by modulus operation) 5. Add 1 to the number. 6. Subtract this from your original number (stored in step 2). 7. Output the result obtained

Problem 4:

1. Select two, single digit, numbers, the first being in the range 2 to 6 and the second being in the range 1 to 9. 2. Multiply the first number by five. 3. Add three to that number. 4. Double the number. 5. Add the second number to your previous step. 6. Subtract 6 from the new total and: The tens place should be the first number given and the ones place should be the second.

Problem 5:

Take a random number from the user Multiply the number by 4 Add 1 to the number Multiply by the original number that the user input Subtract the original number away Take the square root of the number (you can use cmaths sqrt function) Divide the number by 2 The result should be the original number

Problem 6:

Get a random number from the user Remember the original number Add 3 to the number Double the number and then multiply by 5. Knock off the last digit (remove the 1s place) Finally remove the original number What is the result?

Problem 7:

1: Have the person write down any three digits number with decreasing digits (432 or 875). 2: Reverse the number you wrote in #1. 3: Subtract the number obtained in #2 from the number you wrote in #1 (#1 - #2) 4: Reverse the number obtained in #3 5: Add the numbers found in #3 and #4 What is the answer?

Problem 8:

For this problem I want you to draw out a flow chart to illustrate the logic. You may use word, DIA, or any other software you choose but be specific on the symbols used to illustrate this problem. If you use hand drawn, make sure the paper is unlined and that your picture of it is clear and legible. Please submit this problem as an image file Take any random 2 digit number Divide the number by 2 Add 17 to the number If the first digit (10s place) of the number is greater than the last than add the first digit to the number, otherwise add the second digit (1s place) If the number is greater than 21 subtract the product of the 2 digits. Repeat this until the number is less than 21 Output the results of the number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions

Question

What section defines the term name, and what is the definition?

Answered: 1 week ago

Question

friendliness and sincerity;

Answered: 1 week ago