我想知道哪里出错了---关于以数组为参数的函数

来源:互联网 发布:中国农村淘宝研究报告 编辑:程序博客网 时间:2024/05/22 11:30
#include<graphics.h>#include<stdio.h>#include<math.h>#include<stdlib.h>#include<string.h>#include <conio.h>int a[100],b[100],c[100];void putstar(){  int i,dotx,doty,w,h,t;  w=getmaxx();  h=350;  for(i=0;i<100;i++)  {    dotx=rand()%(w-1);    a[i]=dotx;    doty=rand()%(h-1);    b[i]=doty;    t=rand()%(3);    c[i]=t;    setfillcolor(WHITE);    fillcircle(dotx,doty,t);  }}void revertstar(int a[],int b[],int c[]){  int i;  for(i=0;i<100;i++)  {    setfillcolor(WHITE);    fillcircle(a[i],b[i],c[i]);  }}void main(){    initgraph(640, 480);        int x = 320,y=240;setfillcolor(LIGHTBLUE);bar(0, 0,640,480);setfillcolor(GREEN);bar(0, 350,640,480);putstar();        // 画初始图形    setlinecolor(YELLOW);    setfillcolor(YELLOW);    fillcircle(x, y, 30);        char c;    while(c != 27)    {        // 获取按键        c = getch();                // 先擦掉上次显示的旧图形        setlinecolor(BLACK);        setfillcolor(BLACK);        fillcircle(x, y, 50);                // 根据输入,计算新的坐标        switch(c)        {            case 75: x-=2; break;            case 77: x+=2; break;            case 72: y-=2; break;            case 80: y+=2; break;            case 27: break;        }                // 绘制新的图形        setlinecolor(YELLOW);        setfillcolor(YELLOW);        fillcircle(x, y, 50);        revertstar(a,b,c);                // 延时        Sleep(10);    }        closegraph();}

0 0
原创粉丝点击