在屏幕上显示0~360度的cos(x)曲线与直线x=f(y)=45*(y-1)+31的迭加图形。其中cos(x)图形用“*”表示,f(y)用“+”表示,在两个图形相交的点上则用f(x)图形的符号。 #include <cstdio> #include <cmath> #define PERIODE 64 #define ENLARGE 10 int main(void) { int layer; double y; //ordinate of current layer int x; //abscissa of current layer int m; //abscissa of cos(x) int n; //abscissa of line for(layer=0;layer<=20;++layer) { y=0.1*layer; m=(int)(acos(1-y)*ENLARGE); n=(int)(45*(y-1)+31); for(x=0;x<PERIODE;++x) { if(x==m && x==n) printf("+"); //cross pointer else if(x==n) printf("+"); //on line else if(x==m||x==PERIODE-m) printf("*"); //on co