Why does it show error C2228?
hi...i am new with this forum and new to VC++ too..I am facing some problem and can't solve it.Please help me ya... :) Thanks o...
this is my header file:
#include "StdAfx.h"
#ifndef FLIGHT_H
#define FLIGHT_H
#include <string>
using std::string;
class flight
{
public:
int FlightTypeIdentify(int flightAction, string departLocation, string destination_1, string destination_2);
void NotflightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string DeLocation, string dest_1, string dest_2,int Type, string AirType, string PSizeType);
void flightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string PSizeType, string DeLocation, string dest_1, string dest_2, string AirType);
int flightType;
set<string> domestic_name;
set<string>::iterator set_iter, set_iter1, set_iter2;
string flightNumber;
int flightAction;
int expectTime;
string regNumber;
int planeSize;
string departLocation;
string destination_1;
string destination_2;
string AirCraftType;
string PlaneSizeType;
flight();
virtual ~flight();
};
#endif
and here is my flight.cpp
include "stdafx.h"
#include "flight.h"
#include <string>
using std::string;
//#ifdef _DEBUG
//#undef THIS_FILE
//static char THIS_FILE[]=__FILE__;
//#define new DEBUG_NEW
//#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
flight::flight()
{
domestic_name.insert("AOR");
domestic_name.insert("BKI");
domestic_name.insert("BTU");
domestic_name.insert("IPH");
domestic_name.insert("JHB");
domestic_name.insert("KBR");
domestic_name.insert("KCH");
domestic_name.insert("KUA");
domestic_name.insert("KUL");
domestic_name.insert("LBU");
domestic_name.insert("LDU");
domestic_name.insert("LGK");
domestic_name.insert("MYY");
domestic_name.insert("PEN");
domestic_name.insert("SBW");
domestic_name.insert("SDK");
domestic_name.insert("TGG");
domestic_name.insert("TWU");
}
flight::~flight()
{
}
void flight::flightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string PSizeType, string DeLocation, string dest_1, string dest_2, string AirType)
{
flightNumber = FNumber;
flightAction = FAction;
expectTime = ExTime;
regNumber = RegNumber;
planeSize = PSize;
departLocation = DeLocation;
destination_1 = dest_1;
destination_2 = dest_2;
AirCraftType = AirType;
flightType = FlightTypeIdentify(flightAction,departLocation,des tination_1,destination_2);
PlaneSizeType = PSizeType;
}
void flight::NotflightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string DeLocation, string dest_1, string dest_2, int Type, string AirType, string PSizeType)
{
flightNumber = FNumber;
flightAction = FAction;
expectTime = ExTime;
regNumber = RegNumber;
planeSize = PSize;
departLocation = DeLocation;
destination_1 = dest_1;
destination_2 = dest_2;
flightType = Type;
AirCraftType = AirType;
PlaneSizeType = PSizeType;
}
int flight::FlightTypeIdentify(int flightAction, string departLocation, string destination_1, string destination_2)
{
if (destination_2.empty()) //it is direct flight
{
if (flightAction) //if it is departure
{
set_iter = domestic_name.find(destination_1);
if ( set_iter!=domestic_name.end() )
{
return true; //domestic
}
else
{
return false; //international
}
}
else //if it is arrival
{
set_iter = domestic_name.find(departLocation);
if ( set_iter!=domestic_name.end() )
{
return true; //domestic
}
else
{
return false; //international
}
}
}
else //indirect flight
{
set_iter = domestic_name.find(destination_1);
set_iter1 = domestic_name.find(destination_2);
set_iter2 = domestic_name.find(departLocation);
if ( set_iter!=domestic_name.end() && set_iter1 != domestic_name.end() && set_iter2!=domestic_name.end())
{
return true; //domestic
}
else
{
return false; //international
}
}
}
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2143: syntax error : missing ';' before '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2501: 'set' : missing storage-class or type specifiers
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2059: syntax error : '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2238: unexpected token(s) preceding ';'
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2143: syntax error : missing ';' before '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2501: 'set' : missing storage-class or type specifiers
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2059: syntax error : '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2039: 'iterator' : is not a member of '`global namespace''
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2238: unexpected token(s) preceding ';'
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(26) : error C2065: 'domestic_name' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(26) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(27) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(28) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(29) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(30) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(31) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(32) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(33) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(34) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(35) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(36) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(37) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(38) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(39) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(40) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(41) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(42) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(43) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(88) : error C2065: 'set_iter' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(88) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(89) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(100) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(101) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(113) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(114) : error C2065: 'set_iter1' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(114) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(115) : error C2065: 'set_iter2' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(115) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(116) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(116) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(116) : error C2228: left of '.end' must have class/struct/union type
Error executing cl.exe.
|