our task is to determine how the computers should be connected into such a chain to minimize the total amount of cable needed. there are 20 terminals each has a corresponding coordinate(x,y). the user will just choose which terminal he will put his pc's.
1. you wil ask the user first if how many pc's he will use (should be less than or equal to 20)
2. enter the terminal number he will use (1-20)
3. calculate minimum path for cabling

we just studied basic C++ for only 10 days and im running out of ideas how will you solve this.. i only know cin,cout, if else,for loop,do while loop,while loop, basic array (really basic), switch .....
please help me. sumbody told me to use permutation and sort but i dont know how. please help.......

Recommended Answers

All 4 Replies

Which terminal he will put his PC ?

Are there 20 pre-existing x,y coordinates or are you setting the coordinate for each terminal you say exist?

This is a form of path traversal. This can be done more easily with recursion!

Is this a single line and each terminal is a point on that line? Terminals can be in all sorts of configurations, star, daisy chain, etc.

the user will choose which terminal he will use and there are 20 pre-existing x,y coordinates..this program only uses a linear bus network

can you make a text picture!

* * * * *
* * * * *
* * * * *
* * * * *

those asterisks are the terminals...the user will just pick which terminals he will use for his pc's..
the problem is to find the shortest path between those terminals he will choose that will connect them in a linear network

Be a part of the DaniWeb community

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