Cannot seem to make code display lines

Hi! I'm trying to write a code that displays lines between user designated points with circles at each point, but I can't get the lines to display! I'm at a loss on what to do and need fresh eyes on the subject.



#include <iostream>
#include "graph1.h"

using namespace std;

//Function Prototypes Follow
void getNoPoints(int* no_points);
void getPoints(int* x, int* y,int no_points);
void drawPolyLine(int* x, int* y, int no_points,int objects[]);

int main()
{
//Variable Declaration/Initialization

int no_points = 0;
const int MAX_POINTS = 10;
int x[MAX_POINTS];
int y[MAX_POINTS];
int no_circles = 0;
int objects[MAX_POINTS];

//Display Graphics Window
displayGraphics();

//Get the number of points (pass the address of no_points )
getNoPoints(&no_points);

//Get the data for the points
getPoints(x,y,no_points);

//Draw the polyline
drawPolyLine(x,y,no_points,objects);

return 0;
}

//Function Implementation Follows
void getNoPoints(int* no_points)
{
cout<<"Enter # of points: ";
cin>>*no_points;
}
void getPoints(int* x, int* y,int no_points)
{
//Variable Declaration/Initiliation
int i=0;

for(i=0;i<no_points;i++)
{
cout<<"Enter x/y coord for point #"<<(i+1)<<": ";
cin>>x[i]>>y[i];
}
}

void drawPolyLine(int* x, int* y, int no_points,int objects[])
{
int i=0;

for (i = 0; i < no_points;)
{
objects[i] = drawLine(x[i],y[i],x[++i],y[++i],1);
setColor(objects[i],255,255,0);
}

//Display each circle

for (i = 0; i < no_points; i++)
{
objects[i] = drawCircle(5,x[i],y[i]);
setColor(objects[i],255,0,0);
}
}






I imagine the error is in this segment:

int i=0;

for (i = 0; i < no_points;)
{
objects[i] = drawLine(x[i],y[i],x[++i],y[++i],1);
setColor(objects[i],255,255,0);
}
Hi,

Please don't do multiple posts about the same topic, just keep the original one going. It can be annoying to do a reply for one post, only to discover the same things are being said in the other one.
Topic archived. No new replies allowed.