Class Notes (1,051,109)
US (414,190)
U of M (7,102)
ENGR (63)
Lecture 7

ENGR 101 Lecture 7: Introduction C++

12 pages116 viewsFall 2017

Department
Engineering
Course Code
ENGR 101
Professor
Jeffrey Ringenberg
Lecture
7

This preview shows pages 1-3. to view the full 12 pages of the document.
!"#$%&'()#&*+&,*-#&#)-.&/(01&2&.#3(,*'*)4&
-
!2,1&5$*6$23&.02$0.&/(01&7()07&2)-&89&2)-&#)-.&/(01&:4
-
;&,*35('#$&(.&2&5$*6$23&0120&0$2).'20#.&0*&*01#$&5$*6$23.&+$*3&1<32)=+$(#)-'%&
5$*6$23()6&'2)6<26#.&()0*&32,1()#&,*-#4&
-
>1#&+($.0&,*35('#$&/2.&-(.,*"#$#-&?%&@$2,#&A*55#$4&
-
B0.&)23#&2)-&(0.&0%5#&
§
B0&'#0.&01#&,*35('#$&C)*/&2?*<0&01#&"2$(2?'#.D
-
>1#&,*35('#$&5$#52$#.&3#3*$%&+*$&01#&"2$(2?'#4
-
>%5#&)23#G&
H2.(,&.%)02I&(.D
-
E*<&32%&5$*"(-#&2)&()(0(2'(J#$& #I5$#..(*)&+*$&2&-#,'2$20(*)4&
-
>%5#&)23#&K&#I5$#..(*)G
>1(.&,2)&?#&2&.()6'#&"2'<#9&?<0&(0&,2)&2'.*&?#&-#$("#-&+$*3&*01#$&"2$(2?'#.&*$&2)&2$?(0$2$%&
#I5$#..(*)4&
-
B+&%*<&-*)70&5$*"(-#&2)&()(0(2'(J#$9&01#&"2'<#&*+&01#&"2$(2?'#&(.&<)-#+()#-&<)0('&%*<&2..(6)&
.*3#01()6&()0*&(04&
-
>1#&0%5#&2&"2$(2?'#&,2)&1*'-&(.&+(I#-4&
LMM&(.&.020(,2''%&0%5#-4&
-
;&"2$(2?'#&,2)&5*0#)0(2''%&1*'-&2)%&"2'<#4&
N;>O;H&(.&-%)23(,2''%&0%5#-4&
-
P#+#$&0*&5$*5#$0(#.&*+&*<$&,*-#&0120&2$#&C)*/)&/1#)&(0&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&2$#&?#00#$&<.#-&/1#)&/#&12"#&2&C)*/&)<3?#$&*+&(0#$20(*).9&
-
P#2-()6&-202&+$*3&2&.0$#23&c
P#5'2,()6&0#I0&()&2&.0$()6&c
k1('#&'**5.&2$#&?#00#$&/1#)&/#&12"#&2)&<)C)*/)&)<3?#$&*+&(0#$20(*).&
-
Scope'
B.&01#&'(+#0(3#&*+&2&"2$(2?'#&
-
;&"2$(2?'#&6*#.&*<0&*+&.,*5#&20&01#&,'*.()6&:
-
Y2$(2?'#.&/(01&*)#&+<),0(*)&2$#&.#52$20#R()-#5#)-#)0&+$*3&"2$(2?'#.&/(01&01#&.23#&
)23#&()&2)*01#$&+<),0(*)&
-
You'cannot'return'multiple'values'from'a'function'in'C++.'The'only'way'to'do'it'is'with'
using'pass'by'reference.'
Nested'loops'$#+#$&0*&/1#)&'**5.&2$#&)#.0#-&/(01()&#2,1&*01#$&T2&'**5&/(01()&2&'**5U
Introduction*
k#-)#.-2%9& d,0*?#$&nX9&nj]W
oD]V&;N
You're Reading a Preview

Unlock to view full version

Only half of the first page are available for preview. Some parts have been intentionally blurred.

!"#$%&'()#&*+&,*-#&#)-.&/(01&2&.#3(,*'*)4&
-
!2,1&5$*6$23&.02$0.&/(01&7()07&2)-&89&2)-&#)-.&/(01&:4
-
;&,*35('#$&(.&2&5$*6$23&0120&0$2).'20#.&0*&*01#$&5$*6$23.&+$*3&1<32)=+$(#)-'%&
5$*6$23()6&'2)6<26#.&()0*&32,1()#&,*-#4&
-
>1#&+($.0&,*35('#$&/2.&-(.,*"#$#-&?%&@$2,#&A*55#$4&
-
B0.&)23#&2)-&(0.&0%5#&
§
B0&'#0.&01#&,*35('#$&C)*/&2?*<0&01#&"2$(2?'#.D
E*<&2$#&$#F<($#-&0*&-#,'2$#&"2$(2?'#.&?#+*$#&%*<&,2)&<.#&01#34&
-
>1#&,*35('#$&5$#52$#.&3#3*$%&+*$&01#&"2$(2?'#4
-
>%5#&)23#G&
H2.(,&.%)02I&(.D
-
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),$#3#)0&?%&*)#&#2,1&0(3#c
A*/&-*&%*<&6#0&01#$#g
-
\&K&I&M&)G&RR&I&MK&)c
\&K&I&M&]G&RR&MMIc
B),$#3#)0D
-
\&K&I&=)&RR&I&=K)Gc
\&K&I&=]RR&==Ic
l#,$#3#)0D
-
L*)-(0(*)&=2)%&#I5$#..(*)&0120&,2)&?#&,*)"#$0#-&0*&2&?**'c
B+&T&,*)-(0(*)U&
-
For''**5.&+2''&()0*&2&.5#,(+(,&5200#$)9&01#%&#I#,<0#&2&?'*,C&*+&,*-#&2&+(I#-&)<3?#$&*+&
0(3#.D
-
Z*$&T()(0(2'(J#G&,*)-(0(*)G&(),$#3#)0U
-
b#3(,*'*).&2$#&<.#-&0*&.#52$20#&52$0.&*+&01#&+*$&'**5&
-
Z*$&'**5.&2)-&/1('#&'**5.&2$#&#F<("2'#)09&01#%&m<.0&12"#&-(++#$#)0&.%)02I
-
Z*$&'**5.&2$#&?#00#$&<.#-&/1#)&/#&12"#&2&C)*/&)<3?#$&*+&(0#$20(*).9&
-
P#2-()6&-202&+$*3&2&.0$#23&c
P#5'2,()6&0#I0&()&2&.0$()6&c
k1('#&'**5.&2$#&?#00#$&/1#)&/#&12"#&2)&<)C)*/)&)<3?#$&*+&(0#$20(*).&
-
Scope'
B.&01#&'(+#0(3#&*+&2&"2$(2?'#&
-
;&"2$(2?'#&6*#.&*<0&*+&.,*5#&20&01#&,'*.()6&:
-
Y2$(2?'#.&/(01&*)#&+<),0(*)&2$#&.#52$20#R()-#5#)-#)0&+$*3&"2$(2?'#.&/(01&01#&.23#&
)23#&()&2)*01#$&+<),0(*)&
-
You'cannot'return'multiple'values'from'a'function'in'C++.'The'only'way'to'do'it'is'with'
using'pass'by'reference.'
Nested'loops'$#+#$&0*&/1#)&'**5.&2$#&)#.0#-&/(01()&#2,1&*01#$&T2&'**5&/(01()&2&'**5U
Introduction*
k#-)#.-2%9& d,0*?#$&nX9&nj]W oD]V&;N
You're Reading a Preview

Unlock to view full version

Only half of the first page are available for preview. Some parts have been intentionally blurred.

!"#$%&'()#&*+&,*-#&#)-.&/(01&2&.#3(,*'*)4&
-
!2,1&5$*6$23&.02$0.&/(01&7()07&2)-&89&2)-&#)-.&/(01&:4
-
;&,*35('#$&(.&2&5$*6$23&0120&0$2).'20#.&0*&*01#$&5$*6$23.&+$*3&1<32)=+$(#)-'%&
5$*6$23()6&'2)6<26#.&()0*&32,1()#&,*-#4&
-
>1#&+($.0&,*35('#$&/2.&-(.,*"#$#-&?%&@$2,#&A*55#$4&
-
B0.&)23#&2)-&(0.&0%5#&
§
B0&'#0.&01#&,*35('#$&C)*/&2?*<0&01#&"2$(2?'#.D
E*<&2$#&$#F<($#-&0*&-#,'2$#&"2$(2?'#.&?#+*$#&%*<&,2)&<.#&01#34&
-
>1#&,*35('#$&5$#52$#.&3#3*$%&+*$&01#&"2$(2?'#4
-
>%5#&)23#G&
H2.(,&.%)02I&(.D
-
E*<&32%&5$*"(-#&2)&()(0(2'(J#$& #I5$#..(*)&+*$&2&-#,'2$20(*)4&
-
>%5#&)23#&K&#I5$#..(*)G
>1(.&,2)&?#&2&.()6'#&"2'<#9&?<0&(0&,2)&2'.*&?#&-#$("#-&+$*3&*01#$&"2$(2?'#.&*$&2)&2$?(0$2$%&
#I5$#..(*)4&
-
B+&%*<&-*)70&5$*"(-#&2)&()(0(2'(J#$9&01#&"2'<#&*+&01#&"2$(2?'#&(.&<)-#+()#-&<)0('&%*<&2..(6)&
.*3#01()6&()0*&(04&
-
>1#&0%5#&2&"2$(2?'#&,2)&1*'-&(.&+(I#-4&
LMM&(.&.020(,2''%&0%5#-4&
-
;&"2$(2?'#&,2)&5*0#)0(2''%&1*'-&2)%&"2'<#4&
N;>O;H&(.&-%)23(,2''%&0%5#-4&
-
P#+#$&0*&5$*5#$0(#.&*+&*<$&,*-#&0120&2$#&C)*/)&/1#)&(0&(.&,*35('#-&?%&01#&,*35('#$4&
L*35('#=0(3#&
-
P#+#$.&0*&5$*5#$0(#.&*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-()6&-202&+$*3&2&.0$#23&c
P#5'2,()6&0#I0&()&2&.0$()6&c
k1('#&'**5.&2$#&?#00#$&/1#)&/#&12"#&2)&<)C)*/)&)<3?#$&*+&(0#$20(*).&
-
Scope'
B.&01#&'(+#0(3#&*+&2&"2$(2?'#&
-
;&"2$(2?'#&6*#.&*<0&*+&.,*5#&20&01#&,'*.()6&:
-
Y2$(2?'#.&/(01&*)#&+<),0(*)&2$#&.#52$20#R()-#5#)-#)0&+$*3&"2$(2?'#.&/(01&01#&.23#&
)23#&()&2)*01#$&+<),0(*)&
-
You'cannot'return'multiple'values'from'a'function'in'C++.'The'only'way'to'do'it'is'with'
using'pass'by'reference.'
Nested'loops'$#+#$&0*&/1#)&'**5.&2$#&)#.0#-&/(01()&#2,1&*01#$&T2&'**5&/(01()&2&'**5U
Introduction*
k#-)#.-2%9& d,0*?#$&nX9&nj]W oD]V&;N
You're Reading a Preview

Unlock to view full version


Loved by over 2.2 million students

Over 90% improved by at least one letter grade.