This website is preserved for historical and scholarly reference and is no longer actively maintained.
 
                         CpSc 241, Section 1
                             Assignment 2
                           26 January 2000


Due: Wednesday, February 2 at midnight

Late penalties: 20 points per partial day late.  That is, programs
	turned in after midnight Wednesday and before midnight Thursday
	will have 20 points deducted for late, programs turned in after
	midnight Thursday and before midnight Friday will have a total
	of 40 points deducted for late, etc.

Total point value of assignment:  100 points

Late submissions not accepted after: Sunday, February 6 at midnight

This assignment is to be done in groups of two or three as assigned
in class..  Since it is illegal to give your computer password to
anyone else (even for the purpose of doing this assignment) you
will need to send copies of the program to one another using Email.
You may find it convenient to meet as a group in a lab and all gather
around the same computer and then Email the finished program to the
other members of the group.  EXPECT THE NEXT ASSIGNMENT TO BE AN
INDIVIDUAL ASSIGNMENT. 

Please Email the instructor a list of the people working in your group.

Please call your program that meets the requirements of the assignment

				a2.cc or a2.cpp

and submit your program using the handin command.

The objective of this program is to give you some more experience working
with the C++ environment and the concepts of Chapter 1.  You are to
write a C++ program as follows:


Input:

	Using cin, request the user to enter a word.  


Output:

	Write the functions described in exercise 1.6 on page 38
	to print all permutations of the string.  You should use the
	two functions:

		void permute ( const string & str );
		void permute ( const string & str, int low, int high );

	but you may print the permutations from either function.


Substring:

The substr() operation generates a copy of a substring of an existing
string object.  Its first argument indicates the start position within
the string.  The optional second argument indicates the length of the
substring.  If we omit the second argumennt, the remainder of the
string is copied.  For example,

	string s = "abcde";
	s.substr(0,2)  will contain "ab", and
	s.substr(2)    will contain "cde".


Other requirements:

	Either write all functions in a single file or in such a manner
	that only the main will be executed.

	The names of all group members MUST appear at the top of the
	program.  Other required information which must be typed 
	as a comment at the top of the program:

		the assignment number
		the date completed
		a short statement of what the program does


Grading rubric:

	Required documentation 10 pts.
	In the opinion of the instructor the program is an honest attempt
		to complete the assignment as described  10 pts.

	If the two previous requirements are not met, no further points
		will be awarded.

	The program compiles without error (g++ assumed -- you must
	proclaim on the first line of the program if the program will
	not run with g++, but will run with CC.  20 points

	The program reads the input and correctly handles any
	sequence of empty strings from the user.  10 points

	The program prints at least two permutations of the string,
	but not all correct permutations. 10 to 20 points (variable)

	The program prints all correct permutations.  50 points