-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path7.c
More file actions
68 lines (67 loc) · 1.63 KB
/
Copy path7.c
File metadata and controls
68 lines (67 loc) · 1.63 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <stdio.h>
#include <math.h>
int main()
{
int i;
float a, x, y1, y2;
a = 0.4;
printf(" y --------> \n");
printf("-------------------------------------\n");
for (x = 0; x < 5; x = x + 0.25)
{
y1 = (int)(50 * exp(-a * x) + 0.5);
y2 = (int)(50 * exp(-a * x + x / 2) + 0.5);
if (y1 == y2)
{
if (x == 2.5)
printf(" X |");
else
printf("|");
for (i = 1; i <= y1 - 1; ++i)
printf(" ");
printf("#\n");
continue;
}
if (y1 > y2)
{
if (x == 2.5)
printf(" X |");
else
printf(" |");
for (i = 1; i <= y2 - 1; ++i)
printf(" ");
printf("*");
for (i = 1; i <= (y1 - y2 - 1); ++i)
printf("-");
continue;
}
if (x == 2.5)
printf(" X |");
else
printf(" |");
for (i = 1; i <= (y1 - 1); ++i)
printf(" ");
printf("0");
for (i = 1; i <= (y2 - y1 - 1); ++i)
printf("-");
printf("*\n");
}
printf(" |n");
float j, s;
for (j = 1.1; j >= 0; j -= 0.1)
{
for (i = 0; i <= 5; i += 0.5)
{
s = exp(-a * x);
if (fabsf(s - j) <= 0.1)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
}