Ⅰ C语言设计一个简单的图形动画,用turboc2运行,怎样编写使图形动起来的代码
1、首先,打开vc6.0,建立程序编写页面,建立C语言环境,声明两个整数型变量。
Ⅱ 怎么用C语言做二维 三维 动画 窗口的程序
我有相关的资料(原版英文书), 但无法传递给你!!! 给你个实例程序:(太长,程序没发完)
/*
GRAPHICS DEMO FOR TURBO C 2.0
Copyright (c) 1987,88 Borland International. All rights reserved.
From the command line, use:
tcc bgidemo graphics.lib
*/
#ifdef __TINY__
#error BGIDEMO will not run in the tiny model.
#endif
#include <dos.h>
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <graphics.h>
#define ESC 0x1b /* Define the escape key */
#define TRUE 1 /* Define some handy constants */
#define FALSE 0 /* Define some handy constants */
#define PI 3.14159 /* Define a value for PI */
#define ON 1 /* Define some handy constants */
#define OFF 0 /* Define some handy constants */
char *Fonts[] = {
"DefaultFont", "TriplexFont", "SmallFont",
"SansSerifFont", "GothicFont"
};
char *LineStyles[] = {
"SolidLn", "DottedLn", "CenterLn", "DashedLn", "UserBitLn"
};
char *FillStyles[] = {
"EmptyFill", "SolidFill", "LineFill", "LtSlashFill",
"SlashFill", "BkSlashFill", "LtBkSlashFill", "HatchFill",
"XHatchFill", "InterleaveFill", "WideDotFill", "CloseDotFill"
};
char *TextDirect[] = {
"HorizDir", "VertDir"
};
char *HorizJust[] = {
"LeftText", "CenterText", "RightText"
};
char *VertJust[] = {
"BottomText", "CenterText", "TopText"
};
struct PTS {
int x, y;
}; /* Structure to hold vertex points */
int GraphDriver; /* The Graphics device driver */
int GraphMode; /* The Graphics mode value */
double AspectRatio; /* Aspect ratio of a pixel on the screen*/
int MaxX, MaxY; /* The maximum resolution of the screen */
int MaxColors; /* The maximum # of colors available */
int ErrorCode; /* Reports any graphics errors */
struct palettetype palette; /* Used to read palette info */
/* */
/* Function prototypes */
/* */
void Initialize(void);
void ReportStatus(void);
void TextDump(void);
void Bar3DDemo(void);
void RandomBars(void);
void TextDemo(void);
void ColorDemo(void);
void ArcDemo(void);
void CircleDemo(void);
void PieDemo(void);
void BarDemo(void);
void LineRelDemo(void);
void PutPixelDemo(void);
void PutImageDemo(void);
void LineToDemo(void);
void LineStyleDemo(void);
void CRTModeDemo(void);
void UserLineStyleDemo(void);
void FillStyleDemo(void);
void FillPatternDemo(void);
void PaletteDemo(void);
void PolyDemo(void);
void SayGoodbye(void);
void Pause(void);
void MainWindow(char *header);
void StatusLine(char *msg);
void DrawBorder(void);
void changetextstyle(int font, int direction, int charsize);
int gprintf(int *xloc, int *yloc, char *fmt, ... );
/* */
/* Begin main function */
/* */
int main()
{
Initialize(); /* Set system into Graphics mode */
ReportStatus(); /* Report results of the initialization */
ColorDemo(); /* Begin actual demonstration */
if( GraphDriver==EGA || GraphDriver==EGALO || GraphDriver==VGA )
PaletteDemo();
PutPixelDemo();
PutImageDemo();
Bar3DDemo();
BarDemo();
RandomBars();
ArcDemo();
CircleDemo();
PieDemo();
LineRelDemo();
LineToDemo();
LineStyleDemo();
UserLineStyleDemo();
TextDump();
TextDemo();
CRTModeDemo();
FillStyleDemo();
FillPatternDemo();
PolyDemo();
SayGoodbye(); /* Give user the closing screen */
closegraph(); /* Return the system to text mode */
return(0);
}
/* */
/* INITIALIZE: Initializes the graphics system and reports */
/* any errors which occured. */
/* */
void Initialize(void)
{
int xasp, yasp; /* Used to read the aspect ratio*/
GraphDriver = DETECT; /* Request auto-detection */
initgraph( &GraphDriver, &GraphMode, "" );
ErrorCode = graphresult(); /* Read result of initialization*/
if( ErrorCode != grOk ){ /* Error occured ring init */
printf(" Graphics System Error: %s\n", grapherrormsg( ErrorCode ) );
exit( 1 );
}
getpalette( &palette ); /* Read the palette from board */
MaxColors = getmaxcolor() + 1; /* Read maximum number of colors*/
MaxX = getmaxx();
MaxY = getmaxy(); /* Read size of screen */
getaspectratio( &xasp, &yasp ); /* read the hardware aspect */
AspectRatio = (double)xasp / (double)yasp; /* Get correction factor */
}
/* */
/* REPORTSTATUS: Report the current configuration of the system */
/* after the auto-detect initialization. */
/* */
void ReportStatus(void)
{
struct viewporttype viewinfo; /* Params for inquiry proceres*/
struct linesettingstype lineinfo;
struct fillsettingstype fillinfo;
struct textsettingstype textinfo;
struct palettetype palette;
char *driver, *mode; /* Strings for driver and mode */
int x, y;
getviewsettings( &viewinfo );
getlinesettings( &lineinfo );
getfillsettings( &fillinfo );
gettextsettings( &textinfo );
getpalette( &palette );
x = 10;
y = 4;
MainWindow( "Status report after InitGraph" );
settextjustify( LEFT_TEXT, TOP_TEXT );
driver = getdrivername();
mode = getmodename(GraphMode); /* get current setting */
gprintf( &x, &y, "Graphics device : %-20s (%d)", driver, GraphDriver );
gprintf( &x, &y, "Graphics mode : %-20s (%d)", mode, GraphMode );
gprintf( &x, &y, "Screen resolution : ( 0, 0, %d, %d )", getmaxx(), getmaxy() );
gprintf( &x, &y, "Current view port : ( %d, %d, %d, %d )",
viewinfo.left, viewinfo.top, viewinfo.right, viewinfo.bottom );
gprintf( &x, &y, "Clipping : %s", viewinfo.clip ? "ON" : "OFF" );
gprintf( &x, &y, "Current position : ( %d, %d )", getx(), gety() );
gprintf( &x, &y, "Colors available : %d", MaxColors );
gprintf( &x, &y, "Current color : %d", getcolor() );
gprintf( &x, &y, "Line style : %s", LineStyles[ lineinfo.linestyle ] );
gprintf( &x, &y, "Line thickness : %d", lineinfo.thickness );
gprintf( &x, &y, "Current fill style : %s", FillStyles[ fillinfo.pattern ] );
gprintf( &x, &y, "Current fill color : %d", fillinfo.color );
gprintf( &x, &y, "Current font : %s", Fonts[ textinfo.font ] );
gprintf( &x, &y, "Text direction : %s", TextDirect[ textinfo.direction ] );
gprintf( &x, &y, "Character size : %d", textinfo.charsize );
gprintf( &x, &y, "Horizontal justify : %s", HorizJust[ textinfo.horiz ] );
gprintf( &x, &y, "Vertical justify : %s", VertJust[ textinfo.vert ] );
Pause(); /* Pause for user to read screen*/
}
/* */
/* TEXTDUMP: Display the all the characters in each of the */
/* available fonts. */
/* */
void TextDump()
{
static int CGASizes[] = {
1, 3, 7, 3, 3 };
static int NormSizes[] = {
1, 4, 7, 4, 4 };
char buffer[80];
int font, ch, wwidth, lwidth, size;
struct viewporttype vp;
for( font=0 ; font<5 ; ++font ){ /* For each available font */
sprintf( buffer, "%s Character Set", Fonts[font] );
MainWindow( buffer ); /* Display fontname as banner */
getviewsettings( &vp ); /* read current viewport */
settextjustify( LEFT_TEXT, TOP_TEXT );
moveto( 2, 3 );
buffer[1] = '\0'; /* Terminate string */
wwidth = vp.right - vp.left; /* Determine the window width */
lwidth = textwidth( "H" ); /* Get average letter width */
if( font == DEFAULT_FONT ){
changetextstyle( font, HORIZ_DIR, 1 );
ch = 0;
while( ch < 256 ){ /* For each possible character */
buffer[0] = ch; /* Put character into a string */
outtext( buffer ); /* send string to screen */
if( (getx() + lwidth) > wwidth )
moveto( 2, gety() + textheight("H") + 3 );
++ch; /* Goto the next character */
}
}
else{
size = (MaxY < 200) ? CGASizes[font] : NormSizes[font];
changetextstyle( font, HORIZ_DIR, size );
ch = '!'; /* Begin at 1st printable */
while( ch < 127 ){ /* For each printable character */
buffer[0] = ch; /* Put character into a string */
outtext( buffer ); /* send string to screen */
if( (lwidth+getx()) > wwidth ) /* Are we still in window? */
moveto( 2, gety()+textheight("H")+3 );
++ch; /* Goto the next character */
}
}
Pause(); /* Pause until user acks */
} /* End of FONT loop */
}
/* */
/* BAR3DDEMO: Display a 3-D bar chart on the screen. */
/* */
void Bar3DDemo(void)
{
static int barheight[] = {
1, 3, 5, 4, 3, 2, 1, 5, 4, 2, 3 };
struct viewporttype vp;
int xstep, ystep;
int i, j, h, color, bheight;
char buffer[10];
MainWindow( "Bar 3-D / Rectangle Demonstration" );
h = 3 * textheight( "H" );
getviewsettings( &vp );
settextjustify( CENTER_TEXT, TOP_TEXT );
changetextstyle( TRIPLEX_FONT, HORIZ_DIR, 4 );
outtextxy( MaxX/2, 6, "These are 3-D Bars" );
changetextstyle( DEFAULT_FONT, HORIZ_DIR, 1 );
setviewport( vp.left+50, vp.top+40, vp.right-50, vp.bottom-10, 1 );
getviewsettings( &vp );
line( h, h, h, vp.bottom-vp.top-h );
line( h, (vp.bottom-vp.top)-h, (vp.right-vp.left)-h, (vp.bottom-vp.top)-h );
xstep = ((vp.right-vp.left) - (2*h)) / 10;
ystep = ((vp.bottom-vp.top) - (2*h)) / 5;
j = (vp.bottom-vp.top) - h;
settextjustify( CENTER_TEXT, CENTER_TEXT );
for( i=0 ; i<6 ; ++i ){
line( h/2, j, h, j );
itoa( i, buffer, 10 );
outtextxy( 0, j, buffer );
j -= ystep;
}
j = h;
settextjustify( CENTER_TEXT, TOP_TEXT );
for( i=0 ; i<11 ; ++i ){
color = random( MaxColors );
setfillstyle( i+1, color );
line( j, (vp.bottom-vp.top)-h, j, (vp.bottom-vp.top-3)-(h/2) );
itoa( i, buffer, 10 );
outtextxy( j, (vp.bottom-vp.top)-(h/2), buffer );
if( i != 10 ){
bheight = (vp.bottom-vp.top) - h - 1;
bar3d( j, (vp.bottom-vp.top-h)-(barheight[i]*ystep), j+xstep, bheight, 15, 1 );
}
j += xstep;
}
Pause(); /* Pause for user's response */
}
/* */
/* RANDOMBARS: Display random bars */
/* */
void RandomBars(void)
{
int color;
MainWindow( "Random Bars" );
StatusLine( "Esc aborts or press a key..." ); /* Put msg at bottom of screen */
while( !kbhit() ){ /* Until user enters a key... */
color = random( MaxColors-1 )+1;
setcolor( color );
setfillstyle( random(11)+1, color );
bar3d( random( getmaxx() ), random( getmaxy() ),
random( getmaxx() ), random( getmaxy() ), 0, OFF);
}
Pause(); /* Pause for user's response */
}
/* */
/* TEXTDEMO: Show each font in several sizes to the user. */
/* */
void TextDemo(void)
{
int charsize[] = {
1, 3, 7, 3, 4 };
int font, size;
int h, x, y, i;
struct viewporttype vp;
char buffer[80];
for( font=0 ; font<5 ; ++font ){ /* For each of the four fonts */
sprintf( buffer, "%s Demonstration", Fonts[font] );
MainWindow( buffer );
getviewsettings( &vp );
changetextstyle( font, VERT_DIR, charsize[font] );
settextjustify( CENTER_TEXT, BOTTOM_TEXT );
outtextxy( 2*textwidth("M"), vp.bottom - 2*textheight("M"), "Vertical" );
changetextstyle( font, HORIZ_DIR, charsize[font] );
settextjustify( LEFT_TEXT, TOP_TEXT );
outtextxy( 2*textwidth("M"), 2, "Horizontal" );
settextjustify( CENTER_TEXT, CENTER_TEXT );
x = (vp.right - vp.left) / 2;
y = textheight( "H" );
for( i=1 ; i<5 ; ++i ){ /* For each of the sizes */
size = (font == SMALL_FONT) ? i+3 : i;
changetextstyle( font, HORIZ_DIR, size );
h = textheight( "H" );
y += h;
sprintf( buffer, "Size %d", size );
outtextxy( x, y, buffer );
}
if( font != DEFAULT_FONT ){ /* Show user declared font size */
y += h / 2; /* Move down the screen */
settextjustify( CENTER_TEXT, TOP_TEXT );
setusercharsize( 5, 6, 3, 2 );
changetextstyle( font, HORIZ_DIR, USER_CHAR_SIZE );
outtextxy( (vp.right-vp.left)/2, y, "User Defined Size" );
}
Pause(); /* Pause to let user look */
} /* End of FONT loop */
}
/* */
/* COLORDEMO: Display the current color palette on the screen. */
/* */
void ColorDemo(void)
{
struct viewporttype vp;
int color, height, width;
int x, y, i, j;
char cnum[5];
MainWindow( "Color Demonstration" ); /* Show demonstration name */
color = 1;
getviewsettings( &vp ); /* Get the current window size */
width = 2 * ( (vp.right+1) / 16 ); /* Get box dimensions */
height = 2 * ( (vp.bottom-10) / 10 );
x = width / 2;
y = height / 2; /* Leave 1/2 box border */
for( j=0 ; j<3 ; ++j ){ /* Row loop */
for( i=0 ; i<5 ; ++i ){ /* Column loop */
setfillstyle(SOLID_FILL, color); /* Set to solid fill in color */
setcolor( color ); /* Set the same border color */
bar( x, y, x+width, y+height ); /* Draw the rectangle */
rectangle( x, y, x+width, y+height ); /* outline the rectangle */
if( color == BLACK ){ /* If box was black... */
setcolor( WHITE ); /* Set drawing color to white */
rectangle( x, y, x+width, y+height ); /* Outline black in white*/
}
itoa( color, cnum, 10 ); /* Convert # to ASCII */
outtextxy( x+(width/2), y+height+4, cnum ); /* Show color # */
color = ++color % MaxColors; /* Advance to the next color */
x += (width / 2) * 3; /* move the column base */
} /* End of Column loop */
y += (height / 2) * 3; /* move the row base */
x = width / 2; /* reset column base */
} /* End of Row loop */
Pause(); /* Pause for user's response */
}
/* */
/* ARCDEMO: Display a random pattern of arcs on the screen */
/* until the user says enough. */
/* */
void ArcDemo(void)
{
int mradius; /* Maximum radius allowed */
int eangle; /* Random end angle of Arc */
struct arccoordstype ai; /* Used to read Arc Cord info */
MainWindow( "Arc Demonstration" );
StatusLine( "ESC Aborts - Press a Key to stop" );
mradius = MaxY / 10; /* Determine the maximum radius */
while( !kbhit() ){ /* Repeat until a key is hit */
setcolor( random( MaxColors - 1 ) + 1 ); /* Randomly select a color */
eangle = random( 358 ) + 1; /* Select an end angle */
arc( random(MaxX), random(MaxY), random(eangle), eangle, mradius );
getarccoords( &ai ); /* Read Cord data */
line( ai.x, ai.y, ai.xstart, ai.ystart ); /* line from start to center */
line( ai.x, ai.y, ai.xend, ai.yend ); /* line from end to center */
} /* End of WHILE not KBHIT */
Pause(); /* Wait for user's response */
}
Ⅲ 怎么用C语言编程实现一个简单的动画
1.可以考虑用Turbo C的绘图函数(附加graphic.h库)或者用opengl+glut等来实现。2.前者一般就是纯粹的画点画线。网上也能找到教程。3.主要说一下后者。可以导入图片,并且二维、三维动画都可以做,甚至是用来开发游戏。后者可以用vc6.0或者vs2005来开发。跨平台。参考教程: http://www.owlei.com/DancingWind/看你的描述要做比较偏数学的东西,那你自己得弄明白如何去实现绘制算法。要实现的动画本身而搭的基本框架不会很复杂的,可能100行代码都不用。4.另外还有opencv、GDI之类的可能更适合二维图像处理库,但我自己不是很了解了,你也可以查一查用哪种绘图库比较适合你。
Ⅳ 求一简单的C语言动画程序。
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
typedef struct snake
{
int a;
int b;
struct snake *u;
struct snake *n;
}snake,*snake1;
typedef struct food
{
int a;
int b;
}food;
void main()
{
char c,c0 = 'd';
int i,j,k,n=1,t,at;
snake p,q;
snake *dd,*dd0,*dd1,*dd2;
food f;
srand(time(NULL));
p.u = NULL;
p.n = &q;
p.a = 5;p.b = 6;q.a = 5;q.b = 5;
q.u = &p;q.n = NULL;
dd=dd2= &q;
f.a=(rand()%15+1);
f.b=(rand()%15+1);
while(1)
{
srand(time(NULL));
system("cls");
for(i = 0;i < 17;i ++)
{
for(j = 0; j < 17;j++)
{
if(i == 0 )
printf("▁");
else if(i == 16)
printf("▔");
else if(j == 0)
printf("▕");
else if(j == 16)
printf("▏");
else if(i == p.a && j == p.b)
printf("■");
else if(i == f.a && j == f.b)
printf("★");
else
{
t = 0;
dd = dd2;
for(k = 0; k < n ;k++)
{
if(i == dd->a && j == dd->b)
{
printf("□");
t = 1;
break;
}
dd = dd->u;
}
if(t == 0)
printf(" ");
}
}printf("\n");
}
at = 0;
dd =dd2;
for(i=0;i<n;i++)
{
if(p.a == dd->a && p.b == dd->b)
{
printf("game over!!\n");
exit(0);
}
dd = dd->u;
}
if(p.a == f.a && p.b == f.b)
{
dd = dd2;
at =1;
f.a = (rand()%15+1);
f.b = (rand()%15+1);
for(i=0;i<n;i++)
{
if(f.a == dd->a && f.b == dd->b)
{
f.a = dd2->a;
f.b = dd2->b;
break;
}
}
n++;
}
if(kbhit())
{
c = getch();
dd = dd2;
if(c == 'w' && c0 != 's')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.a == 1)
p.a = 15;
else
p.a = (p.a-1)%15;
}
else if(c == 's' && c0 != 'w')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.a = (p.a%15)+1;
}
else if(c == 'a' && c0 != 'd')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.b == 1)
p.b = 15;
else
p.b = (p.b-1)%15;
}
else if(c == 'd' && c0 != 'a')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.b = (p.b%15)+1;
}
else
{
goto qq;
}
c0 = c;
}
else
{
qq: if(c0 == 'w')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.a == 1)
p.a = 15;
else
p.a=(p.a-1)%15;
}
else if(c0 == 's')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.a=(p.a%15)+1;
}
else if(c0 == 'a')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.b == 1)
p.b = 15;
else
p.b=(p.b-1)%15;
}
else if(c0 == 'd')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.b=(p.b%15)+1;
}
}
fflush(stdin);
dd = &q;
_sleep(200);
}
}
Ⅳ 用C语言如何实现3D
楼上说的对,一般实现3D用的就是这两种。一般来讲中国的游戏公司(比如完美)用D3D的多一些(因为函数都封装好了,不涉及到复杂的线性变换),我入门的时候用OpenGL,网上都有教程,有个叫Nehe做得OpenGL教程很好
Ⅵ 怎么用C语言绘制3D图形,实现类似于UE4这样的效果
我先给个例子,#include <graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include "conio.h"
#include"math.h"
void main()
{
int gdriver=DETECT,gmode; /*图形模式设定*/
char f;
int m,n,x,y,t;
int color;
x=320;y=240;
m=0;n=0;
initgraph(&gdriver,&gmode,"c: \\tc");
printf("qweadzxc stand for eight direction,p to exit,and the number stand for color when paint\n");
printf("input anykey to start\n");
getch();
printf("PLEASE INPUT THE COLOR\n");
scanf("%d",&color);
loop:
while(!kbhit())
{
putpixel(x,y,color);
x=x+m;y=y+n;
for(t=0;t<=50;t++)
delay(100);
}
f=getch();
if(f=='w'||f=='W')
{
m=0;n=-1;
goto loop;
}
if(f=='x'||f=='X')
{
m=0;n=1;
goto loop;
}
if(f=='a'||f=='A')
{
m=-1;n=0;
goto loop;
}
if(f=='d'||f=='D')
{
m=1;n=0;
goto loop;
}
if(f=='q'||f=='Q')
{
m=-1;n=-1;
goto loop;
}
if(f=='e'||f=='E')
{
m=1;n=-1;
goto loop;
}
if(f=='z'||f=='Z')
{
m=-1;n=1;
goto loop;
}
if(f=='c'||f=='C')
{
m=1;n=1;
goto loop;
}
if(f==' ')
{
m=0;n=0;
getch();
goto loop;
}
if(f=='p'||f=='P')
goto end;
if(f=='s'||f=='S')
{
printf("please input the color you want to set\n");
scanf("%d",&color);
goto loop;
}
else
{
printf("ERROR!\n");
goto loop;
}
end:
getch();
closegraph(); /*退出图形模式*/
}