I am writing a really basic program to mimick Sets using linked lists. I just made a small main() to test each of my template functions as I write them. The problem is my main is behaving very oddly and just hanging at certain points everytime I change the code. It wasn't a problem before as I somehow fixed it by putting in cout statements to follow what my code was doing to try and find the hang. After I did this the code would actually run through everything then just hang at the end. Now though no matter what I do I cannot get my code past the line cout<<"3\n"; here it is:
main.cc
Code:
#include "set.h"
#include <iostream>
using namespace std;
int main(void)
{
Set <char> newSet;
newSet.insert('a');
newSet.insert('b');
newSet.insert('c');
newSet.insert('d');
newSet.insert('e');
cout<<"1\n";
Set <char> setTwo(newSet);
cout<<"2\n";
setTwo.output();
cout<<"3\n";
cout<<"Is 'z' in newSet? ";
if(newSet.is_element('z'))
cout<<"yes\n";
else
cout<<"no\n";
return (0);
}
I'm fairly convinced this has little to with anything outside the main itself since is it hanging in between 2 cout statements where none of my actual functions are being used.
I ran this code as well and it just does nothing, when i run it it just sits with a blinking cursor, wont take any commands or display anything or ever stop running. The only way to stop it is to close my ssh connection. BTW this is being compiled on a solaris system, when trying to compile on my windows system dev-cpp gives - [Build Error] [Project6.exe] Error 1. In the file Makefile.win.
main.cc
Code:
#include "set.h"
#include <iostream>
using namespace std;
int main(void)
{
Set <char> newSet;
newSet.insert('a');
newSet.insert('b');
newSet.insert('c');
newSet.insert('d');
newSet.insert('e');
cout<<"Is 'z' in newSet? ";
if(newSet.is_element('z'))
cout<<"yes\n";
else
cout<<"no\n";
return (0);
}
It is using 4 files total these are:
node.h - used in many other projects so im fairly confident in it
set.h - header file for the set template class (attached)
set.template - template file for set.h (attached as .txt)
main.cc - where all the problems are
please any help would be great!!