Hello everyone, I'm currently having some problems with this code. I am getting many compiling errors and i was wondering if you guys could help get rid of them.

#pragma once
#define CAPACITY 128;
typedef int QueueElement;

class Queue
{
public:
	Queue();
	int empty();
	void enqueue(const QueueElement & value);
	void display();
	QueueElement front();
	void dequeue();
private:
	int myfront, myback, count;
	QueueElement myArray[CAPACITY];
};

The QueueElement myArray[CAPACITY]; part gives me these errors:
1>c:\documents and settings\damian sanchez\my documents\visual studio 2005\projects\queue(3)\queue(3)\Queue.h(16) : error C2143: syntax error : missing ')' before ';'
1>c:\documents and settings\damian sanchez\my documents\visual studio 2005\projects\queue(3)\queue(3)\Queue.h(16) : error C2143: syntax error : missing ']' before ')'
1>c:\documents and settings\damian sanchez\my documents\visual studio 2005\projects\queue(3)\queue(3)\Queue.h(16) : error C2143: syntax error : missing ';' before ')'
1>c:\documents and settings\damian sanchez\my documents\visual studio 2005\projects\queue(3)\queue(3)\Queue.h(16) : error C2059: syntax error : ')'
1>c:\documents and settings\damian sanchez\my documents\visual studio 2005\projects\queue(3)\queue(3)\Queue.h(16) : error C2059: syntax error : ']'
1>c:\documents and settings\damian sanchez\my documents\visual studio 2005\projects\queue(3)\queue(3)\Queue.h(16) : error C2238: unexpected token(s) preceding ';'

void Queue::display()
{
	for(int i=myfront ; i !=myback ; i=(i++)%CAPACITY)
	{
		cout<<myArray[i]<<"";
	}
cout<<endl;
}

Also, this part above, the for loop gives me this error:

1>.\queue.cpp(33) : error C2059: syntax error : ';'

Thank you in advance for helping me.

Recommended Answers

All 2 Replies

thank you that fixed the errors, but now theres a new compiler error :
1>LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Documents and Settings\Damian Sanchez\My Documents\Visual Studio 2005\Projects\queue(3)\Debug\queue(3).exe : fatal error LNK1120: 1 unresolved externals

I already tried changing the subsystem to console and to window, but these errors still persist. Is there some way to get rid of them?

EDIT: Nevermind, i figured out why I kept getting this error, turns out it was because I had not written the queue_driver for the program yet.

Thank you for answering my question, you certainly made my life easier.

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.