954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C++ minimum cabling needed

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.......

eaon21
Newbie Poster
6 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

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.

wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
 

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

eaon21
Newbie Poster
6 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

can you make a text picture!

wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
 

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

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

eaon21
Newbie Poster
6 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You