Hello, I'm new to programming and I have a simple project to plot a graph using gwin. The graph should just be a series of circles curving upwards on the y axis, the amount of plots should be defined by the user. I think I have everything almost correct but just can't find a few simple errors. any help would be much appreciated.

Sorry just read the forum guidelines and realise my post is riddled with annoyances!

#include "stdafx.h"
#include "gwin.h"

#include <iostream>
using namespace std;

// function declaration
double cube (double x);

int main ()
{

	// declare variables
	int count = 0;
	double height = Gwin.getHeight(); // establish maximum width
	double width = Gwin.getWidth(); // establish max height
	double scalex;
	double scaley;
	double maxvalue; // number of plots on graph
	double out_val;
	bool finish = false;

	Gwin.clear();

	Gwin.writeText(" How many points would you like to plot on the graph?");

	maxvalue = Gwin.getInt();

	scalex = double(width)/double(maxvalue);
	scaley = double(height)/ double(maxvalue);


	while (!finish)
	{
		if (int(count)==maxvalue)
		
		{
			finish = true;
		}
	
		else
		{
	
		out_val = cube(count);

		Gwin.circle ((scalex*count),(height-(scaley*cube(maxvalue))), 5);
		}
	}

	count = count+1;

	Keyboard.getch();


	return 0;


}

double cube (double x)
{
 return x*x*x;
}

cheers guys

I have now added a fill colour command before the draw circle command, thought this might solve my problem but it hasn't. the program is also freezing and I can only exit it using task manager.

> count = count+1;

Maybe put this inside the loop/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.