<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=AcceleratedC%2B%2B%2FChapter9</id>
	<title>AcceleratedC++/Chapter9 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=AcceleratedC%2B%2B%2FChapter9"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=AcceleratedC%2B%2B/Chapter9&amp;action=history"/>
	<updated>2026-05-14T14:00:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=AcceleratedC%2B%2B/Chapter9&amp;diff=84056&amp;oldid=prev</id>
		<title>Maintenance script: Repair batch-0001 pages from live compare</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=AcceleratedC%2B%2B/Chapter9&amp;diff=84056&amp;oldid=prev"/>
		<updated>2026-03-26T23:56:00Z</updated>

		<summary type="html">&lt;p&gt;Repair batch-0001 pages from live compare&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:56, 26 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l215&quot;&gt;Line 215:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 215:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| 객체의 생성 순서&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| 객체의 생성 순서&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| * 구현 시스템이 객체를 담을만한 메모리를 할당함. &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&amp;amp;#91;HTML(&amp;amp;lt;&lt;/del&gt;BR/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;gt;)&amp;amp;#93;&amp;amp;#93; &lt;/del&gt;* 초기 설정자 목록에 의해 객체들을 초기화 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&amp;amp;#91;HTML(&amp;amp;lt;&lt;/del&gt;BR/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;gt;)&amp;amp;#93;&amp;amp;#93; &lt;/del&gt;* 생성자 본체를 실행&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| * 구현 시스템이 객체를 담을만한 메모리를 할당함. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;&lt;/ins&gt;BR/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt; &lt;/ins&gt;* 초기 설정자 목록에 의해 객체들을 초기화 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;&lt;/ins&gt;BR/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt; &lt;/ins&gt;* 생성자 본체를 실행&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   상기에서 보듯이 : { 사이에 생성자를 명시적으로 사용함으로써 객체를 초기화하는 작업을 하는 중에 0으로 초기화 함으로써 오버헤드를 줄이는 것이 가능하다.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   상기에서 보듯이 : { 사이에 생성자를 명시적으로 사용함으로써 객체를 초기화하는 작업을 하는 중에 0으로 초기화 함으로써 오버헤드를 줄이는 것이 가능하다.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l344&quot;&gt;Line 344:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 344:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	for (vector&amp;amp;lt;Student_info&amp;amp;gt;::size_type i = 0;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	for (vector&amp;amp;lt;Student_info&amp;amp;gt;::size_type i = 0;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	     i != students.size(); ++i) {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	     i != students.size(); ++i) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		cout &amp;amp;lt;&amp;amp;lt; students&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;i&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;.name()   // this and the next line changed&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		cout &amp;amp;lt;&amp;amp;lt; students&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;i&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;.name()   // this and the next line changed&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		     &amp;amp;lt;&amp;amp;lt; string(maxlen + 1 - students&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;i&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;.name().size(), &amp;#039; &amp;#039;);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		     &amp;amp;lt;&amp;amp;lt; string(maxlen + 1 - students&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;i&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;.name().size(), &amp;#039; &amp;#039;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		try {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		try {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			double final_grade = students&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;i&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;.grade();   // changed&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			double final_grade = students&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;i&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;.grade();   // changed&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			streamsize prec = cout.precision();&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			streamsize prec = cout.precision();&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			cout &amp;amp;lt;&amp;amp;lt; setprecision(3) &amp;amp;lt;&amp;amp;lt; final_grade&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			cout &amp;amp;lt;&amp;amp;lt; setprecision(3) &amp;amp;lt;&amp;amp;lt; final_grade&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=AcceleratedC%2B%2B/Chapter9&amp;diff=83181&amp;oldid=prev</id>
		<title>Maintenance script: Repair MoniWiki formatting after migration</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=AcceleratedC%2B%2B/Chapter9&amp;diff=83181&amp;oldid=prev"/>
		<updated>2026-03-26T14:01:35Z</updated>

		<summary type="html">&lt;p&gt;Repair MoniWiki formatting after migration&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:01, 26 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l360&quot;&gt;Line 360:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 360:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[AcceleratedC++]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[AcceleratedC++]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=AcceleratedC%2B%2B/Chapter9&amp;diff=27503&amp;oldid=prev</id>
		<title>imported&gt;Unknown at 05:22, 7 February 2021</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=AcceleratedC%2B%2B/Chapter9&amp;diff=27503&amp;oldid=prev"/>
		<updated>2021-02-07T05:22:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [[AcceleratedC++/Chapter8]]&lt;br /&gt;
