CS 141 - Lab 3

Permutations

Directions

Find a partner. Solve the following programming problem in C++. When you finish, turn it in electronically, one copy per team. When you are done, you should work on Homework 2 or Programming Assignment 2.

Overview

Given a list of letters, output all of the permutations of those letters, without repeats.

Input Spec

Read in a single integer: this is the number of cases (letter sets) you will do on this run of the program. (1 int)

For each letter set, read in a single string.

Continue with the next case.

Output Spec

Your output must match exactly the following, including whitespace.

Print out in alphabetic order the permutations of the letters for each set, one per line. Repeats are not allowed.

Testing

Test cases can be found here. Run these using regular UNIX redirection & testing:
./lab3 < inputFile | diff - outputFile
Where inputFile and outputFile will be one of these or a pair of your own creation.
lab3test1.in lab3test1.out
lab3test2.in lab3test2.out
If the testing line above produces no output when run with these tests, then you have completed the program.

Recommended Approach