Hi all, im new to this programming language and i tried to use my Xcode to build and run this code but i got a error :(, and another error is
i need a help guys - #include <GLUT/glut.h>
-
#include <stdlib.h>
-
#include <math.h>
-
-
const GLdouble twoPi =6.283185;
-
-
class scrPt {
-
public:
-
GLint x, y;
-
};
-
-
GLsizei winWidth = 400, winHeight =300;
-
-
void init (void)
-
{
-
glClearColor (1.0,1.0,1.0,1.0);
-
-
glMatrixMode (GL_PROJECTION);
-
gluOrtho2D (0.0,200.0,0.0,150.0);
-
}
-
. >>>>> the error is here (error: expected unqualified-id before '.' token)
-
.
-
.// Midpoint routines for displaying a circle
-
-
void pieChart (void)
-
{
-
scrPt circCtr, piePt;
-
GLint radius = winWidth/4;
-
-
GLdouble sliceAngle, previosSliceAngle = 0.0;
-
-
GLint k, nSlices = 12;
-
GLfloat dataValues[12] = {10.0,7.0,13.0,5.0,13.0,14.0,3.0,16.0,5.0,3.0,17.0,8.0};
-
GLfloat dataSum =0.0;
-
-
circCtr.x = winWidth/2;
-
circCtr.y =winHeight / 2;
-
circleMidpoint (circCtr, radius);
-
-
for (k =0; k< nSlices; k++)
-
dataSum += dataValues[k];
-
-
for (k =0; k< nSlices; k++) {
-
sliceAngle =twoPi * dataValues[k]/ dataSum + previousSliceAngle;
-
piePt.x = circCtr.x + radius *cos (sliceAngle);
-
piePt.y = circCtr.y + radius *sin (sliceAngle);
-
glBegin (GL_LINES);
-
glVertex2i(circCtr.x, circCtr.y);
-
glVertex2i(piePt.x, piePt.y);
-
glEnd ();
-
previousSliceAngle = sliceAngle;
-
}
-
}
-
-
-
void displayFcn (void)
-
{
-
glClear (GL_COLOR_BUFFER_BIT);
-
glColor3f (0.0,0.0,1.0);
-
pieChart (); >>>>>>>>>>>>>>>>( error: 'pieChart' was not declared in this scope )
-
glFlush ();
-
}
-
void winReshapeFcn (GLint newWidth, GLint newHeight)
-
{
-
glMatrixMode (GL_PROJECTION);
-
glLoadIdentity ();
-
gluOrtho2D (0.0, GLdouble (newWidth), 0.0, GLdouble (newHeight));
-
-
glClear (GL_COLOR_BUFFER_BIT);
-
-
/* Reset diaply-window size parameters. */
-
winWidth = newWidth;
-
winHeight = newHeight;
-
-
}
-
-
int main (int argc, char** argv)
-
{
-
glutInit (&argc, argv);
-
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
-
glutInitWindowPosition (100,100);
-
glutInitWindowSize (winWidth,winHeight);
-
glutCreateWindow ("Pie Chart");
-
-
init();
-
glutDisplayFunc (displayFcn);
-
glutReshapeFunc (winReshapeFcn);
-
-
glutMainLoop ();
-
-
}
12 18294
. >>>>> the error is here (error: expected unqualified-id before '.' token)
.
.//
All these three dots (before '>>>', on the next line , and before '//'), are they in the code? Why are they there?
yes they are in the code ... its refer to the Midpoint routines for displaying a circle.
donbock 2,426
Recognized Expert Top Contributor
Those periods don't look like legal C syntax. What do you expect them to do?
Midpoint routines for displaying a circle
Banfa 9,065
Recognized Expert Moderator Expert
Have you tried just removing lines 21,22 and 23 and compiling the code?
Banfa : yes i tried but its end up with error and when i correct the error my output is a pie chart without a circle :)
donbock 2,426
Recognized Expert Top Contributor @sam23
Your source code snippet consists of - Include some header files (lines 1-3)
- Define a global variable (line 5)
- Define class scrPt (line 7)
- Define two more global variables (line12)
- Function init (lines 14-20)
- Three periods and a comment (lines 21-23)
- Function pieChart (lines 25-53)
- Function displayFcn (lines 56-62)
- Function winReshapeFcn (lines 63-75)
- Function main (lines 77-end)
Why do you so adamantly believe that the compiler interprets three periods as the instructions for inserting midpoint routines for displaying a circle?
Much more likely is that these periods were meant to be interpreted as an ellipsis in whatever source you cut and pasted this code from. That is, they indicate that a block of code (not needed to make the point) was omitted.
donbock 2,426
Recognized Expert Top Contributor @sam23
At line 38, pieChart calls function circleMidpoint -- passing it the center and radius. You don't have a circleMidpoint function. You will need to write it.
donbock : i really dont understand :(
My lecturer just gave this coding and ask us to try to run it..
I dont have idea how to write fucntion for this circle Midpoint !
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: matt hegarty |
last post by:
Hi
I am relatively new to XML, but am having problems with a validation
issue.
When the XML is parsed and validated using Xerces, the following error
is seen:
cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is
not allowed to appear in element 'questionFeed'.
|
by: Ange T |
last post by:
Hi there,
I'm having pain with the VB behind an Access form. The form is used to
create reports in Excel based on the details entered in the form. This
has always worked without error on my machine (NT4, Access 2k),
however as soon as I attempt to create anything on another machine
(NT4, Access 2k) which most users will be working from, I receive an
automation error.
The problem line with the code is:
|
by: mavis |
last post by:
Unqualified element in XSD definition
For some reason, we may need to define elements in XSD to be
"unqualified".
According to the design patterns of XSD, it seems they do not recommend
to define elements in this way....it seems it will influence XPATH /
XSLT, etc...
|
by: Igor Koretsky |
last post by:
Hi.
Using VB.Net System.Xml 1.0
SchemaCollection Object
I am getting an error when trying to add
‘Schema A’ to the SchemaCollection.
Here are my schema files..
|
by: subramanian |
last post by:
Hello.
Consider the following code fragment :
enum TestEnum { val1 = 10, val2 = 100, val3 = 1000 };
class Test {
public :
enum TestEnum { val1 = 1, val2 val3 };
Test(int i = 0, int j = 0, TestEnum val = TestEnum(0));
...
| |
by: Mark Olbert |
last post by:
I'm trying to serialize (using XmlSerializer.Serialize) a class that I generated from an XSD schema using XSD.EXE /c.
The problem I'm running into is that the root element needs to be unqualified, and the default namespace needs to be included on it
as an attribute. The schema I'm using is this:
<xs:schema
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:html="http://www.w3.org/TR/REC-html40"...
|
by: =?Utf-8?B?a3Jpc2huYQ==?= |
last post by:
Hi i am getting the following error while using XMLSerializer
XmlSerializer ser = new XmlSerializer(typeof(Person));
ERROR:
Unable to generate a temporary class (result=1).
error CS0266: Cannot implicitly convert type 'XSD.BiodataGender?' to
'XSD.BiodataRace?'. An explicit conversion exists (are you missing a cast?)
I am getting the above error when my xsd has multiple nillable elements of
userdefined type. If I change the type of...
|
by: mharrison |
last post by:
Hi All,
I'm using SQL 2000 and in a DTS I want to load in an error XML file to a SQL table.
I am using the SQLXMLBulkLoad component in an Active X script.
I have an XML file. see below, and also an XSD schema file. Could someone take a look and see where I am going wrong??!
I get an error from SQL stating "Relationship expected on errors"
|
by: Stef Mientki |
last post by:
hello,
I've syntax error which I totally don't understand:
########## mainfile :
import test_upframe2
if __name__ == '__main__':
var1 = 33
code = 'print var1 + 3 \n'
|
by: Terry Reedy |
last post by:
Stef Mientki wrote:
Indendation is screwed. Is the above all do_more body?
Which locals does this get you? __init__'s? (locals()?)
Isn't this just the same as globals()?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |