23.1.23010990. Kretanje nebeskih tijela: Merkur, Venera, Zemlja, Mjesec.
Opis rješenja:
Listing programa:
/* 23010990 kretanje nebeskih tijela: Merkur, Venera, Zemlja, Mjesec */
#include <cstdlib>
#include <iostream>
#include <winbgim.h>
#include <cmath>;
using namespace std;
int main()
{ int gdriver=6;
int gmode=2;
int xc(512),yc(384),r(300),rm(120), rv(210),x,y;
initgraph(&gdriver,&gmode,"");
setbkcolor(BLUE);
setcolor(WHITE);
cleardevice();
float me=-3.14,ve=3.14, mj=-3.14;
for (float j=-3.14; j<=31.4; me=me+.04,ve=ve+.017,j=j+.01,mj=mj+.12)
{cleardevice();
setcolor(YELLOW);circle(xc,yc,15);outtextxy(xc-5,yc-5,"S"); setcolor(WHITE);
x=xc+r*cos(j);
y=yc-r*sin(j);
circle(x,y,26);outtextxy(x-5,y-5,"Z");
x=x+50*cos(mj);
y=y-50*sin(mj);
circle(x,y,9);
x=xc+rm*cos(me);
y=yc-rm*sin(me);
circle(x,y,9);outtextxy(x-5,y-5,"M");
x=xc+rv*cos(ve);
y=yc-rv*sin(ve);
circle(x,y,24);outtextxy(x-5,y-5,"V");
for (int q=0; q<9000000;q++);
}
getch();
closegraph();
return EXIT_SUCCESS;
}
Ispis na ekranu:
Riješeni zadaci Index
|
|