悬赏100分!求做一个TC编程题(一定要用TC)!在线等,做好就给分!

来源:百度知道 编辑:UC知道 时间:2024/06/08 20:06:05
利用TC图形处理功能,在屏幕上画出两个小球,根据键盘输入的数字N,碰撞N次结束。
最好有注释!
在线急等!

碰撞那一方面没有仔细弄,所以应当有很多缺陷,但粗粗地看,马马虎虎过关。
注意TC下面一定要有EGAVGA.BGI文件。

/***************************************************
*Author :wacs5
*Date :20090105(YYYYMMDD)
*Function :简易查看碰撞过程
* 利用TC图形处理功能,在屏幕上画出两个小球,
* 根据键盘输入的数字N,碰撞N次结束。
****************************************************/
#include <stdio.h>
#include <conio.h>
#include <alloc.h>
#include <stdlib.h>
#include <math.h>
#include <Graphics.h>

#define DELAY 5000
#define RADIUS 60

main()
{
int gdriver=DETECT,gmode;
int errorcode;
int page=0;
int i,j,n,cn=0;

int x[2],y[2],color[2]={1,2};
int dx[2]={20,-19},dy[2]={12,7};
int temp[2];
int maxx,maxy;

/*输入次数*/
printf("Input collide times:");
scanf("%d",&n);
system("cls");

/*初始化图形驱动,并检测是否成功*/
initgraph(&gdri