need a program that would do this...

Hi everyone!

I have a problem for C++ gurus!

I'm not a programmer but I've installed CodeBlocks 16.01 for Linux on my computer to be able to compile and execute the program.

(I have simplified my real problem to the maximum).

Thanks VERY MUCH to those who know how to write a program to do this:

-------------------------------------------------

How many names do you have? 4 (variable)
How many name pairs should I select? 3 (variable)

Name #1? A Weight? 2
Name #2? B Weight? 5
Name #3? C Weight? 1
Name #4? D Weight? 4

(Sort all the name pairs combinations)
"AB" height? 3
"AC" height? 9
"AD" height? 4
"BC" height? 5
"BD" height? 2
"CD" height? 4

Computing....... the total 3 lowest heights (name pairs), total lowest weights, are :

(Sort all the 3 name pairs combinations, then the weights)
AB+AD+BD=9 A+B+D=11
AB+BD+CD=9 A+B+C+D=12
AB+BC+BD=10 A+B+C+D=12
AD+BD+CD=10 A+B+C+D=12
BC+BD+CD=11 B+C+D=10
AB+AD+CD=11 A+B+C+D=12
AD+BC+BD=11 A+B+C+D=12
AB+AD+BC=12 A+B+C+D=12
AB+BC+CD=12 A+B+C+D=12
AD+BC+CD=13 A+B+C+D=12
AB+AC+BD=14 A+B+C+D=12
AC+AD+BD=15 A+B+C+D=12
AC+BD+CD=15 A+B+C+D=12
AB+AC+AD=16 A+B+C+D=12
AB+AC+CD=16 A+B+C+D=12
AC+BC+BD=16 A+B+C+D=12
AC+AD+CD=17 A+C+D=7
AB+AC+BC=17 A+B+C=8
AC+AD+BC=18 A+B+C+D=12
AC+BC+CD=18 A+B+C+D=12

Computing....... the total lowest weights, total 3 lowest heights, are :

A+C+D=7 AC+AD+CD=17
A+B+C=8 AB+AC+BC=17
B+C+D=10 BC+BD+CD=11
A+B+D=11 AB+AD+BD=9
A+B+C+D=12 AB+BD+CD=9
A+B+C+D=12 AB+BC+BD=10
A+B+C+D=12 AD+BD+CD=10
A+B+C+D=12 AB+AD+CD=11
A+B+C+D=12 AD+BC+BD=11
A+B+C+D=12 AB+AD+BC=12
A+B+C+D=12 AB+BC+CD=12
A+B+C+D=12 AD+BC+CD=13
A+B+C+D=12 AB+AC+BD=14
A+B+C+D=12 AC+AD+BD=15
A+B+C+D=12 AC+BD+CD=15
A+B+C+D=12 AB+AC+AD=16
A+B+C+D=12 AB+AC+CD=16
A+B+C+D=12 AC+BC+BD=16
A+B+C+D=12 AC+AD+BC=18
A+B+C+D=12 AC+BC+CD=18
Last edited on
1. Sort the m numbers in ascending order.
2. Take the first n numbers of the sorted sequence.
3. The sum of these numbers is the smallest.
Thank you but I need a program that would do exactly what I wrote above
Last edited on
Maybe try posting in the jobs forum here? -- http://www.cplusplus.com/forum/jobs/

There are probably students who would appreciate the challenge and do it cheaply. Otherwise someone may write it for you but don't hold your breath... this forum is mainly designed to help others learn to code.
Do you believe that the program to do this would be so big/difficult?
No, it's pretty trivial. This forum isn't a coding service, though.
You say the program is pretty trivial.
This precisely is the reason why I didn't hire a programmer.

I'd be happy to learn how to program but for now, I'd be very grateful to anyone who could help me.

Thank you very much!
closed account (48T7M4Gy)
Hi logan,

I'd be happy to learn how to program but for now, I'd be very grateful to anyone who could help me.


That's what we are here for and to that end you might like to direct your introductory studies to http://www.cplusplus.com/doc/

People here can help you with any aspects of your coding attempts or other learning questions.
Thank you kemort but the problem I currently have is a lack of time otherwise I would have started to learn how to program and try to write my first program!
Last edited on
closed account (48T7M4Gy)
I currently have is a lack of time
Join the club.

Believe me once you get the computer to say 'Hello, world!' and you've done it with C++ time priorities might change for you and think of all the money you'll save. BTW it sounds like you are processing boxing matches.

PS http://www.cplusplus.com/doc/tutorial/program_structure/ all you have to do is click on the wheel top RH corner of purple code block.
How long do you believe it would take for a complete beginner?
closed account (48T7M4Gy)
How long


Try the first couple of sections on the tutorial.

Most of the time the sample programs are enough to get started if you read/use them critically.

Beyond that, who knows? Most beginners as formal students get by with one semester at a couple of hours a week. There are books around, Learn C++ in 24 hours. If you follow that idea you've now got about 13 hours left.

Last edited on
The tutorial doesn't seem to be very difficult but I believe you've been very optimistic.
I'm not a genius and I believe I will need a lot of time before my program run!
closed account (48T7M4Gy)
So what did you learn? Especially which lines have you adapted to your project - perhaps a heading or welcome.
I learnt that I'll need to use arrays & variables to store the results of arithmetic operations, then sort them (how???), syntax is really weird!!!
I'm afraid I need to find another solution, I'm not on holidays and unfortunalely haven't got enough time to spend on this, thank you.
If someone could write the program for me, that would be cool, I'm sure that it will be an excellent reference for me to start programming!
Have a look in the jobs section. Probably you will find someone there.
http://www.cplusplus.com/forum/jobs/
Topic archived. No new replies allowed.