#include "stdafx.h"
#include "iostream.h"
#include <math.h>
#include <conio.h>
#include <stdlib.h>
//writeby:lhsbqb
//http://www.pythonschool.com
int main(int argc, char* argv[])
{
double y;
int x, m;
//设置控制台窗口大小为120列(需要引入<stdlib.h>)
system("mode 120");
//画正弦图X轴上部
for(y=1;y>=0;y-=0.1)
{
m = asin(y)*10;
for(x=1;x<=m;x++)
printf(" ");
printf("*");
for(;x<=32-m;x++)
printf(" ");
printf("*");
for(;x<=66+m;x++)
printf(" ");
printf("*");
for(;x<=66+32-m;x++)
printf(" ");
printf("*");
printf("\n");
}
printf("*********************\
******************************\
************************************\
***************\n");
//画正弦图x轴下部
for(y=0;y<=1;y+=0.1)
{
m = asin(y)*10;
for(x=1;x<=34+m;x++)
printf(" ");
printf("*");
for(;x<=34+32-m;x++)
printf(" ");
printf("*");
printf("\n");
}
//画余弦图
for(y=1;y>=-1;y-=0.1)
{
m = acos(y)*10;
for(x=1;x<=m;x++)
printf(" ");
printf("*");
for(;x<64-m;x++)
printf(" ");
printf("*");
printf("\n");
}
printf("\n");
return 0;
}