Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Have been working on this code for awhile and cant get it to work with Glut. Wondering if there is anything I can fix #include

image text in transcribed

image text in transcribed

Have been working on this code for awhile and cant get it to work with Glut. Wondering if there is anything I can fix

#include #include "graph1.h"

using namespace std;

//Add Function Prototypes Here int getNoPoints(); void getPoints(int x[], int y[], int no_points); void drawPolyLine(int x[], int y[], int no_points);

int main() { //Variable Declaration/Initialization int no_points = 0; const int MAX_POINTS = 10; int x[MAX_POINTS]; int y[MAX_POINTS];

//Display Graphics Window displayGraphics();

//Prompt for the number of points no_points = getNoPoints();

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

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

return 0; }

//Function Stubs Follows int getNoPoints() { //Declare local variables int no_points = 0; //Prompt for the number of points cout > no_points; //Return the number of points return 0; }

void getPoints(int x[], int y[], int no_points) { //Declare local variables

//Using a for-loop, prompt for the coordinates of each point and store in arrays x and y for (int i = 0; i > x[i] >> y[i]; } }

void drawPolyLine(int x[], int y[], int no_points) { //Declare local variables int circle; int line; int drawCircle(int radius, int center_x, int center_y); int drawLine(int x1, int y1, int x2, int y2, int width);

//Use 1 for-loop for drawing the red circle on each point for (int p = 0; p

//Use a second for-loop for drawing the lines - remember there is always one less line than there are points! for (int w = 0; w Write a C++ program that draws a polyline. A polyline is defined as: A series of conected line segments that are treated as a single object A polyline has the following properties: 1. The number of points are one greater the number of line segments 2. Each point is also an endpoint of a segment. This program will prompt the user for the following data: 1. Prompt the user for the number of points the polyline contains. 2. Prompts the user for the x/y coordinates for the each point Example for the data input prompts are shown below: Enter # of points: 6 Enter x/y coord for Point #1: 10 25 Enter x/y coord for Point #2: 50 65 Enter x/y coord for Point #3: 100 175 Enter x/y coord for Point #4: 200 235 Enter x/y coord for Point #5: 300 275 Enter x/y coord for Point #6: 450 395 Your program will store the x/y coordinates in parallel arrays and then draw a red circle (radius of 5) centered on each point. Your program will then draw a yellow line between each point. An example of each point is shown below: C++ Graphics

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+1. How does or how might the key public affect your organization?

Answered: 1 week ago