Moon Earth Sun C++ Programming by
virajith lankeshwara
#include <iostream>
#include<stdio.h>
#include <graphics.h>
#include<math.h>
#define Pi 3.412
int main()
{
double t,t1=0;
double a=200,b=50;
double x,y,x1,y1;
float r;
initwindow(600,600);
setcolor(YELLOW);
circle(299,299,50);
for (double t = 0; t < 2000*Pi; t =t+0.01)
{
x=a*sin(t)+299;
y=a*cos(t)+299;
setcolor(WHITE);
circle(299,299,200);
setcolor(WHITE);
circle(x,y,50);
setcolor(MAGENTA);
circle(x,y,20);
delay(50);
setcolor(BLACK);
circle(x,y,20);
setcolor(WHITE);
circle(x,y,50);
setcolor(BLACK);
circle(x,y,50);
t1 =t1+0.1;
x1=b*sin(t1)+x;
y1=b*cos(t1)+y;
setcolor(WHITE);
circle(x,y,50);
setcolor(BLACK);
circle(x,y,50);
setcolor(WHITE);
circle(x1,y1,10);
delay(50);
setcolor(BLACK);
circle(x1,y1,10);
}
getch();
return 0;
}
Comments
Post a Comment