CMSC 162
Fall 2017
08/31/2017
References and Review
Due: variable (see below)
 

Handin:
  • Problem 1 is due at the end of lab
  • Problems 2 and 3 are due Th, Sept 7 at 9:30am
  • Each section will have its own handin instructions.

Assignment: 

0)  Advice:
Change to the directory you created last week.  For instance:
  • cd 162
Make a directory for this lab:
  • mkdir lab1
  • cd lab1
yellow separator

1) DUE AT THE END OF LAB
 a) 
Copy the FootballPartyFood.cpp file to your directory via the following command:

  • cp ~scottmce/162files/FootballPartyFood.cpp  .
b) Look through the program and understand it.    

c)  Compile and run.  Note that it does not work properly.

d)  Modify the program so that it works as described.   RESTRICTION:  You are only allowed to modify function headers.

e)  Add any comments you feel are appropriate.

Handin as follows:
handin cmsc162 lab1football   FootballPartyFood.cpp


yellow separator

2)  
For this, you will create a program from scratch.  Create a file called XObox.cpp that, when the main program is run, it will:
- ask the user for two numbers, a width and a height
- take those two numbers and displays a box of O's of that width and height, with X's around the outside.   For instance, width = 5 and height = 4 should produce:

XXXXXXX
XOOOOOX
XOOOOOX
XOOOOOX
XOOOOOX
XXXXXXX

The box should be displayed in the console/terminal window.

Additional requirements:

  • If the user types in a negative number for either the width or height, the program should tell them that they made a mistake and ask them for another number.  The box should not be drawn until the user has entered non-negative numbers for both the width and height.  (Note that 0 is a valid answer for the user to give.  What kind of picture should result then?)
  • Be sure to put appropriate comments in your program.
Handin as follows:
handin cmsc162 lab1xo  yourprogramfilename.cpp

yellow separator
3) Get the directory  StringReview:

cp -r  ~scottmce/162files/StringReview  .

Note that the -r says to get the contents of this whole directory.  ("r" stands for recursive, which we will be discussing in a couple of weeks.)

Now, change into the directory:    cd StringReview

Look at all of the code in the directory

Look at all of the code in this directory.   Understand the nature of the prototypes as well as the .h  vs  .cpp file structure.

Your task is to complete the three functions in StringFuncs.cpp

For purposes of this assignment in addition to AEIOU, Y is considered to be a vowel unless it is followed by another vowel.

Testing:
To compile your program:
compile  TestingStringFuncs.cpp StringFuncs.cpp  
or    
compile   *.cpp     which uses the "wildcard"  *

You will likely wish to modify the testing file to include additional test cases.   I certainly will be adding addiitonal test cases when I grade.

Handin as follows:
handin cmsc162 lab1strings  StringFuncs.cpp