方法一:使用matplotlib和numpy库
```python
import matplotlib.pyplot as plt
import numpy as np
def rose_curve(theta, k):
r = np.cos(k * theta)
return r
theta = np.linspace(0, 2 * np.pi, 1000)
k = 5
r = rose_curve(theta, k)
x = r * np.cos(theta)
y = r * np.sin(theta)
plt.figure(figsize=(6, 6))
plt.plot(x, y, 'r')
plt.axis('equal')
plt.title('A Rose in Python')
plt.show()
```
方法二:使用turtle库
```python
import turtle
def draw_flower():
turtle.bgcolor("black")
turtle.pensize(2)
colors = ["red", "blue", "purple", "yellow", "orange"]
for i in range(36):
turtle.color(colors[i % 5])
turtle.forward(100)
turtle.left(45)
turtle.forward(100)
turtle.left(135)
turtle.forward(100)
turtle.left(45)
turtle.forward(100)
turtle.left(170)
turtle.hideturtle()
turtle.done()
draw_flower()
```
方法三:使用C语言
```c
include
int main() {
int i, j, n;
printf("请输入玫瑰花的大小(建议输入10-20之间的数):");
scanf("%d", &n);
for (i = -n / 2; i <= n / 2; i++) {
for (j = -n / 2; j <= n / 2; j++) {
if (i * i + j * j <= (n / 2) * (n / 2)) {
if ((i + j) % 2 == 0) {
printf(" ");
} else {
printf("