I have a program which is supposed to find the shortest path between airports and users' flight data to find the shortest path between airports; that is, the airports are the nodes and the flights are the edges.

I've not started to implement the algorithm as yet but I am working on the implementation of the airports and the flights.

Unfortunately, my program crashes when I am testing. I've put in debug statements in the code to find out where and why it's crashing but, unfortunately, I'm having a hard time.

I am going to attach the files if anyone could please tell me where I've gone wrong that would be greatly appreciated. Thanks.

Member Avatar for jencas

After inspecting airports.cpp of your source code I recommend that you read a good C++ book. A std::vector of objects member variable doesn't need any initialization in the ctor and no destruction in the dtor. And what the hell do you want to destroy with

flights.~vector();

?

Well, your program crashed. It looks like a mere assertion, not a question.
Read This Before Posting: http://www.daniweb.com/forums/thread78223.html.
Never send exe files in attachments!

sorry my bad didn't realize there was an exe in it, but its not harmful. Sorry again

After inspecting airports.cpp of your source code I recommend that you read a good C++ book. A std::vector of objects member variable doesn't need any initialization in the ctor and no destruction in the dtor. And what the hell do you want to destroy with

flights.~vector();

?

thanks for pointing that out for me. Sorry I am very new to C++ programming I usually program in Java. I have read lecture notes and done some tutorials, I thought i was doing the right thing.

May you please help me a little more so i can get this working and understand were i have gone wrong.

There is an error in the airport1.txt file on line 90 SYD BNE 07:30 1:00 getline() reads it in as SYD BNE07:30 1:00 -- missing the space between BNE and 07:30. I re-typed the line and the program continued to work from there until the next error, which was at the destructor

AllAirports::~AllAirports() {
    airports.~map();
}

You can't explicitly call a c++ class's destructor like that because it will crash your program.

commented: shows amazing talent and experience +1

There is an error in the airport1.txt file on line 90 SYD BNE 07:30 1:00 getline() reads it in as SYD BNE07:30 1:00 -- missing the space between BNE and 07:30. I re-typed the line and the program continued to work from there until the next error, which was at the destructor

AllAirports::~AllAirports() {
    airports.~map();
}

You can't explicitly call a c++ class's destructor like that because it will crash your program.

WOW, you are pretty good, I hope i can improve and get to that level. Thanks you i will keep trying

The secret is using a great compiler's IDE, such as VC++ 2008 Express, and learning how to debug programs.

The secret is using a great compiler's IDE, such as VC++ 2008 Express, and learning how to debug programs.

That solved all the problems. I am really impressed by you, how long did it take for you to get that good? i think i would have to have studied for years to get insight like that.

What else can i do to improve?

Thank very much i appreciate it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.