CSE 250 - Spring 2009 - Banner
UB -
University at Buffalo, The State University of New York Computer Science and Engineering
  • CSE 250 - Spring 2009
CSE 250 - Spring 2009 - Navigation

In-lab Exercise 3
Last modified: February 15 2009 03:36:08 PM

CSE 250 - Spring 2009 - In-lab Exercise 3

This exercise can be completed individually or with a self-selected partner.


Your program is to generate a list of valid sub-phrases from a given phrase entered by the user. A valid sub-phrase is one that uses at least two of the words in the phrase and can use all of the words in the phrase. The words used from the phrase must appear in the same order as in the original phrase.

For example, from the phrase "the black cat walks at midnight", valid sub-phrases are "black cat midnight" and "walks at", but not "black walks cat".

The sub-phrases are to be written into a file as they are generated. The user should specify the name of the file that they want the phrases written to.

If working with a partner

If you choose to work with a partner on this assignment, you must also implement an additional piece of functionality to earn full points. This functionality will allow the user to specify an input file with phrases stored in it. The program opens the file, reads in each phrase and outputs the sub-phrases to a file. You can assume that the file is organized so that each original phrase is on its own line.


You will need a file named Exercise3Driver.cpp which will contain your main function and the code for the user interface. The functions needed to break down the sub-phrases should be in a file named subPhrases.cpp. You will need a header file named subPhrases.h as well.

What to submit

You should ensure that all your files are in a directory named Exercise3. Zip up your Exercise3 directory to make a file called Exercise3.zip. You should submit the file Exercise3.zip using the electronic submission command submit_cse250.

Due Date

The files that need to be submitted are due to be turned in by 11:59:59pm on Monday, February 16th. Note, there will be a new assignment next week and the week after, so plan your work on this assignment accordingly.

CSE 250 - Spring 2009 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@cse.buffalo.edu | 130 Bell Hall | (716)645-3180 x 161