Unit 07 Test - UNIT 7 TEST 1 What is output from the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: UNIT 7 TEST 1. What is output from the following program? int main() { int a=2, b=5, c=9; c+=b*a; cout << "First" << endl; cout << a << endl; cout << b << endl; cout << c << endl; { float b=6.2; int c; c = b/2+a*b; a += b-c; cout << "Second" << endl; cout << a << endl; cout << b << endl; cout << c << endl; } cout << "Third" << endl; cout << a << endl; cout << b << endl; cout << c << endl; return 1; } Along with the result, explain in your own words, how the concept of scope impacted the result. Along with the result, explain in your own words, how the concept of scope impacted the result. First 2 5 19 Second-6 6.2 15 Third-6 5 19 // Code is using the values defined in the first part to carry out calculations in first part. Then code is using the new defined values in the middle part to carry out the calculations. And in the third part code is using the new value for a which was calculated in middle part. But to calculate b and c, code is using the the new value for a which was calculated in middle part....
View Full Document

This note was uploaded on 10/02/2011 for the course ME 205 taught by Professor Koen during the Spring '07 term at University of Texas.

Page1 / 5

Unit 07 Test - UNIT 7 TEST 1 What is output from the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online