   Sinus curve
  I'm making a console program that shows a sinus curve on the screen. The problem is that I don't know how to show it on the screen. I have the values calculated like this:for(float i=0; i <= 2*PI; i+= (PI/18)) {   y = A*sin(i);    cout << y << endl;}Have any idea how to make it to a sinus curve with 35 dots? not necessarily a moving one. Only something that shows the curve itself. Appreciate any help or ideas..   
  I guess you need a tool to draw it onto the screen? First thing that I'm thinking of is the SDL library and just draw the points to the screen (pixel by pixel).   ;  It's easy if you don't mind the graph turned sideways. You could do something like this:for ( float i = 0; i <= 2*PI; i+= PI/18 )    {    y = A*sin(i);   Draw( y );    }    void Draw( float y )    {   int const width   = 72;   float const min   = -1.0f;   float const max   = 1.0f;   float const resolution = ( max - min ) / ( width - 1 ); for ( int i = 0; i < width; ++i )   {  float a = float( i ) * resolution + min - resolution * 0.5f;  if ( a <= y && y < a + resolution )  { cout << '*';  }  else  { cout << ' ';  }   }   cout << endl;    } ;  Thank you very much for taking your time to write that up. I've been looking everywhere but didn't found anything. thanks again..   ;  If you're not concerned about portability you can use GDI to draw this. Here's what it looks like (I used SetPixel).   ;Quote:Original post by raz0rIf you're not concerned about portability you can use GDI to draw this. Here's what it looks like (I used SetPixel).Sorry if this sounds harsh, but HOW will this help anyone? The OP stated:Quote:I'm making a console program ... sinus curve with 35 dotsEven if he was looking for a graphics library to do it, then he would have no idea how, because you just mentioned that you did it and showed how your result was.To the OP: If you want a normal curve you can approach it in two ways.1. Go through one row at a time, if asin(x/A) is the current row, then draw it, if not just wait.2. Calculate the whole curve and store it in some data structure and then draw it, row by row.If you need some code, just ask.   ;Quote:Original post by CTarQuote:Original post by raz0rIf you're not concerned about portability you can use GDI to draw this. Here's what it looks like (I used SetPixel).Sorry if this sounds harsh, but HOW will this help anyone? The OP stated:Quote:I'm making a console program ... sinus curve with 35 dotsEven if he was looking for a graphics library to do it, then he would have no idea how, because you just mentioned that you did it and showed how your result was.To the OP: If you want a normal curve you can approach it in two ways.1. Go through one row at a time, if asin(x/A) is the current row, then draw it, if not just wait.2. Calculate the whole curve and store it in some data structure and then draw it, row by row.If you need some code, just ask.I said I used SetPixel... :) I also said that it's not very portable, but it's still an option if he's only targeting Windows!   