title: Simple example for plotting x-y graphic in visual studio c++ 2008 (console win32)?
body: <p>After reading almost all I found here and in google, I've not found a simple and direct solution/example about plotting x-y values in c++ (console app win32, the black one) in visual studio 2008. Based on <a href="https://i.stack.imgur.com/QlhYK.jpg" rel="nofollow noreferrer">this post</a>, I should use MsChart controls, would anyone be willing please to share a simple example about this?</p>
  
  <p><a href="https://i.stack.imgur.com/DbX0y.jpg" rel="nofollow noreferrer">This post</a>, and many others, talk about libraries that don't belong to visual studio (so they won't compile with the EXE, hence it won't be included as part of the resulting EXE) or having the graphic displayed with excel. I just want to get a simple x-y graphic (and line going through these points), not worried at all if it is the ugliest and simplest graphic in the whole world, but it must appear automatically after my code run (perhaps in a new window or perhaps inside the console?) AND if I run this EXE in another pc, thousands of kilometers away from my pc, the graphic will still appear after the code runs.</p>
  
  <p>Am I asking something too complex? boring?? I hope I could get some answers/examples/solutions instead of this post being closed =) Thanks in advance! </p>
  
  <hr>
  
  <p>@Koushik thanks again for your support! even though I'm getting the whole picture I need a clear example to get it right, so to voteup I'd like to test this simple example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;iomanip&gt;
  
  using namespace std;
  
  double f(const double &amp;x) {
      return (
          sin(x)*exp(-x));
  }
  
  int main()
  {
      unsigned Nplot = 100;
      double x_low = 0.0;
      double x_high = 20.0;
      double h = (x_high - x_low)/(double)Nplot;
  
      for (unsigned i=0;i&lt;=Nplot;i++)
      {
          double x = x_low + i*h;
          cout &lt;&lt; setw(20) &lt;&lt; x &lt;&lt;
                  setw(20) &lt;&lt; f(x) &lt;&lt; endl;
      }
  
      system("pause&gt;nul");
      return 0;
  }
  </code></pre>
  
  <p>this is a pretty basic code to generate a sin(x) function. If you copy/paste this in console application Win32 in VC++ 2008 (new project/Visual C++/Win32/console application Win32/empty project/), the data will appear in the screen:</p>
  
  <p><img src="https://i.stack.imgur.com/QlhYK.jpg" alt="enter image description here"></p>
  
  <p>Then, putting these values in Excel gives:</p>
  
  <p><img src="https://i.stack.imgur.com/DbX0y.jpg" alt="enter image description here"></p>
  
  <p>I want this, BUT the output window should appear after the values appear in the console, and more important, the code must not depend on excel or something else external to the visual C++. So, writing some additional code to draw this line and after compiling, both must appear/work in any computer, especially in those without VS or any libraries, just running the EXE in windows, that's all. So, is it possible? could you share a simple code example to draw this line (to add it to the above code)? thanks!</p>