文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档> 绘制余弦曲线

绘制余弦曲线

时间:2010-07-27  来源:sohu2000000

在屏幕上用“*”显示0~360度的余弦函数cos(x)曲线    

#include <stdio.h>
#include <math.h>
  
#define WIDE 62
  
int
main(void)
{
    double y, m;
    int x;
  
    for(y=1;y>=-1;y-=0.1)
    {
        m = acos(y)*10;
  
        for(x=1;x<m;++x) printf(" "); printf("*");
        for(;x<(WIDE-m);++x) printf(" "); printf("*"); printf("\n");
    }
  
    return 0;
}


Output:
 *                                                             *
    *                                                     *
      *                                                 *
       *                                               *
         *                                           *
          *                                         *
           *                                       *
            *                                     *
             *                                   *
              *                                 *
               *                               *
                *                             *
                 *                           *
                  *                         *
                   *                       *
                    *                     *
                      *                 *
                       *               *
                        *             *
                          *         *
                               **
 
 
发表于 @ 2010年07月27日 00:34:00 | 评论( 0 ) | 编辑| 举报| 收藏

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/asiainfolf/archive/2010/07/27/5767694.aspx
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载