I've been coding on and off for 3 months now and tend to draft out my code by hand before I implement it, so please go easy on me. ;-)
here's a link for reference.
The function in question is ‘solutions’ The print function is just an iterator I use to print vectors for testing. My full project will use structs, so the global variables are just for reference.
Imagine I have an instance of mastermind with 6 slots and 6 colours and I want to use an int vector to represent all possible permutations.
Now, this works fine when length and num are predetermined, but if I want to use cin, then I will have to solve for the general case.
I would like to solve this using only standard c++/c++11 libraries and avoiding ‘algorithm’.
I cannot for the life of me work out a route.
Mathematics hints that a dynamic matrix using an array/vector would be equivalent to simultaneous equations, but I have not found any success.
Many thanks for your time!
Aucun commentaire:
Enregistrer un commentaire