Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
/* Code should print every possible combination
of the values seperated by commas.
Make sure to research the <algorithm> library.
E.g. if items contains the value 3, 2, 1 then code should
output:
1, 2, 3,
1, 3, 2,
2, 1, 3,
2, 3, 1,
3, 1, 2,
3, 2, 1,
The order of the permutations does not matter although the
order of values in each permutation obviously does.
The values are supplied as command line arguments
when running the program.
I.e. bin/lab_algorithm 3 2 1
*/
int main( const int argc, const char *argv[] )
{
std::vector<std::string> items( argv+1, argv+argc ); // put the command line arguments into vector
std::cout << "The items are:" << std::endl; // print list of arguments
for( std::string &i : items )
std::cout << " " << i << std::endl;
std::cout << "The permutations are:" << std::endl;
//COMPLETE ME
return 0;
}