CIS 327 Lab 3

Points: 30 Due Date: Monday August 18, 2003

This will mean working with strings. First, read in a string from the user. This line could include spaces so you either have to read it in using something like getline or character by character.

You will need a function that returns boolean (NOT int) and takes a single character as an argument. It will return true if the character passed in is a punctuation character. You can pick the characters, for example ,;:."'.

You will need another function that takes a character pointer as an argument and returns a character pointer. It will create a new character array using new. It will then examine each character in the passed in string and copy only the characters that are NOT punctuation characters. This will involve using the other function. After copy all the non-punctuation characters, it will return the new array to the caller.
Remember, the returned array must be a C string.

Lastly, you will need another function that will take a character pointer and print the passed in string backwards. This funtion doesn't return anything.

The main() will get the original string from the user and print it. Then it will call the clean up function and print the results. It will passed the cleaned up string to the backwards printing function which will print it backwards.

NO array usage ([]), only pointer references. And NO pseudo-array stuff like *(p+i); Time to dive into the deep end. Spend a lot of time thinking before you write.

I have written a solution to this and it is available here. You should be able to just download and run this to see an example of what the the results should look like.

Deliverables:

You should turn in a listing of the program. Staple the cover sheet to that.

Notes

Start as soon as you can, pointers are quite tricky and can be confusing. Think about how you will do this so you can ask questions during lab.
ASK if you have any questions.