kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Thứ Ba, 29 tháng 4, 2014

Yêu cầu: Đã cài đặt Code::Blocks 10.05 và đã cấu hình đồ họa cho Code::Blocks. Nếu chưa cài đặt, bạn phải xem 2 bài viết này:
  1. Cài đặt Code::Blocks 10.05
  2. Cấu hình đồ họa cho Code::Blocks 10.05
Xem video để biết thứ tự viết mã lệnh: chọn chế độ 720p để xem rõ nhất - mã lệnh chương trình ở bên dưới


Mã lệnh:
#include <graphics.h>
#include <conio.h>
#include <math.h>
#define PI 3.14159265359

float
d2r (int d){
//convert degree to radian
return d*PI/180.0;
}

int
main(){
initwindow
(640,480);
int
xc = 320, yc = 240, r = 200;
int
d = 270;
while
(1){
for
(int i = 0; i<=5;i++){
int
x = xc + (int)(r * cos(d2r(d)));
int
y = yc + (int)(r * sin(d2r(d)));
if
(i == 0)
moveto
(x,y);
else

lineto
(x,y);
d
+=144;
setcolor
(i+1);
}

d
+=5;
delay
(100);
}

getch
();
return
0;
}
29 Apr 2014

0 nhận xét:

Đăng nhận xét

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

domain, domain name, premium domain name for sales

Bài đăng phổ biến