Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names (until -1), and use a recursive method to...


Hi I would help with completing this. Thank you


Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one<br>word names (until -1), and use a recursive method to create and output all possible orderings of those names separated by a comma, one<br>ordering per line.<br>When the input is:<br>Julia Lucas Mia -1<br>then the output is (must match the below ordering):<br>Julia, Lucas, Mia<br>Julia, Mia, Lucas<br>Lucas, Julia, Mia<br>Lucas, Mia, Julia<br>Mia, Julia, Lucas<br>Mia, Lucas, Julia<br>324984.1778288.qx3zqy7<br>main.cpp<br>Load default template...<br>1 #include <vector><br>2 #include <string><br>3 #include <iostream><br>4<br>5 using namespace std;<br>6.<br>7 // TODO: Write method to create and output all permutations of the list of names.<br>8 void PrintAllPermutations (const vector<string> &permList, const vector<string> &nameList) {<br>9.<br>10 }<br>11<br>12 int main() {<br>13<br>vector<string> nameList;<br>vector<string> permList;<br>string name;<br>14<br>15<br>16<br>17<br>// TODO: Read in a list of names; stop when -1 is read. Then call recursive method.<br>

Extracted text: Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will read a list of one word names (until -1), and use a recursive method to create and output all possible orderings of those names separated by a comma, one ordering per line. When the input is: Julia Lucas Mia -1 then the output is (must match the below ordering): Julia, Lucas, Mia Julia, Mia, Lucas Lucas, Julia, Mia Lucas, Mia, Julia Mia, Julia, Lucas Mia, Lucas, Julia 324984.1778288.qx3zqy7 main.cpp Load default template... 1 #include 2 #include 3 #include 4 5 using namespace std; 6. 7 // TODO: Write method to create and output all permutations of the list of names. 8 void PrintAllPermutations (const vector &permList, const vector &nameList) { 9. 10 } 11 12 int main() { 13 vector nameList; vector permList; string name; 14 15 16 17 // TODO: Read in a list of names; stop when -1 is read. Then call recursive method.

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here