| [[AcceleratedC++/Chapter10]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| __TOC__&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Chapter 9 Defining new types =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 기본 타입&lt;br /&gt;
| char, int, double 등 기본언어의 일부&lt;br /&gt;
|-&lt;br /&gt;
| 클래스 타입&lt;br /&gt;
| string, vector, istream 등 기본언어를 가지고 구현된 타입&lt;br /&gt;
|}&lt;br /&gt;
C++은 클래스 타입과 같은 사용자가 정의한 어플리케이션 고유의 타입을 정의할 수 있는 많은 기능은 지원한다.&lt;br /&gt;
&lt;br /&gt;
== 9.1 Student_info revisited ==&lt;br /&gt;
4.2.1절 Student_info 구조체를 다루는 함수를 작성하고, 이를 한개의 헤더파일로 통합을 하는 것은 일관된 방법을 제공하지 않기 때문에 문제가 발생한다. &lt;br /&gt;
본 장에서는 기존의 구조체를 확장하여 함수를 작성하고 이런식의 문제를 해결할 수 있는 방법을 알려준다. &lt;br /&gt;
== 9.2 Class types ==&lt;br /&gt;
 struct Student_info {&lt;br /&gt;
 	std::string name;&lt;br /&gt;
 	double midterm, final;&lt;br /&gt;
 	std::vector&amp;amp;lt;double&amp;amp;gt; homework;&lt;br /&gt;
 };&lt;br /&gt;
프로그래머는 구조체를 다루기 위해서 구조체의 각 멤버를 다루는 함수를 이용해야한다. (Student_info 를 인자로 갖는 함수는 없기 때문에)&lt;br /&gt;
그러나 프로그래머는 직접적으로 이런 구조를 다루기 보다는 세부적인 구현을 감추고 싶을 수 있다.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;왜 using-선언문을 사용하지 않는가?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
string, vector 와 같은 것들은 Student_info의 내부 구현시에 필요한 사항이기 때문에 Student_info를 사용하는 프로그램의 또다른 프로그래머에게까지 vector, string을 std::에 존재하는 것으로 쓰기를 강요하는 것은 옳지않다. &lt;br /&gt;
 === 9.2.1 멤버 함수 ===&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;상기의 구조체안에 Student_info 를 다룰 수 있는 멤버함수를 추가한 것&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
 struct Student_info {&lt;br /&gt;
 	std::string name;&lt;br /&gt;
 	double midterm, final;&lt;br /&gt;
 	std::vector&amp;amp;lt;double&amp;amp;gt; homework;&lt;br /&gt;
 	&lt;br /&gt;
 	std::istream&amp;amp;amp; read(std::istream&amp;amp;amp;);		//입력 스트림으로 부터 입력을 받아서 4개의 멤버변수를 초기화한다. &lt;br /&gt;
 	double grade() const; 					//내부 멤버변수를 활용하여 점수를 계산하고 double 형으로 리턴한다.&lt;br /&gt;
 											//함수 명의 뒤에 const를 붙이면 멤버 변수의 변형을 할 수 없는 함수가 된다. (구조적으로 좋다) &lt;br /&gt;
 };&lt;br /&gt;
  &lt;br /&gt;
