Rotated sin(x)

  1. If you don't like the sin(x) or cos(x) which you must watch with your head turned 90 degrees, you can plot it with a different approach: using Ncurses.
  2. The structure of the program is basically the same. The only difference is that you call the move(y, x) function to move the cursor to the funcational value, and then addch('*') to print the star.
    The output of the program may look like the following figure. Please note that "plotting" with characters can only approximate the figure, so you may find the curve not always as smooth as you expect. You will learn how to draw real graphics with better resolution later in this semester (Chapter 16: Draw in a Window).
    
                                *****       ^                           *****
                               *     *      |                          *     *
                              *       *     |                         *       *
                             *         *    |                        *         *
                            *           *   |                       *           *
                                            |
                           *             *  |                      *             *
                          *               * |                     *               *
                                            |
                         *                 *|                    *                 *
                        *                   |
    *---------------------------------------*-------------------*------------------>
     *                 *                    |*                 *
                                            |
      *               *                     | *               *
       *             *                      |  *             *
                                            |
        *           *                       |   *           *
         *         *                        |    *         *
          *       *                         |     *       *
           *     *                          |      *     *
            ** **                           |       ** **
              *                             |         *
    
    

    Bonus

    Try to design your program so that it always works fine with different size of PuTTY window.