【转】用C语言画波形

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

}

发布了24 篇原创文章 · 获赞 48 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/xiaokai1999/article/details/80401091