برنامه رسم دایره برسنهام به زبان ++c

shetaw

New Member
ارسال ها
4
لایک ها
14
امتیاز
0
#1
کد
[COLOR=#000000][COLOR=#FF8000]#include    #include   #include   #include   [/COLOR][COLOR=#0000BB]void main[/COLOR][COLOR=#007700]()  {  [/COLOR][COLOR=#FF8000]//Detect Graphic Mode  [/COLOR][COLOR=#0000BB]int driver [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]DETECT[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]mode[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]initgraph[/COLOR][COLOR=#007700](&[/COLOR][COLOR=#0000BB]driver[/COLOR][COLOR=#007700],&[/COLOR][COLOR=#0000BB]mode[/COLOR][COLOR=#007700],[/COLOR][COLOR=#DD0000]"c:\\tc\\bgi"[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#FF8000]//Program Start  [/COLOR][COLOR=#0000BB]int xcenter[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]r[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]p[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]i[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]cout[/COLOR][COLOR=#007700]<<[/COLOR][COLOR=#DD0000]"Enter R"[/COLOR][COLOR=#007700]< [/COLOR][COLOR=#0000BB]cin[/COLOR][COLOR=#007700]>>[/COLOR][COLOR=#0000BB]r[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]r[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]r[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]r[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]p[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]r[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  while ([/COLOR][COLOR=#0000BB]x [/COLOR][COLOR=#007700]{  [/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700]++;  if ([/COLOR][COLOR=#0000BB]p[/COLOR][COLOR=#007700]<[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700])  [/COLOR][COLOR=#0000BB]p[/COLOR][COLOR=#007700]+=[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]*[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700];  else  {  [/COLOR][COLOR=#0000BB]p[/COLOR][COLOR=#007700]+=[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]*([/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700])+[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700];  [/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700]--;  }  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  [/COLOR][COLOR=#0000BB]putpixel[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]xcenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]y[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]ycenter[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]x[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]);  }  [/COLOR][COLOR=#0000BB]getch[/COLOR][COLOR=#007700]();  }  [/COLOR][/COLOR]
 
بالا