Cronometru DLM
#include <graphics.h>Varianta cu grafica setata conform http://clasa11info.wikispaces.com/Grafica
#include<iostream>
#include <windows.h>
#include <math.h>
int main()
{double p;
int driver, mod;
initwindow(1400, 800);
double midx = getmaxx()/2;
double midy = getmaxy()/2;
double x, y, raza, unghi;
unghi = 0; raza = 200;
x = cos(unghi)*raza + midx;
p=x;
setcolor(15);
settextstyle(5,HORIZ_DIR,1);
line(midx,midy-raza,midx,midy-raza+10);
outtextxy(midx-13,midy-raza-18,"45");
line(midx,midy+raza,midx,midy+raza-10);
outtextxy(midx-13,midy+raza+5,"15");
line(midx+raza,midy,midx+raza-10,midy);
line(midx-raza,midy,midx-raza+10,midy);
outtextxy(midx-raza-28,midy-8,"30");
while(!kbhit())
{ x = cos(unghi)*raza + midx;
y = sin(unghi)*raza + midy;
setcolor(4);
circle(midx,midy,p-midx);
setcolor(5);
line(midx,midy,x,y);
unghi += 0.00138;
if(unghi >= 2*M_PI)
unghi=0;
delay(10);
setcolor(0);
line(midx, midy, x, y);
}
closegraph();
return 0;
}
#include "graphics2.h"
#include<iostream>
#include <windows.h>
#include <math.h>
int main()
{
int driver, mod;
initgraph(&driver, &mod, "", 1024, 768);
int midx = getmaxx()/2;
int midy = getmaxy()/2;
double p;
double x, y, raza, unghi;
unghi = 0; raza = 200;
x = cos(unghi)*raza + midx;
p=x;
setcolor(15);
settextstyle(5,HORIZ_DIR,1);
line(midx,midy-raza,midx,midy-raza+10);
outtextxy(midx-13,midy-raza-18,"45");
line(midx,midy+raza,midx,midy+raza-10);
outtextxy(midx-13,midy+raza+5,"15");
line(midx+raza,midy,midx+raza-10,midy);
line(midx-raza,midy,midx-raza+10,midy);
outtextxy(midx-raza-28,midy-8,"30");
while(!kbhit())
{ x = cos(unghi)*raza + midx;
y = sin(unghi)*raza + midy;
setcolor(4);
circle(midx,midy,p-midx);
setcolor(5);
line(midx,midy,x,y);
unghi += 3.14/1900;
if(unghi >= 2*M_PI)
unghi=0;
delay(1);
setcolor(0);
line(midx, midy, x, y);
}
}