### Drawing shapes any simpler way ?

I'm a beginner and I have a task to make a circle and a square frame around it.... I started off reading about drawing a circle but I found mostly advanced methods using graphics or so and I finaly managed to come to this cource below but I keep getting the msg "The variable 'c' is being used without being initialized."

So I cannot even see what's the output. Can someone tell me why I get this msg and if I am on the right track?

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849`` ``````#include #include #include #include using namespace std; struct circle{ double radius; double center_X; double center_Y; int px[360]; int py[360]; }; struct frame{ double up_r_X; double up_r_Y; double d_l_X; double d_l_Y; }; int main() { circle c; cout<<"Please provide coordinates:\n"; cin>>c.radius; cin>>c.center_X; cin>>c.center_Y; const double PI=3.14; float angle=0; int i; HDC hdc; HPEN hPenOld; HPEN hLinePen; COLORREF xio = RGB(255,0,0); hLinePen = CreatePen(PS_SOLID, 2, xio); hPenOld = (HPEN)SelectObject(hdc, hLinePen); double degree; double deg_to_rads; deg_to_rads=0.018; for(i=1;i<360;i++) { degree=i*deg_to_rads; c.px[i]=c.center_X+(c.radius*sin(degree)); c.py[i]=c.center_Y+(c.radius*cos(degree)); MoveToEx(hdc,c.px[i],c.py[i],NULL); LineTo(hdc,c.center_X,c.center_Y); } }``````

In addition using structiors for the circle I am trying to draw and the frame around is part of the task.
Last edited on
I tried to compile your code and the compiler said nothing about 'c'. Are you sure the error was not about hdc ?

Besides, it should just be a warning, not an error.
Topic archived. No new replies allowed.