troubleshooting Question

making set code for c++

Avatar of jiwonman
jiwonman asked on
5 Comments1 Solution311 ViewsLast Modified:
Error      1      error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup      MSVCRTD.lib      

Error      2      fatal error LNK1120: 1 unresolved externals      C:\Documents and Settings\kjchung\My Documents\Visual Studio 2005\Projects\Project\Debug\Project.exe      1      

I get this two errors.. I am working for making a set code.

compiler used : vs 2005
#include <iostream>
class Element
	Element *next;
	int data;
	Element(Element *n, int d) : next(n),data(d){}
	~Element() { delete next;}
class Set
	Set() : first(0) {};
	Set(const Set& m);
	~Set() {delete first;}
	Set operator+ (const Set& m) const; //union
	Set operator^ (const Set& m) const; //intersect
	bool empty() const;
	bool member(int d) const;
	Element *first;
	Set(Element *p) : first(p) {};
void add(Element *& p, int d)
	if(!p || d< p-> data)
		 p= new Element(p,d);
	else if(p->data !=d)
void remove(Element *& p, int d)
	if(p &&p->data==d)
		Element *q=p;
		q->next = 0;
		delete q;
	else if(p && p->data <d)
Element *intersect(Element *p1, Element *p2)
	if(!p1 || !p2)
		return 0;
	else if (p1-> data == p2 -> data)
		return new Element(intersect(p1->next,p2->next),p1->data);
	else if (p1->data < p2->data)
		return intersect(p1->next,p2);
		return intersect(p1,p2->next);
Element *uni(Element *p1, Element *p2)
	if(!p1 && !p2)
		return 0;
		if(!p2 || (p1 && p1 ->data < p2->data))
			return new Element(uni(p1->next,p2),p1->data);
		else if(!p1 || (p2 && p2-> data < p1-> data))
			return new Element(uni(p1,p2->next), p2->data);
			return new Element(uni(p1->next,p2->next), p1->data);
Set Set::operator+ (const Set&m) const
	return Set(uni(first,m.first));
Set Set::operator^ (const Set& m) const
	return Set(intersect(first,m.first));
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros