15,902,939 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 11801907 (Top 13 by date)
Member 11801907
30-Jun-15 4:40am
View
sir, cant you just tell me what to add in this program? please. I would appreciate that.
Member 11801907
30-Jun-15 4:33am
View
I don't get it. :(
Member 11801907
30-Jun-15 4:10am
View
please check the question again. and tell me how to calculate polygons area and permieter?
Member 11801907
30-Jun-15 4:06am
View
Deleted
# include <iostream.h>
# include <graphics.h>
# include <conio.h>
# include <math.h>
void show_screen( );
void Polygon(const int,const int []);
void Line(const int,const int,const int,const int);
int main( )
{
int driver=VGA;
int mode=VGAHI;
int n=0;
do
{
show_screen( );
gotoxy(12,13);
cout<<"Enter the number of points : ";
cin>>n;
int *coordinates=new int[(n*2)];
for(int count=0;count<n;count++)
{
="" gotoxy(8,18);
="" cout<<"coordinates="" of="" point-"<<(count+1)<<"="" (x"<<(count+1)<<",y"<<(count+1)<<")="" :";
="" gotoxy(12,21);
="" cout<<"enter="" the="" value="" x"<<(count+1)<<"=";
cin>>coordinates[(count*2)];
gotoxy(12,22);
cout<<" enter="" y"<<(count+1)<<"=";
cin>>coordinates[((count*2)+1)];
gotoxy(8,18);
cout<<" ";
="" cout<<"="" gotoxy(12,22);
="" ";
="" }
="" initgraph(&driver,&mode,"c:\\tc\\bgi");
="" setcolor(15);
="" polygon(n,coordinates);
="" delete="" coordinates;
="" outtextxy(110,460,"press="" <enter=""> to continue or any other key to exit.");
int key=int(getch( ));
if(key!=13)
break;
}
while(1);
return 0;
}
void Polygon(const int n,const int coordinates[])
{
if(n>=2)
{
Line(coordinates[0],coordinates[1],
coordinates[2],coordinates[3]);
for(int count=1;count<(n-1);count++)
Line(coordinates[(count*2)],coordinates[((count*2)+1)],
coordinates[((count+1)*2)],
coordinates[(((count+1)*2)+1)]);
}
}
void Line(const int x_1,const int y_1,const int x_2,const int y_2)
{
int color=getcolor( );
int x1=x_1;
int y1=y_1;
int x2=x_2;
int y2=y_2;
if(x_1>x_2)
{
x1=x_2;
y1=y_2;
x2=x_1;
y2=y_1;
}
int dx=abs(x2-x1);
int dy=abs(y2-y1);
int inc_dec=((y2>=y1)?1:-1);
if(dx>dy)
{
int two_dy=(2*dy);
int two_dy_dx=(2*(dy-dx));
int p=((2*dy)-dx);
int x=x1;
int y=y1;
putpixel(x,y,color);
while(x
Member 11801907
30-Jun-15 4:06am
View
Deleted
void show_screen( );
void Polygon(const int,const int []);
void Line(const int,const int,const int,const int);
int main( )
{
int driver=VGA;
int mode=VGAHI;
int n=0;
do
{
show_screen( );
gotoxy(12,13);
cout<<"Enter the number of points : ";
cin>>n;
int *coordinates=new int[(n*2)];
for(int count=0;count<n;count++)
{
="" gotoxy(8,18);
="" cout<<"coordinates="" of="" point-"<<(count+1)<<"="" (x"<<(count+1)<<",y"<<(count+1)<<")="" :";
="" gotoxy(12,21);
="" cout<<"enter="" the="" value="" x"<<(count+1)<<"=";
cin>>coordinates[(count*2)];
gotoxy(12,22);
cout<<" enter="" y"<<(count+1)<<"=";
cin>>coordinates[((count*2)+1)];
gotoxy(8,18);
cout<<" ";
="" cout<<"="" gotoxy(12,22);
="" }
="" initgraph(&driver,&mode,"c:\\tc\\bgi");
setcolor(15);
="" polygon(n,coordinates);
="" delete="" coordinates;
="" setcolor(15);
="" outtextxy(110,460,"press="" <enter=""> to continue or any other key to exit.");
int key=int(getch( ));
if(key!=13)
break;
}
while(1);
return 0;
}
void Polygon(const int n,const int coordinates[])
{
if(n>=2)
{
Line(coordinates[0],coordinates[1],
coordinates[2],coordinates[3]);
for(int count=1;count<(n-1);count++)
Line(coordinates[(count*2)],coordinates[((count*2)+1)],
coordinates[((count+1)*2)],
coordinates[(((count+1)*2)+1)]);
}
}
void Line(const int x_1,const int y_1,const int x_2,const int y_2)
{
int color=getcolor( );
int x1=x_1;
int y1=y_1;
int x2=x_2;
int y2=y_2;
if(x_1>x_2)
{
x1=x_2;
y1=y_2;
x2=x_1;
y2=y_1;
}
int dx=abs(x2-x1);
int dy=abs(y2-y1);
int inc_dec=((y2>=y1)?1:-1);
if(dx>dy)
{
int two_dy=(2*dy);
int two_dy_dx=(2*(dy-dx));
int p=((2*dy)-dx);
int x=x1;
int y=y1;
putpixel(x,y,color);
while(x
Member 11801907
30-Jun-15 4:04am
View
Deleted
# include <iostream.h>
# include <graphics.h>
# include <conio.h>
# include <math.h>
void show_screen( );
void Polygon(const int,const int []);
void Line(const int,const int,const int,const int);
int main( )
{
int driver=VGA;
int mode=VGAHI;
int n=0;
do
{
show_screen( );
gotoxy(12,13);
cout<<"Enter the number of points : ";
cin>>n;
int *coordinates=new int[(n*2)];
for(int count=0;count<n;count++)
{
="" gotoxy(8,18);
="" cout<<"coordinates="" of="" point-"<<(count+1)<<"="" (x"<<(count+1)<<",y"<<(count+1)<<")="" :";
="" gotoxy(12,21);
="" cout<<"enter="" the="" value="" x"<<(count+1)<<"=";
cin>>coordinates[(count*2)];
gotoxy(12,22);
cout<<" enter="" y"<<(count+1)<<"=";
cin>>coordinates[((count*2)+1)];
gotoxy(8,18);
cout<<" ";
="" cout<<"="" gotoxy(12,22);
="" ";
="" }
="" initgraph(&driver,&mode,"c:\\tc\\bgi");
="" setcolor(15);
="" polygon(n,coordinates);
="" delete="" coordinates;
="" outtextxy(110,460,"press="" <enter=""> to continue or any other key to exit.");
int key=int(getch( ));
if(key!=13)
break;
}
while(1);
return 0;
}
void Polygon(const int n,const int coordinates[])
{
if(n>=2)
{
Line(coordinates[0],coordinates[1],
coordinates[2],coordinates[3]);
for(int count=1;count<(n-1);count++)
Line(coordinates[(count*2)],coordinates[((count*2)+1)],
coordinates[((count+1)*2)],
coordinates[(((count+1)*2)+1)]);
}
}
void Line(const int x_1,const int y_1,const int x_2,const int y_2)
{
int color=getcolor( );
int x1=x_1;
int y1=y_1;
int x2=x_2;
int y2=y_2;
if(x_1>x_2)
{
x1=x_2;
y1=y_2;
x2=x_1;
y2=y_1;
}
int dx=abs(x2-x1);
int dy=abs(y2-y1);
int inc_dec=((y2>=y1)?1:-1);
if(dx>dy)
{
int two_dy=(2*dy);
int two_dy_dx=(2*(dy-dx));
int p=((2*dy)-dx);
int x=x1;
int y=y1;
putpixel(x,y,color);
while(x
Member 11801907
30-Jun-15 3:09am
View
and what if I ask for input from user? what's that "101"?
Member 11801907
30-Jun-15 2:51am
View
#include <graphics.h>
#include <conio.h>
main()
{
int gd=DETECT,gm,points[]={320,150,420,300,250,300,320,150};
initgraph(&gd, &gm, "C:\\TC\\BGI");
drawpoly(4, points);
getch();
closegraph();
return 0;
}
Member 11801907
30-Jun-15 2:48am
View
Sir, we aren't that rich to buy new computers and run these new compilers etc.
Member 11801907
30-Jun-15 2:42am
View
Cause we haven't moved to vb yet.
Member 11801907
30-Jun-15 2:39am
View
#include <graphics.h>
#include <conio.h>
main()
{
int gd=DETECT,gm,points[]={320,150,420,300,250,300,320,150};
initgraph(&gd, &gm, "C:\\TC\\BGI");
drawpoly(4, points);
getch();
closegraph();
return 0;
}
I did this. But I need to do that x1, x2, y1, y2 thing to use polygons formula. give me some hint.
Member 11801907
30-Jun-15 2:26am
View
I have to do it in turbo c.
It's too difficult.
Member 11801907
30-Jun-15 2:25am
View
but atleast give me some hints. :|
Show More