C语言编制曲线轨迹动画程序

来源:百度知道 编辑:UC知道 时间:2024/09/18 23:31:54
画一圆的外摆线,使一个小五角星在曲线轨迹上移动。
x= (a+b)cost-bcos[(a+b)/b]t
y=(a+b)sint-bsin[(a+b)/b]t

a,b,t由键盘输入,输入的数据送文件保存,按回车键程序结束。(功能延伸:改变数据文件的内容后,再根据数据文件里的数据绘制外摆线)
要用Turbo C 2.0
能做出流程图不?
2)应用程序功能的详细说明
3)输入数据类型、格式和内容限制;
4)主要模块的算法描述
–以程序流程图的方式给出
–简要的语言描述
5)结束语
6)程序的源代码清单
貌似运行有问题~a b t无法用键盘输入~

#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>

void drawstar(int x, int y, int c, int r, int color);
void drawb(int x, int y, int r, int color);
void drawb0(int color);

int count = 0;
int posx[3500], posy[3500];

int main()
{
int GraphDriver;
int GraphMode;
int arg = 0;
int a, b;
int step = 5;
GraphDriver = DETECT;
initgraph(&GraphDriver, &GraphMode, "");

drawb(300, 150, 300, 12);
drawstar(posx[0], posy[0], 0, 15, 14);

while(1)
{
while(kbhit())
{
a = getch();
if (a == 13)
{
closegraph();
return 0;
}
if (a == 0)
{
b = getch();
if (b == 75)/*Left*/
{
drawstar(posx[arg], posy[arg], 0, 15, 0);
arg -