scan0004 - I'1’ If 1 MOCK EXAM 1:3 “3,71 k V 9 Gwen an...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: I '1’] If 1 \ MOCK EXAM . 1:3} “3,71 k»; V 9. Gwen an STL list<char>, usé 1te'rators to display’ [the list. The list should be created from the _ .; 5.. 7 mm»: r“; elementsofachararray. @055 (i 1-‘(4'3 A?! ,‘ eri‘ttf "it , \C xi; 9- 5 5" - 531515 x - .39": a i n vi. 5 J , q 4 ‘52 3L (p Mk (4 3‘ ‘fit 3" A" (\t - : 3' ” ’ 7 t f: A 7; _ _”" 4"?“ . pt} 10. class Storage J “:3 {i g ? [77575537 { 7‘ I: 5 (M3 5 d: t .J' public: 11 ilk it: .9; it: "’ int getInt() const {return stored;} ”" . . i void change(int x) {stored = x;} 1/ ‘. .- 5: ,,.,‘,;'r°. Q'hfitfi'flfn} :4. £13,; 5‘ 3‘ '.-,,~ 5,; A .. ” :»\ private: ‘ f _ §qn§ a}! I“ :1 31.1.?! 5 :r'hlifif int stored; “my“, 1" a " ' }; {A For the above class, overload the following operators for the Storage class: ' a) post-decrement operator—- as a non-member non-frie 4;) x 2% 33m ,5 5 wtt W” ‘03 ., \ it (“N ‘l "a r " x? ' ) a. < xiiifl‘i" e12.” rim-t5, _, 9A,? 3', ‘5" l 5“ 3 ' I 4“ ~ “qk - ~2f§hwew$ '- J N: i M ’9 «- Lr?! ';"‘ .4; \ ' x 5 5 \J. "- « b J 19‘s.“: "-_'l" 313‘“ b) pre—increment operator++ as a memben A {ta 59W . .4 ”it" 5 game: """ 9Y3: ' " l ‘3 ‘ “’ l". Skfiwa J 3. ‘ I w 3‘": war {3 .fi": 11. Write a templated function count that takes an iterator pointing to the beginning of a data range, an iterator pointing to the end of the range (past the last element), and a value. The function returns the amount of times that value occurs in the range. 471)”? m (A 3:545 . i e 75, {-7}. .; 1’2: 7/ K' . r. .. .5 . 3,. 3. - 1 ‘ ‘ £(: i V W ,';,-.v’.55€,.55;r “G inn‘i' L’fh'mfwgigfl -- "T-‘I. r‘w' f2? Lfiuxi’iji V“ 1‘: 33:53»; " / Q " § 5 _ 9“ t" _. 55’” f a} ’3- 15 5.L willie“: “*3" *" » .15? ngiftg}3 ‘ 2'} 5 2‘35 . ““1 " "I __.‘ 1w2. Write code to model the relationship and association between a pet and a person. You should write the Person and Pet classes. Both should have constructors. In our universe all pets are born strays and sadly do not have owners at birth (but strangely do have names). However, every person in our 2.. «N i1 . .. .. universe is benevolent and has the ability to adopt a pet. A Person can have any of 3 kinds of pets; .< i-‘t' 77.5% ' ' Dogs, Cats, and Hedgehogs To distinguish between these pets, they each make a different sound: "\ m 5k i; 1’ 33.13% imp";- j Dogs say “Woof”, Cats say “Meow”, Hedgehogs say “I’m blue and fast. And NOT a co - I u . "1‘ ' ‘31; .t i "’ via}; infringement! - CNN. PG? \ilt’i "a .. 5m » " kilé Pt 5 a,“ V3133 att_3g‘»‘" (33%;.- W H g. Q ‘ ,3 AA}. 1:333:51 {5.55.7753 AAA; 5; I M 3— ‘ ' 7- Sixwt ”we. a,\ M ,. ‘ ‘ Chi“! Afmtt 7 “33;; t 3.532%; MKWX~5-VV\GL*-H,3 V2 75.55“. {1%} Y“? V“’°"}L iC :5 Final Exam Rev1ew~5Page4 A 5' PM“? \ :3 7 ' Fit?" , 3 2 fr: 5 .3523: awe-fl f’ I.-':; 5 ,.- ... .-._, pinata Jae?“ «mm»: it“? n55; . i” MU‘e’WF . ; ” int“? " m. ‘ [______i ...
View Full 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