{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

tutorial06.pptx - CSCI 1120 Introduction to Computing Using...

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

View Full Document Right Arrow Icon
CSCI 1120 Introduction to Computing Using C++ Tutorial 6: Quiz Solution LI, Le SHB 1013 [email protected] 1
Background image of page 1

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

View Full Document Right Arrow Icon
Outline About Quiz Q1~Q3 Distribute papers 2
Background image of page 2
About Quiz Quiz mean: ~67 Quiz std: ~15 3
Background image of page 3

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

View Full Document Right Arrow Icon
Q1a 4 Increase ‘’ in namespace A by 1 Decrease ‘’ in global by 1 Results: 6 24 Lec06 Scope
Background image of page 4
Q1b 5 Results: 7 4 5 20 12 12
Background image of page 5

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

View Full Document Right Arrow Icon
Q1b-Hints(1) 6 Reference variable Same content but different name with referenced variable Function return by reference int &foo(...) Return a reference of the returned variable Default arguments foo(y) foo(y, 2) static variable Initialize only the first time Only visible in the initialization scope (still alive in other scop e, but can’t see it directly) Lec05 function && Lec06 Scope
Background image of page 6
Q1b-Hints(2) 7 x y z Static z 3 4 - - x y Static z 3 4 3 3->7 4 - 6->10 3->7 4 3 7 4->3 3 7 3 3->6
Background image of page 7

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

View Full Document Right Arrow Icon
Q1b-Hints(2) 8 x y z Static z 7 3 - 10 x y Static z 3 2 10 7 5 5 2 10 5 2->1 10 5 1 20 20 (z ≡ static z) 7 5 5
Background image of page 8
Q1b-Hints(2) 9 x y z Static z 7 3 5 x y Static z 5 1 5 7 3 12 5->6 1 5->6 6 0 6 6->12 1 6->12 x ≡ static z
Background image of page 9

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

View Full Document Right Arrow Icon
Q1c 10 Lec06 Scope Results: 2 1 1 2 Change line
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}