classes and vectors

Okay, so I'm having a bit of a problem... I'm trying to open a .txt file, if it opens, send the string to my class to open and read the data in to a vector. I'm getting some weird errors though. I took out my constructors to see what it would do and it reduced some of the errors. However, I'm still getting errors like: "C++ forbids declaration of `vector' with no type" from my private variables.

Any thoughts? I'm attaching my header file...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class rainFall
{
private:
	vector <float> actRain;
	vector <float> avgRain;
	vector <float> difference;
	string file;
public:
	//void rainFall();
	//void rainFall(ifstream);
	void currentYear(string, float& avgRain);
	void averageYear(string, float& avgRain);
	void rainFallTable(vector <float>& actRain, vector <float>&, avgRain, vector <float>& difference);
	void mostRainFall(vector <float>& actRain);
};	
Last edited on
Are you sure you're using namespace std, and including <vector> in your code?
For what concerns your constructors, you have to remove the void type before them.
On line 13 I can see an extra comma before avgRain
Topic archived. No new replies allowed.