<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>2020 on Sobamemil</title>
    <link>https://blog.sobamemil.com/en/tags/2020/</link>
    <description>Recent content in 2020 on Sobamemil</description>
    <image>
      <title>Sobamemil</title>
      <url>https://blog.sobamemil.com/images/og-image.png</url>
      <link>https://blog.sobamemil.com/images/og-image.png</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Thu, 21 Nov 2019 00:53:08 +0900</lastBuildDate>
    <atom:link href="https://blog.sobamemil.com/en/tags/2020/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>C&#43;&#43; Programming Ch.9 Exercise 3 Solution</title>
      <link>https://blog.sobamemil.com/en/posts/008-%EB%AA%85%ED%92%88-c-programming-%EC%8B%A4%EC%8A%B5-%EB%AC%B8%EC%A0%9C-9%EC%9E%A5-3%EB%B2%88/</link>
      <pubDate>Thu, 21 Nov 2019 00:53:08 +0900</pubDate>
      <guid>https://blog.sobamemil.com/en/posts/008-%EB%AA%85%ED%92%88-c-programming-%EC%8B%A4%EC%8A%B5-%EB%AC%B8%EC%A0%9C-9%EC%9E%A5-3%EB%B2%88/</guid>
      <description>&lt;p&gt;&lt;b&gt;Problem:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;다음 추상 클래스 LoopAdder가 있다.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31&lt;/td&gt;
          &lt;td&gt;class LoopAdder { // 추상 클래스  string name; // 루프의 이름  int x, y, sum; // x에서 y까지의 합은 sum  void read(); // x, y 값을 읽어 들이는 함수  void write(); // sum을 출력하는 함수  protected:  LoopAdder(string name=&amp;quot;&amp;quot;) { // 루프의 이름을 받는다. 초깃값은 &amp;quot;&amp;quot;  this-&amp;gt;name = name;  }  int getX() { return x; }  int getY() { return y; }  virtual int calculate() = 0; // 순수 가상 함수. 루프를 돌며 합을 구하는 함수  public:  void run(); // 연산을 진행하는 함수  };    void LoopAdder::read() { // x, y 입력  cout &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot;:&amp;quot; &amp;lt;&amp;lt; endl;  cout &amp;lt;&amp;lt; &amp;quot;처음 수에서 두번째 수까지 더한다. 두 수를 입력하세요 &amp;gt;&amp;gt; &amp;quot;;  cin &amp;gt;&amp;gt; x &amp;gt;&amp;gt; y;  }    void LoopAdder::write() { // 결과 sum 출력  cout &amp;lt;&amp;lt; x &amp;lt;&amp;lt; &amp;quot;에서 &amp;quot; &amp;lt;&amp;lt; y &amp;lt;&amp;lt; &amp;quot;까지의 합 = &amp;quot; &amp;lt;&amp;lt; sum &amp;lt;&amp;lt; &amp;quot; 입니다&amp;quot; &amp;lt;&amp;lt; endl;  }    void LoopAdder::run() {  read(); // x, y를 읽는다  sum = calculate(); // 루프를 돌면서 계산한다.  write(); // 결과 sum을 출력한다.  }&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Write a 다음 main() 함수와 Execution Result처럼 되도록 ForLoopAdder class that inherits from the LoopAdder class. ForLoopAdder 클래스의 calculate() 함수는 for 문을 이용하여 합을 구한다.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; Programming Ch.9 Exercise 2 Solution</title>
      <link>https://blog.sobamemil.com/en/posts/005-%EB%AA%85%ED%92%88-c-programming-%EC%8B%A4%EC%8A%B5-%EB%AC%B8%EC%A0%9C-9%EC%9E%A5-2%EB%B2%88/</link>
      <pubDate>Wed, 20 Nov 2019 23:09:20 +0900</pubDate>
      <guid>https://blog.sobamemil.com/en/posts/005-%EB%AA%85%ED%92%88-c-programming-%EC%8B%A4%EC%8A%B5-%EB%AC%B8%EC%A0%9C-9%EC%9E%A5-2%EB%B2%88/</guid>
      <description>&lt;p&gt;&lt;b&gt;Problem:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The following is an abstract class Converter that converts units.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16&lt;/td&gt;
          &lt;td&gt;class Converter {  protected:  double ratio;  virtual double convert(double src)=0; // src를 다른 단위로 변환한다.  virtual string getSourceString()=0; // src 단위 명칭  virtual string getDestString()=0; // dest 단위 명칭  public:  Converter(double ratio) { this-&amp;gt;ratio = ratio; }  void run(){  double src;  cout &amp;lt;&amp;lt; getSourceString() &amp;lt;&amp;lt; &amp;quot;을 &amp;quot; &amp;lt;&amp;lt; getDestString() &amp;lt;&amp;lt; &amp;quot;로 바꿉니다. &amp;quot;;  cout &amp;lt;&amp;lt; getSourceString() &amp;lt;&amp;lt; &amp;quot;을 입력하세요&amp;gt;&amp;gt; &amp;quot;;  cin &amp;gt;&amp;gt; src;  cout &amp;lt;&amp;lt; &amp;quot;변환 결과 : &amp;quot; &amp;lt;&amp;lt; convert(src) &amp;lt;&amp;lt; getDestString() &amp;lt;&amp;lt; endl;  }  };&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Write a km를 mile(마일)로 변환하는 KmToMile class that inherits from the Converter class. The main() function and execution result are as follows.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
