<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mr.Ousi</title>
    <description>The latest articles on Forem by Mr.Ousi (@trungksousi).</description>
    <link>https://forem.com/trungksousi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F245960%2Fe28e6a69-d4f4-478d-8f49-46c85c01274c.jpg</url>
      <title>Forem: Mr.Ousi</title>
      <link>https://forem.com/trungksousi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/trungksousi"/>
    <language>en</language>
    <item>
      <title>Generation of pieslice without using library function in C.</title>
      <dc:creator>Mr.Ousi</dc:creator>
      <pubDate>Wed, 09 Oct 2019 08:04:21 +0000</pubDate>
      <link>https://forem.com/trungksousi/generation-of-pieslice-without-using-library-function-in-c-3m3e</link>
      <guid>https://forem.com/trungksousi/generation-of-pieslice-without-using-library-function-in-c-3m3e</guid>
      <description>&lt;p&gt;I was given an assignment to make a "pieslice" using the "graphics.h" header file of the BGI library of C,but without using the built-in function "pieslice()" of that header file.&lt;br&gt;
I used the parametric equation of circle,but unable to generate the figure using the graphics.h function. Some help would be nice. Thank you in advance.&lt;br&gt;
My code so far:&lt;/p&gt;

&lt;h1&gt;
  
  
  include
&lt;/h1&gt;

&lt;h1&gt;
  
  
  include
&lt;/h1&gt;

&lt;p&gt;static const double PI =3.141592&lt;/p&gt;

&lt;p&gt;int main()&lt;br&gt;
{&lt;br&gt;
    int gd=DETECT,gm;&lt;br&gt;
    initgraph(&amp;amp;gd,&amp;amp;gm,NULL);&lt;br&gt;
    int xc,yc,r,st_angle,ed_angle,k;&lt;br&gt;
    printf("Enter the centers of pieslice:\n");&lt;br&gt;
    scanf("%d %d",&amp;amp;xc,&amp;amp;yc);&lt;br&gt;
    printf("Enter the radius:\n");&lt;br&gt;
    scanf("%d",&amp;amp;r);&lt;br&gt;
    printf("Enter the starting angle:\n");&lt;br&gt;
    scanf("%d",&amp;amp;st_angle);&lt;br&gt;
    printf("Enter the end angle:\n");&lt;br&gt;
    scanf("%d",&amp;amp;ed_angle);&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for(k=st_angle; k&amp;lt;=ed_angle;k++)
{   
    double radians =(PI /180.0) * k;
    int X = xc+ cos(radians) * r;
    int Y = yc+ sin(radians) * r;
    putpixel(x,y,WHITE);
    delay(5000);

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;void wait_for_char()&lt;br&gt;
{&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Wait for a key press
int in = 0;

while (in == 0) {
    in = getchar();
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}&lt;br&gt;
getch();&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;While running the code[i am using gcc compiler of Ubuntu 16.0.4],i am encountering these errors:&lt;br&gt;
[xcb] Unknown sequence number while processing queue&lt;br&gt;
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called&lt;br&gt;
[xcb] Aborting, sorry about that.&lt;br&gt;
a.out: ../../src/xcb_io.c:274: poll_for_event: Assertion &lt;code&gt;!xcb_xlib_threads_sequence_lost' failed.&lt;br&gt;
[xcb] Unknown sequence number while processing queue&lt;br&gt;
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called&lt;br&gt;
[xcb] Aborting, sorry about that.&lt;br&gt;
a.out: ../../src/xcb_io.c:274: poll_for_event: Assertion&lt;/code&gt;!xcb_xlib_threads_sequence_lost' failed.&lt;br&gt;
Aborted (core dumped)&lt;/p&gt;

</description>
      <category>c</category>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
