Answered step by step
Verified Expert Solution
Question
1 Approved Answer
So i am unable to figure out what i did incorrectly problem is in C++ can anyone help me? here's an image of the problem
So i am unable to figure out what i did incorrectly problem is in C++ can anyone help me? here's an image of the problem and a picture of my code and a photo of my errors.
Given two integers, say a and b, the maximum and minimum can be determined with the following formulas: max=2a+b+abmin=2a+bab Write a complete C++ program that will read in two integer values. For simplicity, the first of the values read in should be stored in the variable a and the second in b. The program should then compute the max and min of a and b using the above formulas. The values of a, b, max, and min should be displayed to the screen as shown in Figure 2. Hint: include the cmath header file. Use the function abs(ab) for calculating the absolute value (ab). For example, if x holds the value 15 then abs (x) returns 15. Figure 1: (sample input) 8945 Figure 2: (sample output for above input) Maximum of 89 and 45 is 89 Minimum of 89 and 45 is 45 3.4.1: Lab 12: Max and Min 0/10 \#include \#include using namespace std; int main() \{ II add integer variable int a; int b; II read in integer values cin >>a; cin > b; II calculation for max (a) and min (b) with use of abs max=(a+b+abs(ab))/2 min=(a+babs(ab))/2 II read output statement coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started