I was wondering if its possible to create a c++ program where a set of 3 variables each have a value. A list of items each contain a different value for each of those 3 variables. The program then selects 3 random items and creates 3x3 matrix and solves it to produce how many of each item are needed.
Program picks 3 random items, creates a matrix, solves it, and then outputs:
"You need 3(Item 1) 2(item 2) and 4(item 5)to meet the requirements X=22 Y=38 and Z= 29"
The program could then be ran again but would pick another set of 3 items that also meets the requirements of X Y and Z.
If this can be done and anyone knows how or knows any information I could read to learn how to do this it would be a great help.
Divide your problem into parts, solve them and finally code them:
Problem 1: Get input. It might be hardcoded, user-provided or read from file. Also you want to choose a container to store data. It is obvious that yo want to store each individual item in structure (tuple?) and all items should be in another (dynamic? vector?) container.
Problem 2: Choose three items at random. Knowing size of container and having access to either C random facilities (Bad) or C++ random number generators (good) it is easy. Potential problem: how to handle picking same item twice? Potential solutions: remove items as they are selected, randomly shuffle array and choos first three elements.
Problem 3: Solve system of equations. How would you do it by hand? How to represent that system? How to code solution?
If you have trouble with any part, try to divide it further. If you cannot, tell what exactly you have problem with, and we will help.
Sounds like linear anaysis/programming/optimisation. If so the answer is yes and matrices would eat it. There are many good sources if you surf around for code to handle matrices, especially small 3x3 matrices which you could write yourself with reasonable C++ skill.
Wikipedia is a good start to get a handle on the technology, especially to see whether it fits.