#include #include #include #define BLUE 9 #define GREEN 10 #define CYAN 11 #define RED 12 #define MAGENTA 13 #define YELLOW 14 #define WHITE 15 #define PI 3.14159 void plot(int x, int y, char sym, int color); void h_axis(int v_pos, int color); void v_axis(int h_pos, int color); int main( void ) { int x; int y; int a; int b; int f1; int f2; int v_pos; int h_pos; int color; double angle; char sym; a = 30; b = 8; f1 = 1; f2 = 3; v_pos = 0; h_pos = 0; color = RED; angle = 0; sym = '*'; for(angle = 0; angle <= (2 * PI); angle += .1) { x = a * sin(f1 * angle); y = b * cos(f2 * angle); plot(x, y, sym, color); } color = BLUE; h_axis(v_pos, color); color = YELLOW; v_axis(h_pos, color); return 0; } void plot(int x, int y, char sym, int color) { __textcolor(color); __gotoxy((x + 40),(10 - y)); printf("%c\n", sym); } void h_axis(int v_pos, int color) { __textcolor(color); for(v_pos = 0; v_pos <= 79; ++v_pos) { __gotoxy(v_pos,10); printf("-\n"); } } void v_axis(int h_pos, int color) { __textcolor(color); for(h_pos = 0; h_pos <= 20; ++h_pos) { __gotoxy(40,h_pos); printf("|\n"); } }