title: sine wave generation in c++
body: <p>I am trying to generate a set of points, which when plotted as a graph represent a sine wave of 1 cycle. The requirements are :</p>
  
  <ul>
  <li>a sine wave of 1 cycle<br /> </li>
  <li>lower limit =  29491<br /> </li>
  <li>upper limit =   36043<br /> </li>
  <li>no of points = 100<br /></li>
  <li>Amplitude = 3276</li>
  <li>zero offset = 32767</li>
  </ul>
  
  <p>Code :</p>
  
  <pre><code>int main()
  {
      ofstream outfile;
      outfile.open("data.dat",ios::trunc | ios::out);
      for(int i=0;i&lt;100;i++)
      {
          outfile &lt;&lt; int(3276*sin(i)+32767) &lt;&lt; "\n";
      }
      outfile.close();
      return 0;
  }
  </code></pre>
  
  <p>I am generating and storing the points in a file. When these points are plotted I get the following graph.</p>
  
  <p><a href="https://i.stack.imgur.com/4uhIn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4uhIn.png" alt="enter image description here"></a></p>
  
  <p>But I only need one cycle. How can I do this?</p>