cout<<"Enters the icaoCode : ";
cin>>input;
for (int i=0;i<airports.size();i++)
{
if(airports[i].getIcaoCode()==input)
cout<<"longitude is "<<airports[i].getLongitude()<<endl<<"Laltitude is "<<airports[i].getAltitude()<<endl;
}
}
break;
case 2:
{
int num=0;
cout<<"Enters the isoCode for the country : ";
cin>>input;
for(int i=0;i<airportSize;i++){
if(airports[i].getIsoCountry()==input)
num++;
}
cout<<"there are :"<<num<<" Airports in this ISOCODE" <<endl;
}
break;
case 3:
{
cout<<"Enters the isoCode for the country : ";
cin>>input;
for (int i=0;i<airportSize;i++)
{
if(airports[i].getIsoCountry()==input)
cout<<airports[i].getName()<<endl;
}
}
break;
case 4:
{
cout<<"Enter the name of a continent"<<endl;
cin>>input;
cout<<"The airports are :"<<endl;
for(int i=0;i<countrySize;i++)
{
if(countries[i].getContinent()==input)
cout<<countries[i].getName()<<endl;
}
}
break;
case 5:
cout<<"Enters the isoCode for the country : ";
cin>>input;
notFound = true;
counter = 0;
for ( int i = 0; i < countries.size(); i++) {
if(airports[i].getIsoCountry()==input && airport[i].getType()=="large_airport")
cout<<airports[i].getName()<<endl;
if (counter < 1) {
cout<<"There is no large airport in this country\n";
}
break;
}
case 6:
{
cout<<" enter the icaoCode"<<endl;
cin>>input;
for(int i=0;i<airports.size();i++){
if(airports[i].getIcaoCode()==input)
cout<<"Distance from doha international airport is = "<<doha.distanceTo(airports[i])<<endl;
}
}
break;
case 7:
{
cout<<"enter the isoCode"<<endl;
cin>>input;
for(int i=0;i<airportSize;i++)
{
if(airports[i].getIsoCountry()==iso)
cout<<"Distance between Doha Airport and "<<airports[i].getName()<<endl<<"is "<<airports[31525].distanceTo(airports[i])<<endl;
}
}
break;
case 8:
{
cout<<"Enters the name of the municipality : ";
case 9:
{
cout<<"Exiting."<<endl;
exit(0);
}
}
return 0;
}
void printMenu()
{
cout<<"1. Display the latitude and longitude of a given airport.\n"
"2. Display the number of airports in a given country.\n"
"3. Display all the airports in in a given country\n"
"4. Display all the airports in a given continent.\n"
"5. Display all the large_airports in a given country\n"
"6. Display the distance between Doha International Airport and an airport whose icaoCode is entered by the user.\n"
"7. Display the distances between Doha International Airport and all airports of a given country.\n"
"8. Display all the airports in a given municipality\n"
"9. Exit the application\n";
}
//This still need to be worked on
void readAirport (string fileName, vector<Country> & countries, vector<Airport> & airports) {
ifstream in ;
in.open(fileName.c_str(),ios::in);
string line;
vector<string> strings;
if (in.is_open()) {
getline(in,line);
while (getline(in,line) ) {
strings = line2strings(line);
if (strings.size() == 8) {
Airport airport(
atoi(strings.at(0).c_str()),
strings.at(1).c_str(),
strings.at(2).c_str(),
strings.at(3).c_str(),
atof(strings.at(4).c_str()),
atof(strings.at(5).c_str()),
strings.at(6).c_str(),
strings.at(7).c_str()
);
airports.push_back(airport);
for (unsigned int i = 0; i < countries.size(); i++) {
if (string s.at(6) == countries.at(i).getCode()) {
countries.at(i).addAirport(airport);
break;
}
}
}
}
}
}
void readCountry(string fileName, vector<Country> & countries){
ifstream in ;
in.open("countries.csv");
string line;
vector<string> strings;
if (in.is_open()) {
getline(in,line);
while (getline(in,line) ) {
strings = line2strings(line);
// if (strings.size() == 4) {
// Country country( atoi(strings.at(0).c_str()), strings.at(1).c_str(),strings.at(2).c_str(),strings.at(3).c_str() );
// countries.push_back(country);
}
}
So....What do you need help with? You just posted your code and never asked a question.
Also, if you could please edit your first post and put code tags around it. You can edit and press the <> button after selecting your code or type [code] before and [ /code] (without space) after.