{"id":24866,"date":"2017-10-15T12:38:22","date_gmt":"2017-10-15T07:08:22","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=24866"},"modified":"2017-10-15T12:38:22","modified_gmt":"2017-10-15T07:08:22","slug":"traffic-light-program-c-traffic-light-simulation","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/traffic-light-program-c-traffic-light-simulation\/","title":{"rendered":"traffic light program in c, traffic light simulation"},"content":{"rendered":"<p>Traffic light Simulation: Traffic light program in c presents what happens in our daily life at traffic light signals. Firstly user will press a key to start the traffic light simulation.<\/p>\n<h2 id=\"c-programming-code\">C programming code<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">#include&lt;graphics.h&gt;<br\/>#include&lt;conio.h&gt;<br\/>#include&lt;dos.h&gt;<br\/>#include&lt;stdlib.h&gt;<br\/> <br\/>main()<br\/>{<br\/>   int gd = DETECT, gm, midx, midy;<br\/> <br\/>   initgraph(&amp;gd, &amp;gm, &quot;C:\\\\TC\\\\BGI&quot;);<br\/> <br\/>   midx = getmaxx()\/2;<br\/>   midy = getmaxy()\/2;<br\/> <br\/>   setcolor(RED);<br\/>   settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);<br\/>   settextjustify(CENTER_TEXT, CENTER_TEXT);<br\/>   outtextxy(midx, midy-10, &quot;Traffic Light Simulation&quot;);<br\/>   outtextxy(midx, midy+10, &quot;Press any key to start&quot;);<br\/>   getch();<br\/>   cleardevice();<br\/>   setcolor(WHITE);<br\/>   settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);<br\/>   rectangle(midx-30,midy-80,midx+30,midy+80);<br\/>   circle(midx, midy-50, 22);<br\/>   setfillstyle(SOLID_FILL,RED);<br\/>   floodfill(midx, midy-50,WHITE);<br\/>   setcolor(BLUE);<br\/>   outtextxy(midx,midy-50,&quot;STOP&quot;);<br\/>   delay(2000);<br\/>   graphdefaults();<br\/>   cleardevice();<br\/>   setcolor(WHITE);<br\/>   rectangle(midx-30,midy-80,midx+30,midy+80);<br\/>   circle(midx, midy, 20);<br\/>   setfillstyle(SOLID_FILL,YELLOW);<br\/>   floodfill(midx, midy,WHITE);<br\/>   setcolor(BLUE);<br\/>   outtextxy(midx-18,midy-3,&quot;READY&quot;);<br\/> <br\/>   delay(2000);<br\/>   cleardevice();<br\/>   setcolor(WHITE);<br\/>   rectangle(midx-30,midy-80,midx+30,midy+80);<br\/>   circle(midx, midy+50, 22);<br\/>   setfillstyle(SOLID_FILL,GREEN);<br\/>   floodfill(midx, midy+50,WHITE);<br\/>   setcolor(BLUE);<br\/>   outtextxy(midx-7,midy+48,&quot;GO&quot;);<br\/>   setcolor(RED);<br\/>   settextstyle(SCRIPT_FONT, HORIZ_DIR, 4);<br\/>   outtextxy(midx-150, midy+100, &quot;Press any key to exit...&quot;);<br\/> <br\/>   getch();<br\/>   closegraph();<br\/>   return 0;<br\/>}<\/code><\/pre> <\/div>\n<p>Download <a title=\"Traffic Light Simulation\" href=\"http:\/\/www.programmingsimplified.com\/toolsArea\/executable\/Traffic%20Light%20Simulation.EXE\" target=\"_blank\" rel=\"noopener\">Traffic Light Simulation<\/a>.<\/p>\n[ad type=&#8221;banner&#8221;]\n","protected":false},"excerpt":{"rendered":"<p>traffic light program in c, traffic light simulation &#8211; c programming -This program in c presents what happens in our daily life at traffic light signals.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82927,1],"tags":[83302,83305,83307,83308,83311,83304,83306,83310,83309,83303],"class_list":["post-24866","post","type-post","status-publish","format-standard","hentry","category-c-programming-2","category-coding","tag-c-program-for-traffic-light-control","tag-c-code-for-traffic-light-simulation","tag-computer-graphics-program-for-traffic-signal","tag-embedded-c-program-for-traffic-light","tag-program-for-traffic-light-controller-using-8051","tag-simple-c-program-for-traffic-light-control","tag-source-code-for-traffic-light-controller-in-c","tag-traffic-light-program-in-c-for-8051","tag-traffic-light-simulation-program-in-c","tag-traffic-light-system-project-in-c"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/24866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=24866"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/24866\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=24866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=24866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=24866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}