* s:Student_info 라면 멤버함수를 호출하기 위해서는 s.read(cin), s.grade() 와 같이 함수를 사용하면서 그 함수가 속해있는 객체를 지정해야함. 암묵적으로 특정객체가 그 함수의 인자로 전달되어 그 객체의 데이터로 접근이 가능하게 된다. &lt;br /&gt;
&lt;br /&gt;
 istream &amp;amp;amp; Student_info::read(istream&amp;amp;amp; in)&lt;br /&gt;
 {&lt;br /&gt;
 	in&amp;amp;gt;&amp;amp;gt;name&amp;amp;gt;&amp;amp;gt;midterm&amp;amp;gt;&amp;amp;gt;final;&lt;br /&gt;
 	read_hw(in, homework);&lt;br /&gt;
 	return in;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 이 함수에서 알아야할 3가지&lt;br /&gt;
** 함수의 이름이 Student_info::read이다&lt;br /&gt;
** Student_info의 멤버함수이므로 Student_info 객체를 정의할 필요도 인자로 넘길 필요도 없다.&lt;br /&gt;
** 객체 내부의 데이터를 직접적으로 접근 가능하다. 예를 들어서 s.name으로 접근할 필요없다.&lt;br /&gt;
&lt;br /&gt;
 double Student_info::grade() const {&lt;br /&gt;
 	return ::grade(midterm, final, homework);&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ::를 사용함으로써 호출되는 grade를 객체의 멤버함수가 아니라 전역 grade의 형으로 사용하는 것이 가능하다.&lt;br /&gt;
 객체에서는 const 객체 내부의 데이터들을 const형으로 다룰 수는 없지만, 멤버함수를 const 멤버함수로 만듦으로써 변형에 제한을 줄 수 있다.&lt;br /&gt;
** const 객체에 대해서는 const 멤버함수가 아닌 함수는 호출 할 수 없다. &lt;br /&gt;
 &lt;br /&gt;
 === 9.2.2 비멤버 함수들 ===&lt;br /&gt;
 이전에 사용되었던 compare와 같은 함수를 어떤식으로 정의해야 할 것인가?&lt;br /&gt;
 compare함수는 동일한 형의 2개의 Student_info를 받아서 서로를 비교하는 역할을 한다. 이런함수를 처리하는 일반적인 방법이 있는데, 9.5, 11.2.4, 11.3.2, 12.5, 13.2.1 에서 배우게됨.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;friend 함수를 의미하는 것&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
  &lt;br /&gt;
== 9.3 Protection ==&lt;br /&gt;
 read, grade를 정의함으로써 Student_info에 직접적인 접근을 하지 않고도 데이터를 다룰 수 있었다.&lt;br /&gt;
 그런데 더 나가서 이제는 아예 이 객체의 내부멤버를 프로그램의 다른 부분에서 다루는 것을 금지시키고 싶다면? &lt;br /&gt;
 &lt;br /&gt;
 class Student_info {&lt;br /&gt;
 public:&lt;br /&gt;
 	//interface is here&lt;br /&gt;
 	double grade() const;&lt;br /&gt;
 	std::istream&amp;amp;amp; read(std::istream&amp;amp;amp;);&lt;br /&gt;
 private:&lt;br /&gt;
 	//implementation is here&lt;br /&gt;
 	std::string name;&lt;br /&gt;
 	double midterm, final;&lt;br /&gt;
 	std::vector&amp;amp;lt;double&amp;amp;gt; homework;&lt;br /&gt;
 };&lt;br /&gt;
  &lt;br /&gt;
 struct 키워드 대신 &amp;#039;&amp;#039;&amp;#039;class&amp;#039;&amp;#039;&amp;#039; 키워드 사용. &amp;#039;&amp;#039;&amp;#039;보호레이블(protection label)&amp;#039;&amp;#039;&amp;#039; 사용. 레이블은 순서없이 여러분 중복으로 나와도 무관함.&lt;br /&gt;
 private 레이블 뒤에 존재하는 변수, 함수들은 비 멤버함수에서 접근할 수 없다. 반면 public은 접근이 가능하다.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| class 키워드를 사용한 클래스&lt;br /&gt;
| 기본 보호모드가 private 으로 동작한다.&lt;br /&gt;
|-&lt;br /&gt;
| struct 키워드를 사용한 클래스&lt;br /&gt;
| 기본 보호모드가 public 으로 동작한다.&lt;br /&gt;
|}&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;※ 이것을 보면 C++에서 클래스의 구현은 C에서 구조체의 구현을 확장시킨 것으로 볼 수 있는 증거가 된다.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;다음은 각기 동일한 표현식을 나타낸 2가지의 경우이다.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 class Student_info {&lt;br /&gt;
 public:&lt;br /&gt;
 	double grade() const;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 struct Student_info {&lt;br /&gt;
 	dobule grade() const;&lt;br /&gt;
 };&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
 class Student_info {&lt;br /&gt;
 	std::string name;&lt;br /&gt;
 public:&lt;br /&gt;
 	double grade() const;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 struct Student_info {&lt;br /&gt;
 private:&lt;br /&gt;
 	std::string name;&lt;br /&gt;
 public:&lt;br /&gt;
 	dobule grade() const;&lt;br /&gt;
 };&lt;br /&gt;
  &lt;br /&gt;
 일반적으로 자료구조가 간단할 때에는 struct를 이용한다. 그러나 2가지 키워드의 사용의 차이는 존재하지 않는다. 단지 문서화를 어떻게 하느냐에 의해 차이가 생길 뿐이다. &lt;br /&gt;
 &lt;br /&gt;
 === 9.3.1 접근 함수 ===&lt;br /&gt;
 class Student_info {&lt;br /&gt;
 public:&lt;br /&gt;
 	double grade() const;&lt;br /&gt;
 	std::istream&amp;amp;amp; read(std::istream&amp;amp;amp;);&lt;br /&gt;
 	std::string name() const {return n;}&lt;br /&gt;
 private:&lt;br /&gt;
 	std::string n;&lt;br /&gt;
 	double midterm, final;&lt;br /&gt;
 	std::vector&amp;amp;lt;double&amp;amp;gt; homework;&lt;br /&gt;
 };&lt;br /&gt;
  &lt;br /&gt;
 name 멤버 변수에 직접적으로 접근하는 대신에 name()함수를 만들어서 접근하도록 만들었다. const 함수이므로 멤버변수의 변경을 불허한다. 리턴값이 복사된 것이기 때문에 변경을 하더라도 멤버변수에 영향을 주지는 않는다. &lt;br /&gt;
 name 멤버 함수와 같이 클래스 내부에 정의를 하는 것은 inline으로 함수를 정의하는 것도 동일한 효과를 가진다. 이렇게 멤버변수에 접근을 위해서 만들어지는 함수를 통칭 &amp;#039;&amp;#039;&amp;#039;접근함수(accessor function)&amp;#039;&amp;#039;&amp;#039;이라고 부른다.&lt;br /&gt;
  접근함수는 캡슐화의 기본개념이 반하는 것으로 다른 인터페이스 일부로서만 사용해야한다. &lt;br /&gt;
  &lt;br /&gt;
 bool compare(const Student_info&amp;amp;amp; x, const Student_info&amp;amp;amp; y) {&lt;br /&gt;
 	return x.name() &amp;amp;lt; y.name();&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 인자로 받은 변수들을 직접 접근하지 않고 그 멤버함수로 접근한다.&lt;br /&gt;
 &lt;br /&gt;
 === 9.3.2 비어있는지 테스트 ===&lt;br /&gt;
 만약 s:Student_info 에 read(istream&amp;amp;)을 통해서 데이터를 입력하지 않고서 s.grade()를 사용한다면 프로그램을 에러를 낼 것이다.&lt;br /&gt;
  &lt;br /&gt;
 class Student_info {&lt;br /&gt;
 public:&lt;br /&gt;
 	double grade() const;&lt;br /&gt;
 	std::istream&amp;amp;amp; read(std::istream&amp;amp;amp;);&lt;br /&gt;
 	std::string name() const {return n;}&lt;br /&gt;
 	bool valid() const { return !homework.empty(); }	// 사용자에게 그 객체가 유효한 데이터를 가졌는지를 알려준다. &lt;br /&gt;
 private:&lt;br /&gt;
 	std::string n;&lt;br /&gt;
 	double midterm, final;&lt;br /&gt;
 	std::vector&amp;amp;lt;double&amp;amp;gt; homework;&lt;br /&gt;
 };&lt;br /&gt;
  &lt;br /&gt;
 상기와 같은 방식으로 통해서 grade를 호출하기 전에 객체의 유효성을 검사한다면 에러를 없애는 것이 가능하다. &lt;br /&gt;
 &lt;br /&gt;
== 9.4 The Student_info class ==&lt;br /&gt;
 class Student_info {&lt;br /&gt;
 public:&lt;br /&gt;
 	double grade() const;&lt;br /&gt;
 	std::istream&amp;amp;amp; read(std::istream&amp;amp;amp;);&lt;br /&gt;
 	std::string name() const {return n;}&lt;br /&gt;
 	bool valid() const { return !homework.empty(); }	// 사용자에게 그 객체가 유효한 데이터를 가졌는지를 알려준다. &lt;br /&gt;
 private:&lt;br /&gt;
 	std::string n;&lt;br /&gt;
 	double midterm, final;&lt;br /&gt;
 	std::vector&amp;amp;lt;double&amp;amp;gt; homework;&lt;br /&gt;
 };&lt;br /&gt;
 bool compare(const Student_info&amp;amp;amp; x, const Student&amp;amp;amp; y);&lt;br /&gt;
  &lt;br /&gt;
 동일한 일을 하지만 프로그래머는 실제로 객체의 내부의 구현을 감추는 것이 가능하다.&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;※ 이런 식으로 헤더파일을 제공하고 실제의 구현된 소스파일은 이미 컴파일된 obj파일로 제공한다면 실제로 판매되는 컴파일러라도 그 컴파일러가 제공하는 함수의 실제구현은 볼 수가 없다.&lt;br /&gt;
 헤더파일은 단지 컴파일러가 컴파일을 할때 이런 함수가 존재한다고 가정만 하고, 실제로 그 함수의 코드가 존재하는 것을 확인 할 수 잇는 것은 모든 관련 오브젝트 파일을 링크한뒤에 호출할때 없다는 것을 확인할 수 밖엔 없다.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
== 9.5 Constructors ==&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;생성자(Constructor)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 객체가 어떤게 초기화되는지를 정의하는 특별한 멤버 함수이다. 명시적인 호출을 지원하지 않으며, 오로지 객체가 생성될 때에만 실행된다.&lt;br /&gt;
 만약 프로그래머가 생성자를 명시적으로 지정하지 않으면 컴파일러는 Default Constructor를 만들어주는데, 이 기본 생성자는 명시적인 초기화를 지원하지 않으며, 오로지 동일한 형의 다른 객체로의 초기화만을 제공한다.&lt;br /&gt;
 생성자는 클래스의 이름과 동일한 이름으로 함수의 이름을 갖는다. 또한 리턴타입이 없다. &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;생성자의 규칙&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** 하나이상의 생성자가 존재한다면 현재 상황에 맞는 생성자를 선택하여 실행된다.&lt;br /&gt;
** 내장 타입 객체인 경우 값지정 초기화시에는 0으로 디폴트 초기화 시에는 정의되지 않은 값으로 세팅된다.&lt;br /&gt;
** 생성자를 갖지 않는 타입인 경우. 객체를 어떤 식으로 초기화했는 가에 따라서 값지정, 디폴트 초기화를 재귀적으로 행함.&lt;br /&gt;
  &lt;br /&gt;
 현재 Student_info 형은 3번째의 경우에 해당하며, 현재 제공되는 멤버함수로는 문제가 생길 일이 없지만, 후에 이 클래스에 기능을 추가할 경우 문제가 발생할 가능성이 존재하므로 생성자를 만들어 주는 것이 좋다.&lt;br /&gt;
 &lt;br /&gt;
 class Student_info {&lt;br /&gt;
 public:&lt;br /&gt;
 	Student_info();&lt;br /&gt;
 	Student_info(std::istream&amp;amp;amp;);&lt;br /&gt;
 };&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 === 9.5.1 기본 생성자 ===&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Default Constructor?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 아무런 인자를 갖지 않는 생성자. 기본 생성자는 보통 그 객체의 데이터 멤버들을 적당히 초기화시키기만 함. &lt;br /&gt;
 Student_info::Student_info():midterm(0). final(0) {}	// n, homework 의 경우 STL에서 제공되는 디폴트 생성자가 재귀적으로 호출 &lt;br /&gt;
  &lt;br /&gt;
 &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;생성자 초기 설정자(constructor initializer)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 객체의 생성 순서&lt;br /&gt;
|-&lt;br /&gt;
| * 구현 시스템이 객체를 담을만한 메모리를 할당함. &amp;amp;#91;&amp;amp;#91;HTML(&amp;amp;lt;BR/&amp;amp;gt;)&amp;amp;#93;&amp;amp;#93; * 초기 설정자 목록에 의해 객체들을 초기화 &amp;amp;#91;&amp;amp;#91;HTML(&amp;amp;lt;BR/&amp;amp;gt;)&amp;amp;#93;&amp;amp;#93; * 생성자 본체를 실행&lt;br /&gt;
|}&lt;br /&gt;
  상기에서 보듯이 : { 사이에 생성자를 명시적으로 사용함으로써 객체를 초기화하는 작업을 하는 중에 0으로 초기화 함으로써 오버헤드를 줄이는 것이 가능하다.&lt;br /&gt;
  &amp;#039;&amp;#039;&amp;#039;※만약 객체의 멤버로 const 멤버가 존재한다면 그 멤버는 반드시 이 표현으로만 초기화가 가능하다. 객체가 초기화 되는 시기는 생성자 코드로 진입되기 이전인데 일단 초기화된 const 멤버는 컴파일러가 그 값의 수정을 허용하지 않기 때문이다. &amp;#039;&amp;#039;&amp;#039;  &lt;br /&gt;
  &lt;br /&gt;
 === 9.5.2 인자를 사용하는 생성자 ===&lt;br /&gt;
 Student_info::Student_info(istream&amp;amp;amp; is) {read(is);}&lt;br /&gt;
  &lt;br /&gt;
 이 생성자는 실질적인 작업을 read 함수에 위임합니다.&lt;br /&gt;
  &lt;br /&gt;
 === 9.5.3 Entire Source File ===&lt;br /&gt;
 //Student_info.h&lt;br /&gt;
 #ifndef GUARD_Student_info&lt;br /&gt;
 #define GUARD_Student_info&lt;br /&gt;
 &lt;br /&gt;
 #include &amp;amp;lt;string&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;vector&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 class Student_info {&lt;br /&gt;
 public:&lt;br /&gt;
 	Student_info();              // construct an empty `Student_info&amp;#039; object&lt;br /&gt;
 	Student_info(std::istream&amp;amp;amp;); // construct one by reading a stream&lt;br /&gt;
 	std::string name() const { return n; }&lt;br /&gt;
 	bool valid() const { return !homework.empty(); }&lt;br /&gt;
 &lt;br /&gt;
 	// as defined in 9.2.1/157, and changed to read into `n&amp;#039; instead of `name&amp;#039;&lt;br /&gt;
 	std::istream&amp;amp;amp; read(std::istream&amp;amp;amp;);&lt;br /&gt;
 &lt;br /&gt;
 	double grade() const;    // as defined in 9.2.1/158&lt;br /&gt;
 private:&lt;br /&gt;
 	std::string n;&lt;br /&gt;
 	double midterm, final;&lt;br /&gt;
 	std::vector&amp;amp;lt;double&amp;amp;gt; homework;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 bool compare(const Student_info&amp;amp;amp;, const Student_info&amp;amp;amp;);&lt;br /&gt;
 &lt;br /&gt;
 #endif&lt;br /&gt;
  &lt;br /&gt;
 //Student_info.cpp&lt;br /&gt;
 #include &amp;amp;lt;iostream&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;vector&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #include &amp;quot;grade.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;Student_info.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 using std::istream;&lt;br /&gt;
 using std::vector;&lt;br /&gt;
 &lt;br /&gt;
 double Student_info::grade() const&lt;br /&gt;
 {&lt;br /&gt;
 	return ::grade(midterm, final, homework);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 bool compare(const Student_info&amp;amp;amp; x, const Student_info&amp;amp;amp; y)&lt;br /&gt;
 {&lt;br /&gt;
 	return x.name() &amp;amp;lt; y.name();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 Student_info::Student_info(): midterm(0), final(0) { }&lt;br /&gt;
 &lt;br /&gt;
 Student_info::Student_info(istream&amp;amp;amp; is) { read(is); }	&lt;br /&gt;
 &lt;br /&gt;
 // read homework grades from an input stream into a `vector&amp;amp;lt;double&amp;amp;gt;&amp;#039;&lt;br /&gt;
 istream&amp;amp;amp; read_hw(istream&amp;amp;amp; in, vector&amp;amp;lt;double&amp;amp;gt;&amp;amp;amp; hw)&lt;br /&gt;
 {&lt;br /&gt;
 	if (in) {&lt;br /&gt;
 		// get rid of previous contents&lt;br /&gt;
 		hw.clear();&lt;br /&gt;
 &lt;br /&gt;
 		// read homework grades&lt;br /&gt;
 		double x;&lt;br /&gt;
 		while (in &amp;amp;gt;&amp;amp;gt; x)&lt;br /&gt;
 			hw.push_back(x);&lt;br /&gt;
 &lt;br /&gt;
 		// clear the stream so that input will work for the next student&lt;br /&gt;
 		in.clear();&lt;br /&gt;
 	}&lt;br /&gt;
 	return in;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 istream&amp;amp;amp; Student_info::read(istream&amp;amp;amp; in)&lt;br /&gt;
 {&lt;br /&gt;
 	in &amp;amp;gt;&amp;amp;gt; n &amp;amp;gt;&amp;amp;gt; midterm &amp;amp;gt;&amp;amp;gt; final;&lt;br /&gt;
 	read_hw(in, homework);&lt;br /&gt;
 	return in;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
== 9.6 Using the Student_info class ==&lt;br /&gt;
 //grading_prog.cpp&lt;br /&gt;
 #include &amp;amp;lt;algorithm&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;iomanip&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #include &amp;amp;lt;ios&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #include &amp;amp;lt;iostream&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;stdexcept&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;string&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;vector&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 using std::max;&lt;br /&gt;
 &lt;br /&gt;
 #include &amp;quot;Student_info.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;median.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 using std::cin;                    using std::cout;&lt;br /&gt;
 using std::domain_error;           using std::endl;&lt;br /&gt;
 using std::setprecision;           using std::setw;&lt;br /&gt;
 using std::sort;                   using std::streamsize;&lt;br /&gt;
 using std::string;                 using std::vector;&lt;br /&gt;
 &lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
 	vector&amp;amp;lt;Student_info&amp;amp;gt; students;&lt;br /&gt;
 	Student_info record;&lt;br /&gt;
 	string::size_type maxlen = 0;&lt;br /&gt;
 &lt;br /&gt;
 	// read and store the data&lt;br /&gt;
 	while (record.read(cin)) {                           // changed&lt;br /&gt;
 		maxlen = max(maxlen, record.name().size());      // changed&lt;br /&gt;
 		students.push_back(record);&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	// alphabetize the student records&lt;br /&gt;
 	sort(students.begin(), students.end(), compare);&lt;br /&gt;
 &lt;br /&gt;
 	// write the names and grades&lt;br /&gt;
 	for (vector&amp;amp;lt;Student_info&amp;amp;gt;::size_type i = 0;&lt;br /&gt;
 	     i != students.size(); ++i) {&lt;br /&gt;
 		cout &amp;amp;lt;&amp;amp;lt; students[i].name()   // this and the next line changed&lt;br /&gt;
 		     &amp;amp;lt;&amp;amp;lt; string(maxlen + 1 - students[i].name().size(), &amp;#039; &amp;#039;);&lt;br /&gt;
 		try {&lt;br /&gt;
 			double final_grade = students[i].grade();   // changed&lt;br /&gt;
 			streamsize prec = cout.precision();&lt;br /&gt;
 			cout &amp;amp;lt;&amp;amp;lt; setprecision(3) &amp;amp;lt;&amp;amp;lt; final_grade&lt;br /&gt;
 			     &amp;amp;lt;&amp;amp;lt; setprecision(prec) &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
 		} catch (domain_error e) {&lt;br /&gt;
 			cout &amp;amp;lt;&amp;amp;lt; e.what() &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
----&lt;br /&gt;
[[AcceleratedC++]]&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>imported&gt;Unknown</name></author>
	</entry>
</feed>