I'm just getting started, but I'm already having trouble. So far, my code is simply:
(In Searcher.h)
#ifndef SEARCHER_H
#define SEARCHER_H
#include <string>
#include <list>
using namespace std;
class Searcher{
public:
Searcher( int& x );
~Searcher();
private:
int size;
list<string> * lists;
};
#endif
(In Searcher.cpp)
#include "Searcher.h"
Searcher::Searcher (int& x){
lists = new list<string>[x];
}
(In testSearcher.cpp)
#include "Searcher.h"
#include <iostream>
using namespace std;
int main (){
Searcher * x = new Searcher(211);
}
It compiles, but when I run it, it gives a floating point exception. I even replaced x with 211 to no avail. Thank you in advance for any help. Also, to amateur debug it, I put a cout statement in the constructor before the initialization and it printed fine, then g++ gave me the floating point exception.