本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下
题目:在屏幕上用“*”显示0°~360°的余弦函数cos(x)曲线。
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
|
#include <stdio.h> #include <math.h> int main() { int x; double y; int m; int i; for (y = 1; y >= -1; y = y - 0.1) { x = acos (y) * 10; m = 62 - x; for (i = 0; i < x; i++) { printf ( " " ); } printf ( "*" ); for (i = x; i < m; i++) { printf ( " " ); } printf ( "*\n" ); } return 0; } |
题目:在屏幕上用“*”显示0°~360°的正弦函数sin(x)曲线。
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
|
//用“*”显示0~360的sin(x)的曲线 #include <stdio.h> #include <math.h> int main() { int x; int m; int i; double y; for (y = 1; y >= 0.1; y = y - 0.1) { x = asin (y) * 10; m = 31 - x; for (i = 0; i < x; i++) { printf ( " " ); } printf ( "*" ); for ( ; i < m; i++) { printf ( " " ); } printf ( "*\n" ); } printf ( "*" ); for (i = 0; i < 31; i++) { printf ( " " ); } printf ( "*" ); for (i = 31; i < 62; i++) { printf ( " " ); } printf ( "*\n" ); for (y = -0.1; y >= -1; y = y - 0.1) { x = - asin (y) * 10; m = 31 - x; for (i = 0; i < x + 32; i++) { printf ( " " ); } printf ( "*" ); for (i = x; i < m; i++) { printf ( " " ); } printf ( "*\n" ); } return 0; } |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/newcong0123/article/details/52517350