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

Info icon This 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
Image of page 1

Info icon This 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
Image of page 2
About Quiz Quiz mean: ~67 Quiz std: ~15 3
Image of page 3

Info icon This 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
Image of page 4
Q1b 5 Results: 7 4 5 20 12 12
Image of page 5

Info icon This 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
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
Image of page 7

Info icon This 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
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
Image of page 9

Info icon This 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
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 ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern