1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
|
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979
int main(){
int i, j, abstandLinks;
double x, y;
for(i = 0; i * PI/60 < 2*PI; i++)
{
x = i * PI/60;
y = sin(x) * cos(6*x);
abstandLinks = round(y * 30) + 30;
if(abstandLinks == 30)
printf("%30s", "0");
else if (abstandLinks > 30)
{
printf("%30s", "|");
for(j = abstandLinks - 30; j > 0; j--)
printf(" ");
printf("*");
}
else
{
for(j = abstandLinks - 1; j > 0; j--)
printf(" ");
printf("*");
for(j = 29 - abstandLinks; j > 0; j--)
printf(" ");
printf("|");
}
printf("\n");
}
} |