無事形になってきました。ありがとうございます。
次の円を描くときに、前の円を消去したいです。
(1つのボールが動いているように見せたい、ということです)
Circle(x,y,5,6)の前に
system("cls")を書きいれたのですが、
'system’ undefindというエラーが出ました。
関数なのに定義が必要なのですか?
それとも別の方法をとるべきですか?
ご教授お願いします。
#include "Graph.h"
#include <stdio.h>
#include <conio.h>
#include <math.h>
main()
{
double x,y;
double vx,vy;
double t,g;
double e,h,t1;
int c,a;
SetGraphicsMode();
ClearScreen(0);
g=9.8;
t=0.0;
c=0;
a=1;
e = 0.8;
h = 20;
t1 = -sqrt(2*h/g);
x=0.0;
y=20.0;
vx=10.0;
vy=-sqrt(2*g*h);
for(t=0; t<=20; t=t+0.01)
{
x = vx * t;
y = 20 + (vy * (t - t1) + 0.5 * g * (t - t1) * (t - t1));
if(y > 20)
{
c ++;
vy = - pow(e, c) * sqrt(2*g*h);
t1 += 2 * pow(e, c - 1) * sqrt(2*h/g);
}
else
{
system("cls");
Circle(10*x,10*y,5,6);
}
}
SetCursorPos(0, 0);
printf("Push Anykey!");
getch();
RestoreMode();
}