Add to Favorites    Make Home Page 254 Online

 Language Categories
 Source Codes Home Project Ideas New! Interview Questions FAQs Home ASP Home ASP Source Codes ASP Script Directory New! ASP .Net Script Directory New! ASP Interview Questions ASP FAQs ASP How Tos C Home C Source Codes C Script Directory New! C Interview Questions C FAQs C How Tos C++ Home C++ Source Codes C++ Script Directory New! C++ Interview Questions C++ FAQs C++ How Tos Java Home Java Source Codes Java Directory New! Java Interview Questions Java FAQs Java How Tos JavaScript Home JavaScript Directory New! JavaScript Source Codes JavaScript FAQs JavaScript How Tos COBOL Home COBOL Source Codes COBOL FAQs COBOL How Tos Pascal Home Pascal Source Codes Pascal FAQs Pascal How Tos PHP Script Directory New! Python Script Directory New! Perl & CGI Script Directory New! Flash Script Directory New! CFML Script Directory New! Remotely Hosted Scripts New! Tools & Utilities Directory New! XML Script Directory New! Best Programmers Amit Mathur Vishal Bhardwaj Deepesh Jain Vyom NetWork
 Our Services

Home » C++ Home » Computer Graphics Home » Program to implement Bresenham's Circle Drawing Algorithm.

A D V E R T I S E M E N T

Search Projects & Source Codes:

 Title Program to implement Bresenham's Circle Drawing Algorithm. Description Category C++ » Computer Graphics Hits 35307 Code Select and Copy the Code #include #include #include #include #include #include #include class myCircle { private: int x,y,r,d,x1,y1; public: myCircle(); //Constructor void showCircle(); }; myCircle::myCircle() { x=0;y=0; cout<<" "Enter The Co-Ordinates Of The Circle ":="; cin>>x>>y; cout<<" "Enter The Radius Of The Circle ":="; cin>>r; } void myCircle::showCircle() { char *s; x1=0;y1=r; d=3-2*r; while(x1<=y1) { putpixel((x+x1+320),(y+y1+240),5); putpixel((x-x1+320),(y+y1+240),5); putpixel((x+x1+320),(y-y1+240),5); putpixel((x-x1+320),(y-y1+240),5); putpixel((x+y1+320),(y+x1+240),5); putpixel((x-y1+320),(y+x1+240),5); putpixel((x+y1+320),(y-x1+240),5); putpixel((x-y1+320),(y-x1+240),5); if(d<0) d+=4*x1+6; else { d+=4*(x1-y1)+10; y1--; } x1++; } setcolor(5); outtextxy(318+x,235+y,"."); setcolor(15); sprintf(s,"Center(%d,%d)",x,y); outtextxy(20,10,"The Center Is At"); outtextxy(20,20,s); sprintf(s,"Radius=%d",r); outtextxy(20,30,s); getch(); } void main() { int gd=DETECT,gm,i,j,xx=190,xxx=480; clrscr(); myCircle a; char *mess[]={"B","R","E","S","E","N","H","A","M","'","S"," ","C","I","R","C","L","E"," ","A","L","G","O","R","I","T","H","M"}; initgraph(&gd,&gm,"..\bgi"); cleardevice(); rectangle(120,40,320,240); rectangle(320,40,520,240); rectangle(120,240,320,440); rectangle(320,240,520,440); for(i=0,j=27;i<16,j>=14;i++,j--) { xx+=10; outtextxy(xx,10,mess[i]); xxx-=10; outtextxy(xxx,10,mess[j]); delay(100); } for(i=130;i<=510;i+=10) for(j=50;j<=430;j+=10) putpixel(i,j,15); for(i=130;i<=510;i+=10) { if(i==320) continue; outtextxy(i,237,"+"); } for(i=50;i<=430;i+=10) { if(i==240) continue; outtextxy(317,i,"-"); } outtextxy(310,230,"O"); outtextxy(530,240,"X"); outtextxy(320,450,"-Y"); outtextxy(100,240,"-X"); outtextxy(320,30,"Y"); a.showCircle(); // closegraph(); }

Related Source Codes

 Script Name Author Moving ball screen saver karlmarx The Classic Game of Snake & Ladder Lakshmi Narayana .A Railway seat reservation question which comes in sapient VyomWorld To calculate percentile Ravi Mathur Send to folder ANIMESH SAHU Analog clock and calendar Nazia & Rida HIGH/LOW GAME MOLLY ARORA Data structure (stack Implimentation) Swapnil B Adsure Memory Game AnirudhSanyal Easy Calc Anirudh Sanyal GK Quiz Anirudh Sanyal Hangman Game Manish Jain Snakeman Manish Jain Full month Calendar Nigi Cursor shapes nigi

A D V E R T I S E M E N T

Subscribe to SourceCodesWorld - Techies Talk
Email:

 Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home