Missing Type specifier

I get an error saying I missed a type specifier, but didn't I already declare the type earlier in my code?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "Project2.h"
#include <string>
#include <iostream>

void weatherSummary ( string inputfile, string outputfile )
{
	ifstream in(inputfile); // read the data from the input file
	ofstream out(outputfile); // send my data to an output text file

	string name;
	double latitude;
	double longitude;
	double elevation;
	int TPCP;
	int MNTM;
	
	int counter=0;
	int lastStation=0;
	int currentStation=0;
	
	in.ignore(5000, '\n'); //ignore the header
	
	out << left << setw(18) << "STATION_NAME" << setw(18) << "ELEVATION" << setw(18) << " LATITUDE" << setw(18) << "LONGITUDE" << setw(18) << "TPCP" << setw(18) << "MNTM" << endl;
				
	readData( in, name, elevation, latitude, longitude, TPCP, MNTM );
	 
	 
	 while( !in.fail() )
	{
		if ( MNTM == -9999)
			
		{
				MNTM = 0;
		}
			
		if ( lastStation == currentStation )
		{
			counter += 1; // add 1 to the counter since same weather station 
			
		}
		else
		{
			counter = 0; //not same station, don't add to counter
			
		}
		
		if ( counter == 12 )
		{
			out << left << name << setw(18) << elevation << setw(18) << latitude <<setw(18) << longitude << setw(18)<< TPCP << setw(18)<< MNTM << endl;
			
		}
		
		else (counter < 12 )
		{	
			 
			out << "too few readings" << endl;
			
		}
	}
		
		out << left << name << setw(18) << elevation << setw(18) << latitude <<setw(18) << longitude << setw(18)<< TPCP << setw(18)<< MNTM << endl;
		in >> name >> elevation >> latitude >> longitude >> TPCP >> MNTM ;
		

	}
	




void readData(ifstream& in, string &name, double &elevation, double &latitude, 
	double &longitude, int &TPCP, int &MNTM )
{
	string junk;
	getline( in, junk, ',' );//read from in, store in junk and stop
	//at the comma - and get rid of the comma in the process
	
	getline( in, name, ',' );
	in >> elevation;
	in.get();
	in >> latitude;
	in.get();	
	in >> longitude;
	in.get();
	in.ignore( 5000, ',' );//ignore the date line 
	in >> TPCP; //read the TPCP data 
	in.get();
	in.ignore(5000, ',');//ignore the missing line
	in.ignore(5000, ',');//ignore the consecutive line
	in >> MNTM;//get the data for temperature
	in.ignore (5000, '\n' );// ignore the rest of the line and end that line


}

int main ()
{
	weatherSummary( "US_partial.txt", "output.txt");
	
	
	return 0;
	
}.
Here is my header file as well

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <fstream>
#include <iostream>
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>

double latitude;
double longitude;
double elevation;
int TPCP;
int MNTM;

using std::string;
using std::ifstream;
using std::ofstream;
using std::cout;
using std::endl;
using std::getline;
using std::left;
using std::setw;



void readData(ifstream& in, string &name, double& elevation, double& latitude, double& longitude,
	int &TPCP, int &MNTM );

void weatherSummary ( string inputfile , string outputfile );
Line 53: An if is required after else.
Topic archived. No new replies allowed.