English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

How to use C++ to write a program for drawing a circle??

2007-04-18 10:30:13 · 2 個解答 · 發問者 goodaskmansir 1 in 電腦與網際網路 程式設計

2 個解答

The source code you wanted can be found at the below URL.
http://www.daniweb.com/code/snippet82.html

2007-04-18 10:49:24 · answer #1 · answered by ? 7 · 0 0

This should be a homework, as a graphic programmer,
I used OpenGL with C++ ..., I cannot give you code, since it is all
different, and in C++, we use classes and virtual functions.
All you need to think about the design is :
1. A circle has 360 degree.
2. Think the circle like the clock, when the radius/arm turn a complete 360 degree,
it draw a circle ...
3. now for each degree, we put a dot at one end of the radius away from the center.
4. you will have all the 360 dots connected together and form a circle ... just the shape of it.
5. if you want a DISC, a filled circle, you need to think a circle as a lot of triangle combined together like a slice of a pie !
There is also a cos and sin TRI. formula for circle, that you can use like
the reference below, but that need math.h (math library), I like my primitive way of thinking in Computer science without using math library, except a graphic function to write a DOT (X,Y) in the 2D screen.
Hope all help la. :)

2007-04-18 10:50:58 · answer #2 · answered by alien3333 7 · 0 0

fedest.com, questions and answers