Evaluate the following C++ expressions where a, b, c are integers and d, f
are floating point numbers. The values are a = 5, b = 6 and d=3.5
(a)c = a + + - (b + +) * (--d)
(b)f = (++b) * b - a++
Answers
Answered by
5
Well here we make an assumption that the compiler we are using is turboC++ though that won't make much of a difference
Explanation:
c=a++ -(b++)*(--d)
=5(as a is post increment so no change) - 6(b is post ++) *(2.5)(d is pre --)
=5-15.0(as d was float so the c will be type casted to float none the less )
= -10.0
but as c is declared integer , output will be -10
Now f=7*7-5(first b gets pre incremented so next b is also 7 but a no change as it's post increment)=44
f won't be type casted as there are no data types of type float but as it is declared float, output will be 44.0
Don’t hesitate to consult for doubt in the comments below and Don't forget to mark it the brainliest if it helps.. #BAL #answerwithquality
Similar questions
Art,
6 months ago
Computer Science,
6 months ago
Biology,
11 months ago
Science,
11 months ago
Math,
1 year ago