# Oops

Printable View

• 04-25-2003
Flick
assignment
My professor has given me this programming assignment to be done in C++ (which I have never really used, but I know the basic syntax) Here is the problem:
We are given a chart with 10 cities and how long it takes to get from one to the other, we have to determine what would be the fifth shortest route to take and the third longest, visiting every city starting from 'A' and ending in 'A'.

It looks to me like I'm going to have to make a vector to keep track of all of the trips, and to determine every trip possible I will need a permutations function (which I have already), and to keep track of all of the distances I would need an 8X8 matrix. Using this method, I do think I know everything that's going to have to done, but it just seems like a lot (to me), I just wanted to make sure I am on the right track before I get started. Also after I finish this, I'm going to have to write the program again in fortran, is that going to be a lot more difficult? Thanks for any help anybody offers!
• 04-25-2003
7stud
"Using this method, I do think I know everything that's going to have to done, but it just seems like a lot (to me), I just wanted to make sure I am on the right track before I get started."

Programming doesn't work that way. You make a plan, you start coding, and if needed you change your plan as you go along.
• 04-25-2003
DougDbug
It's always good to plan first.

You should not need vectors. A 2-dimensional array (matrix) should do.

I haven't really thought deeply about this... or drawn myself any pictures... but I think you need a 10 x 10 matirx, then you ignore 10 of 'em (point A to A, etc) Actually, you only need half of the matrix, because A-to-B is the same distance as B-to-A.

Fortran shouldn't any more difficult. It all depends on which language the programmer is more familiar with. I don't remember any Fortran, but it seemed easier to learn than C/C++.
• 04-25-2003
Flick
Oops
Oops, I meant 8 cities, I don't know why I said 10, anyway though, I planned to use the vector to keep track of the order in which the trips would take, because I need the 5th and 3rd not the fastest and longest... Thanks for the input!
• 04-25-2003
Flick
I give up
This was supposed to be a reply to my other thread, but I didn't click reply, sorry everyone.
• 04-26-2003
adrianxw
>>> This was supposed to be a reply to my other thread,

And now it is!