If you do not draw the sine/cosine curve in this article, you can look at this first: the console draws the sine/cosine curve
So, if you want to display it at the same time, we may need to draw 3 or 4 points in the same line. My thinking is relatively simple, but the algorithm looks very very untidy, but also hope to get everyone's help ...
I divide the entire graph into 4 layers, drawn from top to bottom, by the square root two and negative two of the square root of the y equals two points and the y-axis. Specific look at the code ...
#include <stdio.h>#include <math.h>intMain () {DoubleYintX,K1,K2; for(y=1; y>=-1; y-=0.1) {k1=ACOs(y) *Ten; K2=ASIN(y) *Ten;if(k1<k2&&k2>=0) { for(x=1; x<k1;x++)printf(" ");printf("*"); for(x=k1+1; x<k2;x++)printf(" ");printf("*"); for(;x< --k2;x++)printf(" ");printf("*"); for(;x< +-k1;x++)printf(" ");printf("*\n"); }Else if(k2<k1&&1<=k2&&k2<= the) { for(x=1; x<k2;x++)printf(" ");printf("*"); for(x=k2+1; x<k1;x++)printf(" ");printf("*"); for(;x< --k2;x++)printf(" ");printf("*"); for(x= --k2;x< +-k1;x++)printf(" ");printf("*\n"); }Else if(k1< ( --K2) && ( --K2) < ( +-K1) &&- the<=k2&&k2<=-1) { for(x=1; x<k1;x++)printf(" ");printf("*"); for(;x< to-k2;x++)printf(" ");printf("*"); for(;x< +-k1;x++)printf(" ");printf("*"); for(;x< A+k2;x++)printf(" ");printf("*\n"); }Else if(( +-K1) < ( to-K2) &&- the<=k2&&k2<=-1) { for(x=1; x<k1;x++)printf(" ");printf("*"); for(;x< +-k1;x++)printf(" ");printf("*"); for(;x< to-k2;x++)printf(" ");printf("*"); for(;x< A+k2;x++)printf(" ");printf("*\n"); }return 0;}
Do you have any better ideas welcome message AH ~
"This is the source code, do not need the resource points"
The console plots the sinusoidal and cosine curves simultaneously display